Repository navigation
feat!: add project support to every project-scoped command - #23
Draft
jiatolentino wants to merge 9 commits into
Draft
jiatolentino wants to merge 9 commits into
jiatolentino wants to merge 9 commits into
Conversation
jiatolentino
force-pushed
the
DM-4395-project-support
branch
from
October 29, 2026 05:28
921579e to
d359e73
Compare
andrewchester-dm
approved these changes
Oct 29, 2026
…ojects Drop before merging: switch to the released datamasque-python with project support.
…pace List commands show each resource's project and take --project to list one project's resources. Create, upload and validate commands put the resource in the --project project, else the instance's only project. Get, update and delete commands find a name in any project and ask for --project when the name exists in more than one. BREAKING CHANGE: --namespace is removed from `dm libraries` and `dm discover libraries`; use --project. The CLI needs a DataMasque version with projects.
`dm rulesets export-bundle` and `import-bundle` call the v2 endpoints, so a bundle files each item under its project and an import puts it back there. `import-bundle --fallback-project` names the project, by name or id, for the items a bundle files under no project, and the command warns when the server marks the bundle as the older format. BREAKING CHANGE: the bundle commands need a server with the v2 export and import endpoints.
…oject first Without --project, a connection name that several projects share now resolves to the one in the reference's project instead of aborting as ambiguous. A connection in another project is still found. Also drop the repeated listing request before a create.
`dm projects` lists, shows, creates, renames and deletes projects. `list --include-deleted` adds deleted projects. Delete takes `--to`, the project that receives the deleted project's resources, and `--check` lists what would stop the delete without deleting. `dm projects update` needs a datamasque-python release with `update_project`.
`dm resources move --to <project>` moves resources selected by `--project`, `--type`, `--search` or exact names. Resources that clash with the destination stay where they are; the command lists each one and exits with the `conflict` code. `--check` previews the move.
… a deleted project - dm resources move lists a conflict detail once when several resources clash the same way, and says no resources moved when none did. - dm projects get finds a deleted project by its id, as projects list --include-deleted shows it, and its output says whether the project is deleted. A name still resolves among the active projects only.
jiatolentino
force-pushed
the
DM-4395-project-support
branch
from
November 3, 2026 07:35
070bef2 to
c903061
Compare
andrewchester-dm
requested changes
Nov 3, 2026
…exact test results - dm resources move aborts with not-found, naming each name that matches none of the resources the other filters select, instead of moving the rest and exiting 0. - dm rulesets export-bundle and import-bundle call the client's export_bundle and import_bundle. export-bundle gains --include-seed-files, so its seed files are bundled only on request. - import-bundle names the project that took the items the bundle files under no project, and leaves the older-bundle warning to the client, which already logs it. - Rename project_names to get_project_names_by_reference and in_project to filter_by_project, and make the test helper _with_deleted_projects private. - Tests compare the full JSON or message where the exact result is known.
andrewchester-dm
requested changes
Nov 4, 2026
|
|
||
| from datamasque_cli.errors import ErrorCode, abort | ||
|
|
||
| PROJECT_OPTION_HELP = "Project name or id" |
Contributor
There was a problem hiding this comment.
PROJECT_OPTION_HELP defined here; the text "Project name or id" is repeated inline in --project help strings (e.g. connections.py, rulesets.py, files.py) could you build them from this?
Collaborator
Author
There was a problem hiding this comment.
Done, every --project help now builds from PROJECT_OPTION_HELP, the repeated "two projects share a name" ones through get_same_name_project_help.
The commands that find a resource by a name that two projects can share take their --project help from get_same_name_project_help, and the seed list and bundle import help start from the constant too. The help text is unchanged.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dmworks with DataMasque projects. Every project-scoped command takes--project, list commands show each resource's project, the ruleset bundle commands export and import through the v2 endpoints, which file each item under its project, and newdm projectsanddm resources movecommands manage projects and move resources between them.Note
Draft until a released
datamasque-pythonhas projects. See Dependency.Why
DataMasque v3.26.21.0 puts every connection, ruleset, library, discovery config, seed, file and table reference in a project, and libraries use projects in place of namespaces. Without
--projectthe CLI cannot choose where a resource goes or which of two same-named resources it means.What changed
--project(a project name in any case, or its numeric ID) on connections, rulesets, libraries, discovery configs, discovery config libraries, seeds, files, table references, runs and discovery runs.--projectlists one project's resources (dm seeds listalso keeps the built-in seeds).--projectproject, else the instance's only project. With several projects and no--projectthey fail and ask for one.--projectwhen it exists in more than one.dm table-references createandupdatelook up--connectionin the reference's own project first, then in every project.--namespaceis removed fromdm librariesanddm discover libraries; use--project.dm rulesets export-bundleandimport-bundlego through the client'sexport_bundleandimport_bundle, which use the v2 endpoints.export-bundle --include-seed-filesalso bundles the custom seed files the rulesets and libraries use.import-bundle --fallback-projectnames the project for items a bundle files under no project (omitted: the server's default), and the CLI says which project took them. The client warns about an older-format bundle.dm projects:list(--include-deletedadds deleted projects),get,create,update(rename or change the description) anddelete.deletetakes--to, the project that receives the deleted project's resources. When a resource cannot move, the server deletes nothing and the CLI lists each conflict and exits with theconflictcode.--checklists the conflicts without deleting.dm resources move --to <project>moves resources selected by--project,--type,--searchor exact names, with their files and runs.not_foundcode and lists each such name, so nothing moves.conflictcode.--checklists the selection and its conflicts without moving anything.src/datamasque_cli/projects.py: the shared--projectresolution and output helpers.--project,dm projectsanddm resources move.Breaking:
--namespaceis gone, and the CLI needs a DataMasque version with projects. The--projectand bundle commits carry aBREAKING CHANGE:footer.Testing
make check: ruff, format, mypy and deptry clean; 486 unit tests pass. install-smoke fails as described under Dependency.export-bundlewrites a v2 bundle with each item under its project, and re-importing it skips each item by ID;export-bundle --include-seed-filesadds each seed file under its project, and without it the bundle has none;--fallback-projectlands in that project and names it, without it lands in the server's default project, and an unknown project exits 3 before uploading;dm resources movewith a mistyped name, or a name--typeleaves out, exits 3 naming it and moves nothing.dm projectsanddm resources moveagainst a development build with project rename, on a new instance: create, a name clash, get, rename, description change,list --include-deleted, delete with and without a conflict,--check, declining the prompt, moving one ruleset, and moving a project with one conflict (the rest moved, exit codeconflict).--projectand expect a single-project instance; they are still to run on one.Dependency
datamasque-pythonwith projects. The first commit (build: install datamasque-python from TestPyPI until a release has projects) pins>=1.7.0.dev11from TestPyPI and is dropped before merging, in favour of the released version.datamasque-pythonis 1.5.0. Lint, mypy and pytest resolve the TestPyPI build fromuv.lock.