Skip to content

Replace cmem-cmempy with cmem-client - #43

Open
msaipraneeth wants to merge 13 commits into
mainfrom
feature/migrate-cmempy-to-cmem-client
Open

Replace cmem-cmempy with cmem-client#43
msaipraneeth wants to merge 13 commits into
mainfrom
feature/migrate-cmempy-to-cmem-client

Conversation

@msaipraneeth

@msaipraneeth msaipraneeth commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replaces the cmem-cmempy dependency with cmem-client (eccenca's typed, httpx-based successor) across cmem_plugin_base and the test suite
  • setup_cmempy_user_access/setup_cmempy_super_user_access are kept as deprecated wrappers around new setup_cmem_client/setup_cmem_client_super_user_access functions that return a ready-to-use cmem_client.Client, so downstream plugins calling the old names keep working
  • File.read_stream and its convenience methods (is_text, read_bytes, text_stream, etc.) gain an optional client parameter, falling back to an ambient Client.from_env() for existing single-argument callers
  • Breaking: write_to_dataset now returns None (was requests.Response) and raises httpx.HTTPStatusError (was requests.exceptions.HTTPError) on failed uploads — documented in the CHANGELOG

Test plan

  • ruff check / ruff format --check on tests and cmem_plugin_base
  • mypy -p tests -p cmem_plugin_base
  • deptry . (no dependency issues, cmem-cmempy fully uninstalled via poetry sync)
  • grep -rn "cmem\.cmempy" cmem_plugin_base tests — no matches
  • Full pytest run against a live Corporate Memory instance (CMEM_BASE_URI) — 42 passed, 1 pre-existing unrelated skip

@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown

Coverage

Coverage Report
File Stmts Miss Cover Missing
init.py 0 0 100%
testing.py 65 13 80% 74 88-92 124 140 144 157-158 162 166
dataintegration/init.py 0 0 100%
dataintegration/context.py 57 0 100%
dataintegration/description.py 182 16 91% 46 73-74 146-147 151 161 166 180 186 227 241 365 408 416-417
dataintegration/discovery.py 49 36 27% 27 38-43 55-62 64 66-68 70 84-85 87-90 92-93 95-100 106 108
dataintegration/entity.py 31 3 90% 41 66 86
dataintegration/plugins.py 30 5 83% 23 27 31 35 50
dataintegration/ports.py 15 1 93% 32
dataintegration/types.py 115 13 89% 70-71 87 99 107 120 155 159-161 171 175 276
dataintegration/parameter/init.py 0 0 100%
dataintegration/parameter/choice.py 23 1 96% 26
dataintegration/parameter/code.py 52 0 100%
dataintegration/parameter/dataset.py 31 0 100%
dataintegration/parameter/graph.py 52 0 100%
dataintegration/parameter/multiline.py 4 4 0% 3 6 9-10
dataintegration/parameter/password.py 28 13 54% 11-13 17 34-37 39-40 53-55
dataintegration/parameter/resource.py 16 0 100%
dataintegration/typed_entities/init.py 6 0 100%
dataintegration/typed_entities/file.py 137 24 82% 71 75-76 80-81 85-86 90 93 96 157 168-169 193 215 217 245 264 267-272
dataintegration/typed_entities/quads.py 99 57 42% 90-106 135-139 142-146 149 159 162 179-186 189 192-194 196 199 202-208 210 213-216 219
dataintegration/typed_entities/typed_entities.py 28 2 93% 56-57
dataintegration/utils/init.py 51 0 100%
dataintegration/utils/entity_builder.py 86 0 100%
TOTAL 1157 188 84%  

Tests Skipped Failures Errors Time
59 1 💤 0 ❌ 0 🔥 42.217 ⏱

Covers the previously-untested surfaces from the cmempy -> cmem-client
migration: the deprecated setup_cmempy_user_access/
setup_cmempy_super_user_access wrappers, the new
setup_cmem_client_super_user_access client-credentials path (including
its DEPLOY_BASE_URL fallback and missing-config error), setup_cmem_client's
guard clauses, DatasetParameterType.label() and its dataset_type filter,
GraphParameterType's system-graph/unclassified-graph branches, and the
explicit-client half of File.read_stream's hybrid client/ambient-fallback
design.

utils/__init__.py, parameter/dataset.py and parameter/resource.py now sit
at 100% line coverage; parameter/graph.py at 96%.
…hared instance

Several needs_cmem tests were leaving orphaned projects/graphs on the shared
plugin-testing instance whenever a run didn't reach teardown, which then
broke every subsequent run with "already exists" errors. Fixtures and the
graph parameter test now delete-then-create their fixtures for idempotency,
and test project names carry a common cmem_plugin_base_ prefix for easier
identification on the shared instance.

Also fixes four setup_cmem_client tests that hardcoded http://docker.localhost
and the cmem-client library's placeholder OAuth secret, neither of which is
reachable/valid against CI's actual shared test instance. They now reuse the
already-configured ambient CMEM_BASE_URI/OAUTH_CLIENT_SECRET instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant