Skip to main content

cmem-client

Next generation eccenca Corporate Memory client library.

pypi version python versions license

cmem-client is the Python client library for eccenca Corporate Memory. Corporate Memory exposes its functionality through several services - DataIntegration (build), DataPlatform (explore), Keycloak and the Marketplace. This library hides that split behind a single typed and validated Python object: the client.

Features

  • Validated responses. Every response is parsed into a Pydantic model, so a typo in a server field becomes an error instead of a KeyError three frames later.
  • Proper typing. The whole package is type annotated and checked with mypy, so your editor can complete and check your code.
  • Dict-like collections. Repositories such as client.graphs behave like read-only dictionaries: len(), in, [] and iteration all work, and data is fetched lazily on first access.
  • Structured logging through the standard library, configured with one call on the client, including a TRACE level below DEBUG which logs the arguments and the result of the methods carrying the decorator.
  • Built on httpx, which would also allow asynchronous calls. The exposed client API is synchronous.

Installation

pip install cmem-client

The package requires Python 3.13 or newer.

Getting started

Point the client at your Corporate Memory deployment and give it credentials:

export CMEM_BASE_URI="https://mycmem.example.com/"
export OAUTH_GRANT_TYPE="client_credentials"
export OAUTH_CLIENT_ID="cmem-service-account"
export OAUTH_CLIENT_SECRET="my-secret"

Then create a client and ask the deployment how it is doing:

from cmem_client.client import Client

client = Client.from_env()

print(client.store.self_information.type)      # GRAPHDB
print(client.deployment.get_status().health)   # UP
print(len(client.graphs))                      # 6

That is the whole setup. Besides Client.from_env() there are Client.from_dict() for settings you hold yourself, Client.from_context() for use inside a Corporate Memory Python plugin, and Client.from_cmempy() to reuse an already configured cmempy environment.

What you can reach

Everything hangs off the client:

client.graphs           # RDF graphs in the store, a read-only mapping
client.projects         # DataIntegration projects
client.store.sparql     # SPARQL query and update
client.marketplace      # Marketplace packages

Further repositories cover datasets, workflows, queries, files, variables, schedulers, vocabularies, graph imports and insights, validations, access conditions, user and client accounts, Python packages and installed marketplace packages. The documentation lists them all.

Coming from cmem-cmempy

cmem-client succeeds cmem-cmempy, but it is not a drop-in replacement. Where cmempy offers module-level functions returning parsed JSON, this library gives you a client object whose responses are validated models:

# cmem-cmempy
from cmem.cmempy.dp.proxy.graph import get_graphs_list
graphs = get_graphs_list()                # list of dicts

# cmem-client
graphs = list(client.graphs.values())     # list of Graph models

If a cmempy environment is already configured in your process, reuse it directly with Client.from_cmempy().

Documentation

The full API documentation, including the complete configuration reference and the migration notes, lives at documentation.eccenca.com.

Release files for cmem-client 1.1.0

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

Source distribution (sdist)

Source distribution for cmem-client 1.1.0
File Size Uploaded
cmem_client-1.1.0.tar.gz 139.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cmem-client 1.1.0
File Interpreter ABI Platform
cmem_client-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 334.3 kB

Release files / cmem_client-1.1.0.tar.gz

Download URL cmem_client-1.1.0.tar.gz
Size 139.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5545e4718321e537b3945372790772a532df0d4cd67acfc6d28d6f529cd4d32b
BLAKE2b-256 checksum
How to use checksums
62599669a3c6152ca681428e03b7d77939a31b417e6315b38ba2a13e080ac923
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.4 CPython/3.13.13 Linux/6.1.0-41-amd64

Release files / cmem_client-1.1.0-py3-none-any.whl

Download URL cmem_client-1.1.0-py3-none-any.whl
Size 195.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b67025e96f7d1b4a861d401f76e19deb990cb9c70b684ccb776067aaad7b2833
BLAKE2b-256 checksum
How to use checksums
d38dfe91b83f260f7c0d8d51e0ccb1c41e73eb8880fcfc07cd584aea0cfc60ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.4 CPython/3.13.13 Linux/6.1.0-41-amd64

Release history Release notifications | RSS feed

1.2.0

2 release files

This release

1.1.0 This release

2 release files

1.0.0

2 release files

0.16.3

2 release files

0.16.2

2 release files

0.16.1

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.13.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.6.0

2 release files

0.5.0

2 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