Skip to main content

A Python Client for Metablock API

PyPI version Python versions Build codecov

This is an asynchronous python client for metablock API.

Installation

This is a simple python package you can install via pip:

pip install metablock

Usage

Create the client

from metablock import Metablock

cli = Metablock()

# get the user associated with the API token
user = await cli.user.get()

For the authentication token, you can use the METABLOCK_API_TOKEN environment variable, alternatively, you can pass it to the client constructor:

cli = Metablock(auth_key="your-token")

Most endpoints act within an organization, which is selected by the x-metablock-org-id header rather than by the URL. Set it via the METABLOCK_ORG_ID environment variable or pass it to the constructor:

cli = Metablock(auth_key="your-token", org_id="your-org-id")

Resource managers

The client exposes a manager per resource. Managers hold the behaviour and return plain data models, which are generated from the API's OpenAPI spec and live in metablock.schema:

# spaces, blocks and extensions are scoped to the org set on the client
spaces = await cli.spaces.get_list()
space = await cli.spaces.get("my-space")
blocks = await cli.spaces.blocks(space.id)

block = await cli.blocks.get(block_id)
await cli.blocks.ship(block.id, "path/to/bundle.zip", env="prod")

extensions = await cli.org_extensions.get_list()
org = await cli.orgs.get("my-org")

Command line

You can also use the client from the command line, to do so, install the package with the cli extra:

pip install metablock[cli]

Then you can use the metablock command:

metablock --help

Metadata

Release files for metablock 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for metablock 2.0.1
File Size Uploaded
metablock-2.0.1.tar.gz 110.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for metablock 2.0.1
File Interpreter ABI Platform
metablock-2.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 127.5 kB

Release files / metablock-2.0.1.tar.gz

Download URL metablock-2.0.1.tar.gz
Size 110.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4259d7cfbf8c82f7882616eb538384282b7b53ac0f441540557586afb7eed4d7
BLAKE2b-256 checksum
How to use checksums
242d0ae663b90f4a76de235631d25aadee0dfe59c127f05f82f319df49f4425a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / metablock-2.0.1-py3-none-any.whl

Download URL metablock-2.0.1-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
24a2823e58daac6ab1137b08b98864c016847164fb71fe3c612e645e1eda552a
BLAKE2b-256 checksum
How to use checksums
1545aefb0277dc8ab2fc34326a9be47157f3073bc54a91e7020250655b399197
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

2.0.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

4 release files

0.1.3

4 release files

0.1.2

2 release files

0.1.1

3 release files

0.1.0

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page