-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RF: move from single entrypoint API to entrypoint per command #309
Conversation
This commit starts the process of introducing multiple entrypoints by creating new and separate modules for 'create' and 'add'. It also adds the following changes: - introduces a dependency on datalad-next - introduces the use of dl-next's constraint system for parameter validation and coercion of new commands - allows multiple formats for the metadata argument to the 'add' command, including STDIN, stringified JSON, and a file with JSON lines. - introduces common fixtures via a new module and conftest - updates the tests associated with 'create' and 'add' - updates relevant test data - adds entrypoints for 'create' and 'add' commands The goal is for future commits adding more entrypoints to build on top of the basis established here.
This commit is necessary to allow validation according to the schema of a specific catalog, where previously validation was always done according to the latest schema of the installed package version. All catalog schemas now hava a dedicated location in 'catalog-name'/schema. If a metadata item is to be validated, this location will be inspected in order to build up a schema store that will be validated against. If this location does not exist, the fallback is the default schema store of the package installation. Subsequent changes include: - updating and moving packahe/catalog/tests/schema locations to the constants module - including the new schema location in package data - adding methods to the webcatalog class to locate the relevant schema store and validator - updating create and add commands and their tests accordingly
… to webcatalog instance method
…on from a catalog, including metadata, config, and home page specs
This commit includes several changes that relate to the refactoring of the config functionality. The main changes relate to how/when a config file is provided. Previously, config files were specified during instantiation of the WebCatalog class, and a whole lot of obscure code was necessary to determine how this config applies to the catalog or dataset level. The refactored code receives the config file via the Create() and Add() commands or via the WebCatalog.create() or Node.add_attributes() python methods. Important outcomes of the changed code include: - WebCatalog can be instantiated with location alone (no 'action' necessary anymore, and no config_file) - config is set on WebCatalog or Node instances after/during running their respective create() methods and not during instantiation - WebCatalog class gained an 'add_record()' method to handle what was previously only done in Add() interface/command. - MetaItem instantiation now handles config_file input, in order to pass it to Node.add_attributes() at the appropriate time. Specific other changes include: - splitting Node class into its own module - updating utilities - updating tests to conform to the refactors code
catalog-translate command line entrypoint. Changes include: - using datalad-next constraints via validatedInterface class - introducing the catalog argument, which allows the translation to occur to the specific schema version (if supported by an available translator); if the catalog argument is not supplied, the expected schema version is the latest supported by the package installation. - streamlining the translator matching process by keeping track of previously matched and instantiated translators - moving functionality to get the supported schema version, source name, and source version to the translator base class. Existing and new translators will have to override these functions.
@mslw I think this comment from above is particularly relevant to you, since you also maintain a couple of translators:
|
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #309 +/- ##
==========================================
+ Coverage 82.32% 86.14% +3.81%
==========================================
Files 32 43 +11
Lines 2173 2700 +527
==========================================
+ Hits 1789 2326 +537
+ Misses 384 374 -10
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
1ad9049
to
57bf6b4
Compare
abd029d
to
50ce801
Compare
I am committing this with a massive delay, but the changes seem to follow the refactoring of datalad-catalog in datalad/datalad-catalog#309 and specifically datalad/datalad-catalog@92ed3f7
The main goal of this PR is to close #245. IN the process, the PR evolved a lot and now includes these main changes:
datalad-next
dependency, at first for constraint system but in future for whatever functionality is usefulSome specific outcomes to take note of:
path-to-catalog/schema/*
), where previously validation was always done according to the latest schema of the installed package version (which is now the fallback).tests/fixtures.py
and exposed to all testscatalog-get|set
provides an extensible set of commands for configuring a catalog and reporting its propertiesIssues that are addressed by this PR:
NotImplementedError
or render relevant datalad result fordatalad catalog remove
#128catalog add
command #148WebCatalog
method #183workflow-new
andworkflow-update
commands #195catalog_config
not set correctly in webcatalog constructor #254add
result should/could report ID of added record #316set-super
does not verify validity of arguments #318catalog-translate
#324