feat: add family account management API - #1701
OfekAvergil wants to merge 6 commits into
Conversation
ruff-pre-commit v0.16.5 formats Python code blocks in Markdown, so any commit touching README.md fails the ruff-format hook until the existing blocks are formatted. No content changes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Add a `family` management module (sync and async) covering family CRUD and search, dependents, dependent impersonation, family settings and family entity custom attribute definitions. Extend the user module with add_families / remove_families, family-scoped user custom attribute definitions, family_associations on create, invite, update, patch and batch operations, and family_ids / dependent search filters. Equivalent of descope/node-sdk#793. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Coverage reportThe coverage rate went from
Diff Coverage details (click to unfold)descope/management/_family_base.py
descope/management/family.py
descope/management/common.py
descope/management/user.py
descope/management/user_async.py
descope/mgmt_async.py
descope/management/family_async.py
descope/mgmt.py
descope/management/_user_base.py
|
Log the decoded sub, act and dcf claims of the impersonation and stop-impersonation JWTs, without logging the tokens themselves. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
An assert with a side effect is skipped under python -O, so the call under test would silently not run. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
🐕 Shuni ReviewNo new issues found.
🤖 Model: Review scope: Partial incremental re-review Reviewed new changes (3)
🐕 Review complete — View session on Shuni Portal 🐾 🤖 Model: |
- Rename search to search_all with ids, names, text - create takes an optional id, matching tenant.create - Rename load_settings/update_settings to get_settings/configure_settings, matching password - create_dependent takes the dependent's family-scoped attributes for its family only - Validate empty input on impersonate_dependent and stop_impersonation - Add default_value to CustomAttribute - Add family_ids and dependent filters to search_all_test_users - Document that update replaces family memberships and family custom attributes - Sample and README cleanups Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
LioriE
left a comment
There was a problem hiding this comment.
Checked the two follow-up commits against the backend proto and the node/go branches. All review comments addressed, wire shape unchanged, sync/async identical, ruff and tests green locally.
https://github.com/descope/etc/issues/18737
Description
Adds the family account management API to the Python SDK. Equivalent of descope/node-sdk#793, adapted to Python SDK conventions (sync + async variants, shared
_family_base.py, snake_case args, raw dict responses).New
mgmt.familymodule (Family/FamilyAsync)create,update(patch semantics, omitted fields unchanged),delete,search(no args = all families)create_dependent,delete_dependentimpersonate_dependent,stop_impersonation(return the JWT string, likemgmt.jwt.impersonate)load_settings,update_settings(partial update)load_custom_attributes,create_custom_attributes,delete_custom_attributes(definitions on the family entity)mgmt.useradditionsadd_families(merges into existing memberships),remove_familiesload_family_scoped_custom_attributes,create_family_scoped_custom_attributes,delete_family_scoped_custom_attributesfamily_associationsoncreate,create_test_user,invite,update,patch, andUserObj(batch invite / patch batch)family_idsanddependentfilters onsearch_allNew public types
AssociatedFamily,CustomAttribute,CustomAttributeOption(exported fromdescope).Docs and sample
samples/management/family_sample_app.py: end-to-end walkthrough (settings, attribute definitions, family CRUD/search, guardian created into the family,add_familiesmerge, dependent, user search by family, impersonation, cleanup in reverse order and settings restore). Credentials fromDESCOPE_PROJECT_ID/DESCOPE_MANAGEMENT_KEY(optionalDESCOPE_BASE_URL,FAMILY_ROLE,SKIP_CLEANUP=1); any failed step, including cleanup, exits non-zero.Note on the separate README commit
docs: format README code blocks with ruffis formatter output only. ruff-pre-commit v0.16.5 formats Python blocks in Markdown, so theruff-formathook rejects any commit touching README.md until the existing blocks are formatted. Kept as its own commit so it can be reviewed (or dropped) independently.Testing
uv run ruff check .,uv run ruff format --check .,uv run mypy descope tests samples,pylic check: passuv run coverage run -m pytest tests --ignore=tests/e2e: 1142 passed, total coverage 98% (new modules 100%)🤖 Generated with Claude Code