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.2.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.2.0
File Size Uploaded
cmem_client-1.2.0.tar.gz 146.6 kB Details

Built distribution (wheel)

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

Total release size: 349.9 kB

Release files / cmem_client-1.2.0.tar.gz

Download URL cmem_client-1.2.0.tar.gz
Size 146.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7f60097371414088650c1b8bce84bdf3735db1b63f457a6f00499c3f78dd6a60
BLAKE2b-256 checksum
How to use checksums
1ac8bb0ad41d2f20a08af1ea736d8866e572d054b1df37f091937a8122512147
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-52-amd64

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

Download URL cmem_client-1.2.0-py3-none-any.whl
Size 203.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d2786b27b6dc5e5cec3d965ded4e4d1bca30c0aa6ae58e5d805d545ba72605e
BLAKE2b-256 checksum
How to use checksums
e990c6eb115ad65382d5524e9e7b2a0fe7c6d7062e22a4ce91c1e9a5800b147f
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-52-amd64

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

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