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.

Metadata

Release files for cmem-client 1.3.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.3.0
File Size Uploaded
cmem_client-1.3.0.tar.gz 150.9 kB Details

Built distribution (wheel)

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

Total release size: 358.6 kB

Release files / cmem_client-1.3.0.tar.gz

Download URL cmem_client-1.3.0.tar.gz
Size 150.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f81ae7cf3cf302486a7a8715e4816231e9cb7ba467d0f0fd9e63b40be4e97463
BLAKE2b-256 checksum
How to use checksums
2e450496d633c54fb99ff5800df7db2e1436f346a0d5d21cc2db8e703a8e36f3
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.3.0-py3-none-any.whl

Download URL cmem_client-1.3.0-py3-none-any.whl
Size 207.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e85a4e4e78b3277e9e01255daa5ced13e9c68c0454606eb1cc4233488f9bbbd2
BLAKE2b-256 checksum
How to use checksums
e87ff7fdcd99c3326c7ede6a18e60b111df8914e837a2c2214de256ce5a09f1d
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.3.0 This release

2 release files

1.2.0

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