dsp-tools 17.0.0.post29__tar.gz → 18.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dsp-tools might be problematic. Click here for more details.
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/PKG-INFO +1 -1
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/pyproject.toml +1 -5
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/cli/args.py +13 -0
- dsp_tools-18.0.0/src/dsp_tools/cli/call_action.py +82 -0
- dsp_tools-18.0.0/src/dsp_tools/cli/call_action_files_only.py +74 -0
- dsp_tools-18.0.0/src/dsp_tools/cli/call_action_with_network.py +203 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/cli/create_parsers.py +50 -11
- dsp_tools-18.0.0/src/dsp_tools/cli/utils.py +87 -0
- dsp_tools-18.0.0/src/dsp_tools/clients/list_client.py +49 -0
- dsp_tools-18.0.0/src/dsp_tools/clients/list_client_live.py +157 -0
- dsp_tools-17.0.0.post29/src/dsp_tools/clients/ontology_client.py → dsp_tools-18.0.0/src/dsp_tools/clients/ontology_clients.py +17 -2
- dsp_tools-17.0.0.post29/src/dsp_tools/clients/ontology_client_live.py → dsp_tools-18.0.0/src/dsp_tools/clients/ontology_create_client_live.py +2 -2
- dsp_tools-18.0.0/src/dsp_tools/clients/ontology_get_client_live.py +65 -0
- dsp_tools-18.0.0/src/dsp_tools/clients/project_client.py +10 -0
- dsp_tools-18.0.0/src/dsp_tools/clients/project_client_live.py +30 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/create/create_on_server/cardinalities.py +14 -8
- dsp_tools-18.0.0/src/dsp_tools/commands/create/create_on_server/lists.py +150 -0
- dsp_tools-18.0.0/src/dsp_tools/commands/create/lists_only.py +45 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/create/models/input_problems.py +13 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/create/models/parsed_project.py +14 -1
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/create/models/rdf_ontology.py +0 -7
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/create/models/server_project_info.py +17 -3
- dsp_tools-18.0.0/src/dsp_tools/commands/create/parsing/parse_lists.py +45 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/create/parsing/parse_project.py +23 -4
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/create/project_create_all.py +17 -13
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/create/project_create_default_permissions.py +8 -6
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/create/project_create_ontologies.py +30 -18
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/legacy_models/listnode.py +0 -30
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/models/api_responses.py +2 -16
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/prepare_data/prepare_data.py +8 -7
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/sparql/value_shacl.py +1 -1
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/error/exceptions.py +8 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/resources/start-stack/docker-compose.yml +23 -23
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/ansi_colors.py +2 -0
- dsp_tools-17.0.0.post29/src/dsp_tools/cli/call_action.py +0 -378
- dsp_tools-17.0.0.post29/src/dsp_tools/commands/project/create/project_create_lists.py +0 -200
- dsp_tools-17.0.0.post29/src/dsp_tools/commands/validate_data/api_clients.py +0 -124
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/docs/index.md +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/cli/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/cli/entry_point.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/clients/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/clients/authentication_client.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/clients/authentication_client_live.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/clients/connection.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/clients/connection_live.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/clients/fuseki_metrics.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/clients/legal_info_client.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/clients/legal_info_client_live.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/clients/metadata_client.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/clients/metadata_client_live.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/create/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/create/communicate_problems.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/create/constants.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/create/create_on_server/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/create/create_on_server/mappers.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/create/models/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/create/models/parsed_ontology.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/create/parsing/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/create/parsing/parse_ontology.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/create/parsing/parsing_utils.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/create/serialisation/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/create/serialisation/ontology.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/CLAUDE.md +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/json_header.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/lists/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/lists/compliance_checks.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/lists/make_lists.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/lists/models/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/lists/models/deserialise.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/lists/models/input_error.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/lists/models/serialise.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/lists/utils.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/models/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/models/input_error.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/models/json_header.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/models/list_node_name.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/models/ontology.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/old_lists.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/project.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/properties.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/resources.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2json/utils.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2xml/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2xml/excel2xml_cli.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2xml/excel2xml_lib.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/excel2xml/propertyelement.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/id2iri.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/ingest_xmlupload/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/ingest_xmlupload/bulk_ingest_client.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/ingest_xmlupload/create_resources/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/ingest_xmlupload/create_resources/apply_ingest_id.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/ingest_xmlupload/create_resources/upload_xml.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/ingest_xmlupload/create_resources/user_information.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/ingest_xmlupload/ingest_files/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/ingest_xmlupload/ingest_files/ingest_files.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/ingest_xmlupload/upload_files/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/ingest_xmlupload/upload_files/filechecker.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/ingest_xmlupload/upload_files/input_error.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/ingest_xmlupload/upload_files/upload_failures.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/ingest_xmlupload/upload_files/upload_files.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/create/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/create/parse_project.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/create/project_validate.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/get/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/get/get.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/get/get_permissions.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/get/get_permissions_legacy.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/legacy_models/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/legacy_models/context.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/legacy_models/group.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/legacy_models/helpers.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/legacy_models/model.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/legacy_models/ontology.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/legacy_models/project.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/legacy_models/propertyclass.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/legacy_models/resourceclass.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/legacy_models/user.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/models/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/models/permissions_client.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/models/permissions_models.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/project/models/project_definition.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/resume_xmlupload/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/resume_xmlupload/resume_xmlupload.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/start_stack.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/CLAUDE.md +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/constants.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/mappers.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/models/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/models/input_problems.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/models/rdf_like_data.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/models/validation.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/prepare_data/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/prepare_data/get_rdf_like_data.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/prepare_data/make_data_graph.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/process_validation_report/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/process_validation_report/get_user_validation_message.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/process_validation_report/query_validation_result.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/process_validation_report/reformat_validation_results.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/shacl_cli_validator.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/sparql/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/sparql/cardinality_shacl.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/sparql/construct_shacl.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/sparql/legal_info_shacl.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/utils.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/validate_data.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/validation/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/validation/check_duplicate_files.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/validation/check_for_unknown_classes.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/validation/get_validation_report.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/validate_data/validation/validate_ontology.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/CLAUDE.md +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/iri_resolver.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/make_rdf_graph/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/make_rdf_graph/constants.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/make_rdf_graph/jsonld_utils.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/make_rdf_graph/make_file_value.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/make_rdf_graph/make_resource_and_values.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/make_rdf_graph/make_values.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/models/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/models/bitstream_info.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/models/formatted_text_value.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/models/ingest.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/models/input_problems.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/models/lookup_models.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/models/permission.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/models/permissions_parsed.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/models/processed/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/models/processed/file_values.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/models/processed/res.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/models/processed/values.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/models/rdf_models.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/models/upload_clients.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/models/upload_state.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/prepare_xml_input/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/prepare_xml_input/ark2iri.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/prepare_xml_input/get_processed_resources.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/prepare_xml_input/iiif_uri_validator.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/prepare_xml_input/list_client.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/prepare_xml_input/prepare_xml_input.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/prepare_xml_input/read_validate_xml_file.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/prepare_xml_input/transform_input_values.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/project_client.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/resource_create_client.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/richtext_id2iri.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/stash/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/stash/analyse_circular_reference_graph.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/stash/create_info_for_graph.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/stash/graph_models.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/stash/stash_circular_references.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/stash/stash_models.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/stash/upload_stashed_resptr_props.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/stash/upload_stashed_xml_texts.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/upload_config.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/write_diagnostic_info.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/commands/xmlupload/xmlupload.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/config/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/config/logger_config.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/config/warnings_config.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/error/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/error/custom_warnings.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/error/problems.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/error/xmllib_errors.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/error/xmllib_warnings.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/error/xmllib_warnings_util.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/error/xsd_validation_error_msg.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/legacy_models/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/legacy_models/datetimestamp.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/legacy_models/langstring.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/legacy_models/projectContext.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/py.typed +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/resources/schema/data.xsd +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/resources/schema/lists-only.json +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/resources/schema/project.json +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/resources/schema/properties-only.json +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/resources/schema/resources-only.json +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/resources/start-stack/docker-compose.override-host.j2 +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/resources/start-stack/docker-compose.override.yml +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/resources/start-stack/dsp-app-config.json +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/resources/start-stack/dsp-app-config.override-host.j2 +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/resources/validate_data/api-shapes-resource-cardinalities.ttl +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/resources/validate_data/api-shapes.ttl +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/resources/validate_data/shacl-cli-image.yml +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/resources/validate_data/validate-ontology.ttl +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/data_formats/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/data_formats/date_util.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/data_formats/iri_util.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/data_formats/shared.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/data_formats/uri_util.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/fuseki_bloating.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/json_parsing.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/rdflib_constants.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/rdflib_utils.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/replace_id_with_iri.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/request_utils.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/xml_parsing/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/xml_parsing/get_lookups.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/xml_parsing/get_parsed_resources.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/xml_parsing/models/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/xml_parsing/models/parsed_resource.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/utils/xml_parsing/parse_clean_validate_xml.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/CLAUDE.md +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/general_functions.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/internal/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/internal/checkers.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/internal/circumvent_circular_imports.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/internal/constants.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/internal/input_converters.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/internal/serialise_file_value.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/internal/serialise_resource.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/internal/serialise_values.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/internal/type_aliases.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/models/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/models/config_options.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/models/date_formats.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/models/dsp_base_resources.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/models/internal/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/models/internal/file_values.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/models/internal/geometry.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/models/internal/migration_metadata.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/models/internal/serialise_permissions.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/models/internal/values.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/models/licenses/__init__.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/models/licenses/other.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/models/licenses/recommended.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/models/permissions.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/models/res.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/models/root.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/value_checkers.py +0 -0
- {dsp_tools-17.0.0.post29 → dsp_tools-18.0.0}/src/dsp_tools/xmllib/value_converters.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: dsp-tools
|
|
3
|
-
Version:
|
|
3
|
+
Version: 18.0.0
|
|
4
4
|
Summary: DSP-TOOLS is a Python package with a command line interface that helps you interact with a DaSCH service platform (DSP) server.
|
|
5
5
|
Author: DaSCH - Swiss National Data and Service Center for the Humanities
|
|
6
6
|
Author-email: DaSCH - Swiss National Data and Service Center for the Humanities <info@dasch.swiss>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[project]
|
|
4
4
|
name = "dsp-tools"
|
|
5
|
-
version = "
|
|
5
|
+
version = "18.0.0"
|
|
6
6
|
description = "DSP-TOOLS is a Python package with a command line interface that helps you interact with a DaSCH service platform (DSP) server."
|
|
7
7
|
authors = [
|
|
8
8
|
{ name = "DaSCH - Swiss National Data and Service Center for the Humanities", email = "info@dasch.swiss" },
|
|
@@ -203,9 +203,5 @@ exclude = [
|
|
|
203
203
|
"src/dsp_tools/error/xmllib_warnings_util.py",
|
|
204
204
|
"src/dsp_tools/commands/excel2xml/",
|
|
205
205
|
"test/",
|
|
206
|
-
# to enable small PRs the following files and directories are to be ignored until `create` is completely refactored
|
|
207
|
-
"src/dsp_tools/commands/create/",
|
|
208
|
-
"src/dsp_tools/clients/ontology_client_live.py",
|
|
209
|
-
"src/dsp_tools/clients/ontology_client.py",
|
|
210
206
|
]
|
|
211
207
|
sort_by_size = true # sort unused classes and functions by size
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
|
+
from dataclasses import field
|
|
4
5
|
from enum import Enum
|
|
5
6
|
from pathlib import Path
|
|
6
7
|
|
|
@@ -32,3 +33,15 @@ class ValidationSeverity(Enum):
|
|
|
32
33
|
ERROR = 3
|
|
33
34
|
WARNING = 2
|
|
34
35
|
INFO = 1
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@dataclass
|
|
39
|
+
class PathDependencies:
|
|
40
|
+
required_files: list[Path] = field(default_factory=list)
|
|
41
|
+
required_directories: list[Path] = field(default_factory=list)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@dataclass
|
|
45
|
+
class NetworkRequirements:
|
|
46
|
+
api_url: str
|
|
47
|
+
always_requires_docker: bool = False
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
|
|
3
|
+
from loguru import logger
|
|
4
|
+
|
|
5
|
+
from dsp_tools.cli.call_action_files_only import call_excel2json
|
|
6
|
+
from dsp_tools.cli.call_action_files_only import call_excel2lists
|
|
7
|
+
from dsp_tools.cli.call_action_files_only import call_excel2properties
|
|
8
|
+
from dsp_tools.cli.call_action_files_only import call_excel2resources
|
|
9
|
+
from dsp_tools.cli.call_action_files_only import call_id2iri
|
|
10
|
+
from dsp_tools.cli.call_action_files_only import call_old_excel2json
|
|
11
|
+
from dsp_tools.cli.call_action_files_only import call_old_excel2lists
|
|
12
|
+
from dsp_tools.cli.call_action_with_network import call_create
|
|
13
|
+
from dsp_tools.cli.call_action_with_network import call_get
|
|
14
|
+
from dsp_tools.cli.call_action_with_network import call_ingest_files
|
|
15
|
+
from dsp_tools.cli.call_action_with_network import call_ingest_xmlupload
|
|
16
|
+
from dsp_tools.cli.call_action_with_network import call_resume_xmlupload
|
|
17
|
+
from dsp_tools.cli.call_action_with_network import call_start_stack
|
|
18
|
+
from dsp_tools.cli.call_action_with_network import call_stop_stack
|
|
19
|
+
from dsp_tools.cli.call_action_with_network import call_upload_files
|
|
20
|
+
from dsp_tools.cli.call_action_with_network import call_validate_data
|
|
21
|
+
from dsp_tools.cli.call_action_with_network import call_xmlupload
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def call_requested_action(args: argparse.Namespace) -> bool: # noqa: PLR0912 (too many branches)
|
|
25
|
+
"""
|
|
26
|
+
Call the appropriate function of DSP-TOOLS.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
args: parsed CLI arguments
|
|
30
|
+
|
|
31
|
+
Raises:
|
|
32
|
+
BaseError: from the called function
|
|
33
|
+
InputError: from the called function
|
|
34
|
+
DockerNotReachableError: from the called function
|
|
35
|
+
LocalDspApiNotReachableError: from the called function
|
|
36
|
+
unexpected errors from the called methods and underlying libraries
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
success status
|
|
40
|
+
"""
|
|
41
|
+
match args.action:
|
|
42
|
+
# commands with Docker / API interactions
|
|
43
|
+
case "start-stack":
|
|
44
|
+
result = call_start_stack(args)
|
|
45
|
+
case "stop-stack":
|
|
46
|
+
result = call_stop_stack()
|
|
47
|
+
case "create":
|
|
48
|
+
result = call_create(args)
|
|
49
|
+
case "get":
|
|
50
|
+
result = call_get(args)
|
|
51
|
+
case "validate-data":
|
|
52
|
+
result = call_validate_data(args)
|
|
53
|
+
case "xmlupload":
|
|
54
|
+
result = call_xmlupload(args)
|
|
55
|
+
case "resume-xmlupload":
|
|
56
|
+
result = call_resume_xmlupload(args)
|
|
57
|
+
case "upload-files":
|
|
58
|
+
result = call_upload_files(args)
|
|
59
|
+
case "ingest-files":
|
|
60
|
+
result = call_ingest_files(args)
|
|
61
|
+
case "ingest-xmlupload":
|
|
62
|
+
result = call_ingest_xmlupload(args)
|
|
63
|
+
# commands that do not require docker
|
|
64
|
+
case "excel2json":
|
|
65
|
+
result = call_excel2json(args)
|
|
66
|
+
case "old-excel2json":
|
|
67
|
+
result = call_old_excel2json(args)
|
|
68
|
+
case "excel2lists":
|
|
69
|
+
result = call_excel2lists(args)
|
|
70
|
+
case "old-excel2lists":
|
|
71
|
+
result = call_old_excel2lists(args)
|
|
72
|
+
case "excel2resources":
|
|
73
|
+
result = call_excel2resources(args)
|
|
74
|
+
case "excel2properties":
|
|
75
|
+
result = call_excel2properties(args)
|
|
76
|
+
case "id2iri":
|
|
77
|
+
result = call_id2iri(args)
|
|
78
|
+
case _:
|
|
79
|
+
print(f"ERROR: Unknown action '{args.action}'")
|
|
80
|
+
logger.error(f"Unknown action '{args.action}'")
|
|
81
|
+
result = False
|
|
82
|
+
return result
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from dsp_tools.cli.args import PathDependencies
|
|
5
|
+
from dsp_tools.cli.utils import check_path_dependencies
|
|
6
|
+
from dsp_tools.commands.excel2json.lists.make_lists import excel2lists
|
|
7
|
+
from dsp_tools.commands.excel2json.old_lists import old_excel2lists
|
|
8
|
+
from dsp_tools.commands.excel2json.project import excel2json
|
|
9
|
+
from dsp_tools.commands.excel2json.project import old_excel2json
|
|
10
|
+
from dsp_tools.commands.excel2json.properties import excel2properties
|
|
11
|
+
from dsp_tools.commands.excel2json.resources import excel2resources
|
|
12
|
+
from dsp_tools.commands.id2iri import id2iri
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def call_id2iri(args: argparse.Namespace) -> bool:
|
|
16
|
+
check_path_dependencies(PathDependencies([Path(args.xmlfile), Path(args.mapping)]))
|
|
17
|
+
return id2iri(
|
|
18
|
+
xml_file=args.xmlfile,
|
|
19
|
+
json_file=args.mapping,
|
|
20
|
+
remove_resource_if_id_in_mapping=args.remove_resources,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def call_excel2properties(args: argparse.Namespace) -> bool:
|
|
25
|
+
check_path_dependencies(PathDependencies([Path(args.excelfile)]))
|
|
26
|
+
_, _, success = excel2properties(
|
|
27
|
+
excelfile=args.excelfile,
|
|
28
|
+
path_to_output_file=args.properties_section,
|
|
29
|
+
)
|
|
30
|
+
return success
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def call_excel2resources(args: argparse.Namespace) -> bool:
|
|
34
|
+
check_path_dependencies(PathDependencies([Path(args.excelfile)]))
|
|
35
|
+
_, _, success = excel2resources(
|
|
36
|
+
excelfile=args.excelfile,
|
|
37
|
+
path_to_output_file=args.resources_section,
|
|
38
|
+
)
|
|
39
|
+
return success
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def call_old_excel2lists(args: argparse.Namespace) -> bool:
|
|
43
|
+
check_path_dependencies(PathDependencies(required_directories=[Path(args.excelfolder)]))
|
|
44
|
+
_, success = old_excel2lists(
|
|
45
|
+
excelfolder=args.excelfolder,
|
|
46
|
+
path_to_output_file=args.lists_section,
|
|
47
|
+
verbose=args.verbose,
|
|
48
|
+
)
|
|
49
|
+
return success
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def call_excel2lists(args: argparse.Namespace) -> bool:
|
|
53
|
+
check_path_dependencies(PathDependencies(required_directories=[Path(args.excelfolder)]))
|
|
54
|
+
_, success = excel2lists(
|
|
55
|
+
excelfolder=args.excelfolder,
|
|
56
|
+
path_to_output_file=args.lists_section,
|
|
57
|
+
)
|
|
58
|
+
return success
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def call_excel2json(args: argparse.Namespace) -> bool:
|
|
62
|
+
check_path_dependencies(PathDependencies(required_directories=[Path(args.excelfolder)]))
|
|
63
|
+
return excel2json(
|
|
64
|
+
data_model_files=args.excelfolder,
|
|
65
|
+
path_to_output_file=args.project_definition,
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def call_old_excel2json(args: argparse.Namespace) -> bool:
|
|
70
|
+
check_path_dependencies(PathDependencies(required_directories=[Path(args.excelfolder)]))
|
|
71
|
+
return old_excel2json(
|
|
72
|
+
data_model_files=args.excelfolder,
|
|
73
|
+
path_to_output_file=args.project_definition,
|
|
74
|
+
)
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from dsp_tools.cli.args import NetworkRequirements
|
|
5
|
+
from dsp_tools.cli.args import PathDependencies
|
|
6
|
+
from dsp_tools.cli.args import ValidationSeverity
|
|
7
|
+
from dsp_tools.cli.utils import check_docker_health
|
|
8
|
+
from dsp_tools.cli.utils import check_input_dependencies
|
|
9
|
+
from dsp_tools.cli.utils import check_network_health
|
|
10
|
+
from dsp_tools.cli.utils import get_creds
|
|
11
|
+
from dsp_tools.commands.create.lists_only import create_lists_only
|
|
12
|
+
from dsp_tools.commands.excel2json.old_lists import validate_lists_section_with_schema
|
|
13
|
+
from dsp_tools.commands.ingest_xmlupload.create_resources.upload_xml import ingest_xmlupload
|
|
14
|
+
from dsp_tools.commands.ingest_xmlupload.ingest_files.ingest_files import ingest_files
|
|
15
|
+
from dsp_tools.commands.ingest_xmlupload.upload_files.upload_files import upload_files
|
|
16
|
+
from dsp_tools.commands.project.create.project_create_all import create_project
|
|
17
|
+
from dsp_tools.commands.project.create.project_validate import validate_project
|
|
18
|
+
from dsp_tools.commands.project.get.get import get_project
|
|
19
|
+
from dsp_tools.commands.resume_xmlupload.resume_xmlupload import resume_xmlupload
|
|
20
|
+
from dsp_tools.commands.start_stack import StackConfiguration
|
|
21
|
+
from dsp_tools.commands.start_stack import StackHandler
|
|
22
|
+
from dsp_tools.commands.validate_data.validate_data import validate_data
|
|
23
|
+
from dsp_tools.commands.xmlupload.upload_config import UploadConfig
|
|
24
|
+
from dsp_tools.commands.xmlupload.xmlupload import xmlupload
|
|
25
|
+
from dsp_tools.error.exceptions import InputError
|
|
26
|
+
from dsp_tools.utils.xml_parsing.parse_clean_validate_xml import parse_and_validate_xml_file
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def call_start_stack(args: argparse.Namespace) -> bool:
|
|
30
|
+
check_docker_health()
|
|
31
|
+
stack_handler = StackHandler(
|
|
32
|
+
StackConfiguration(
|
|
33
|
+
max_file_size=args.max_file_size,
|
|
34
|
+
enforce_docker_system_prune=args.prune,
|
|
35
|
+
suppress_docker_system_prune=args.no_prune,
|
|
36
|
+
latest_dev_version=args.latest,
|
|
37
|
+
upload_test_data=args.with_test_data,
|
|
38
|
+
custom_host=args.custom_host,
|
|
39
|
+
)
|
|
40
|
+
)
|
|
41
|
+
return stack_handler.start_stack()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def call_stop_stack() -> bool:
|
|
45
|
+
check_docker_health()
|
|
46
|
+
stack_handler = StackHandler(StackConfiguration())
|
|
47
|
+
return stack_handler.stop_stack()
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def call_upload_files(args: argparse.Namespace) -> bool:
|
|
51
|
+
xml_path = Path(args.xml_file)
|
|
52
|
+
image_dir = Path(args.imgdir)
|
|
53
|
+
network_requirements = NetworkRequirements(api_url=args.server)
|
|
54
|
+
path_requirements = PathDependencies([xml_path], required_directories=[image_dir])
|
|
55
|
+
check_input_dependencies(path_requirements, network_requirements)
|
|
56
|
+
|
|
57
|
+
return upload_files(
|
|
58
|
+
xml_file=xml_path,
|
|
59
|
+
creds=get_creds(args),
|
|
60
|
+
imgdir=image_dir,
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def call_ingest_files(args: argparse.Namespace) -> bool:
|
|
65
|
+
check_network_health(NetworkRequirements(api_url=args.server))
|
|
66
|
+
return ingest_files(creds=get_creds(args), shortcode=args.shortcode)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def call_ingest_xmlupload(args: argparse.Namespace) -> bool:
|
|
70
|
+
xml_path = Path(args.xml_file)
|
|
71
|
+
required_files = [xml_path]
|
|
72
|
+
id2iri_file = args.id2iri_replacement_with_file
|
|
73
|
+
if id2iri_file:
|
|
74
|
+
required_files.append(Path(id2iri_file))
|
|
75
|
+
network_requirements = NetworkRequirements(args.server, always_requires_docker=True)
|
|
76
|
+
path_deps = PathDependencies(required_files)
|
|
77
|
+
check_input_dependencies(path_deps, network_requirements)
|
|
78
|
+
|
|
79
|
+
interrupt_after = args.interrupt_after if args.interrupt_after > 0 else None
|
|
80
|
+
return ingest_xmlupload(
|
|
81
|
+
xml_file=xml_path,
|
|
82
|
+
creds=get_creds(args),
|
|
83
|
+
interrupt_after=interrupt_after,
|
|
84
|
+
skip_validation=args.skip_validation,
|
|
85
|
+
skip_ontology_validation=args.skip_ontology_validation,
|
|
86
|
+
id2iri_replacement_file=id2iri_file,
|
|
87
|
+
do_not_request_resource_metadata_from_db=args.do_not_request_resource_metadata_from_db,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def call_xmlupload(args: argparse.Namespace) -> bool:
|
|
92
|
+
xml_path = Path(args.xmlfile)
|
|
93
|
+
required_files = [xml_path]
|
|
94
|
+
id2iri_file = args.id2iri_replacement_with_file
|
|
95
|
+
if id2iri_file:
|
|
96
|
+
required_files.append(Path(id2iri_file))
|
|
97
|
+
network_requirements = NetworkRequirements(args.server, always_requires_docker=True)
|
|
98
|
+
path_deps = PathDependencies(required_files, [Path(args.imgdir)])
|
|
99
|
+
check_input_dependencies(path_deps, network_requirements)
|
|
100
|
+
|
|
101
|
+
if args.validate_only:
|
|
102
|
+
success = parse_and_validate_xml_file(xml_path)
|
|
103
|
+
print("The XML file is syntactically correct.")
|
|
104
|
+
return success
|
|
105
|
+
else:
|
|
106
|
+
interrupt_after = args.interrupt_after if args.interrupt_after > 0 else None
|
|
107
|
+
match args.validation_severity:
|
|
108
|
+
case "info":
|
|
109
|
+
severity = ValidationSeverity.INFO
|
|
110
|
+
case "warning":
|
|
111
|
+
severity = ValidationSeverity.WARNING
|
|
112
|
+
case "error":
|
|
113
|
+
severity = ValidationSeverity.ERROR
|
|
114
|
+
case _:
|
|
115
|
+
raise InputError(
|
|
116
|
+
f"The entered validation severity '{args.validation_severity}' "
|
|
117
|
+
f"is not part of the allowed values: info, warning, error."
|
|
118
|
+
)
|
|
119
|
+
return xmlupload(
|
|
120
|
+
input_file=xml_path,
|
|
121
|
+
creds=get_creds(args),
|
|
122
|
+
imgdir=args.imgdir,
|
|
123
|
+
config=UploadConfig(
|
|
124
|
+
interrupt_after=interrupt_after,
|
|
125
|
+
skip_iiif_validation=args.no_iiif_uri_validation,
|
|
126
|
+
skip_validation=args.skip_validation,
|
|
127
|
+
ignore_duplicate_files_warning=args.ignore_duplicate_files_warning,
|
|
128
|
+
validation_severity=severity,
|
|
129
|
+
skip_ontology_validation=args.skip_ontology_validation,
|
|
130
|
+
do_not_request_resource_metadata_from_db=args.do_not_request_resource_metadata_from_db,
|
|
131
|
+
id2iri_replacement_file=id2iri_file,
|
|
132
|
+
),
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def call_validate_data(args: argparse.Namespace) -> bool:
|
|
137
|
+
xml_path = Path(args.xmlfile)
|
|
138
|
+
required_files = [xml_path]
|
|
139
|
+
id2iri_file = args.id2iri_replacement_with_file
|
|
140
|
+
if id2iri_file:
|
|
141
|
+
required_files.append(Path(id2iri_file))
|
|
142
|
+
network_requirements = NetworkRequirements(args.server, always_requires_docker=True)
|
|
143
|
+
path_deps = PathDependencies(required_files)
|
|
144
|
+
check_input_dependencies(path_deps, network_requirements)
|
|
145
|
+
|
|
146
|
+
return validate_data(
|
|
147
|
+
filepath=xml_path,
|
|
148
|
+
creds=get_creds(args),
|
|
149
|
+
save_graphs=args.save_graphs,
|
|
150
|
+
ignore_duplicate_files_warning=args.ignore_duplicate_files_warning,
|
|
151
|
+
skip_ontology_validation=args.skip_ontology_validation,
|
|
152
|
+
id2iri_replacement_file=id2iri_file,
|
|
153
|
+
do_not_request_resource_metadata_from_db=args.do_not_request_resource_metadata_from_db,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def call_resume_xmlupload(args: argparse.Namespace) -> bool:
|
|
158
|
+
# this does not need docker if not on localhost, as does not need to validate
|
|
159
|
+
check_network_health(NetworkRequirements(args.server))
|
|
160
|
+
return resume_xmlupload(
|
|
161
|
+
creds=get_creds(args),
|
|
162
|
+
skip_first_resource=args.skip_first_resource,
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def call_get(args: argparse.Namespace) -> bool:
|
|
167
|
+
network_dependencies = NetworkRequirements(args.server)
|
|
168
|
+
path_dependencies = PathDependencies(required_directories=[Path(args.project_definition).parent])
|
|
169
|
+
check_input_dependencies(path_dependencies, network_dependencies)
|
|
170
|
+
|
|
171
|
+
return get_project(
|
|
172
|
+
project_identifier=args.project,
|
|
173
|
+
outfile_path=args.project_definition,
|
|
174
|
+
creds=get_creds(args),
|
|
175
|
+
verbose=args.verbose,
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def call_create(args: argparse.Namespace) -> bool:
|
|
180
|
+
network_dependencies = NetworkRequirements(args.server)
|
|
181
|
+
path_dependencies = PathDependencies([Path(args.project_definition)])
|
|
182
|
+
check_input_dependencies(path_dependencies, network_dependencies)
|
|
183
|
+
|
|
184
|
+
success = False
|
|
185
|
+
match args.lists_only, args.validate_only:
|
|
186
|
+
case True, True:
|
|
187
|
+
success = validate_lists_section_with_schema(args.project_definition)
|
|
188
|
+
print("'Lists' section of the JSON project file is syntactically correct and passed validation.")
|
|
189
|
+
case True, False:
|
|
190
|
+
success = create_lists_only(
|
|
191
|
+
project_file_as_path_or_parsed=args.project_definition,
|
|
192
|
+
creds=get_creds(args),
|
|
193
|
+
)
|
|
194
|
+
case False, True:
|
|
195
|
+
success = validate_project(args.project_definition)
|
|
196
|
+
print("JSON project file is syntactically correct and passed validation.")
|
|
197
|
+
case False, False:
|
|
198
|
+
success = create_project(
|
|
199
|
+
project_file_as_path_or_parsed=args.project_definition,
|
|
200
|
+
creds=get_creds(args),
|
|
201
|
+
verbose=args.verbose,
|
|
202
|
+
)
|
|
203
|
+
return success
|
|
@@ -96,7 +96,7 @@ def _add_start_stack(subparsers: _SubParsersAction[ArgumentParser]) -> None:
|
|
|
96
96
|
max_file_size_text = "max. multimedia file size allowed for ingest, in MB (default: 2000, max: 100'000)"
|
|
97
97
|
no_prune_text = "don't execute 'docker system prune' (and don't ask)"
|
|
98
98
|
with_test_data_text = "initialise the database with built-in test data"
|
|
99
|
-
custom_host = "set host to
|
|
99
|
+
custom_host = "set a host to an IP or a domain to run the instance on a server"
|
|
100
100
|
subparser = subparsers.add_parser(name="start-stack", help="Run a local instance of DSP-API and DSP-APP")
|
|
101
101
|
subparser.set_defaults(action="start-stack")
|
|
102
102
|
subparser.add_argument("--max_file_size", type=int, help=max_file_size_text)
|
|
@@ -237,10 +237,20 @@ def _add_ingest_xmlupload(
|
|
|
237
237
|
subparser.add_argument("--interrupt-after", type=int, default=-1, help="interrupt after this number of resources")
|
|
238
238
|
subparser.add_argument("xml_file", help="path to XML file containing the data")
|
|
239
239
|
subparser.add_argument("--skip-validation", action="store_true", help="Skip the SHACL schema validation")
|
|
240
|
-
subparser.add_argument(
|
|
240
|
+
subparser.add_argument(
|
|
241
|
+
"--skip-ontology-validation",
|
|
242
|
+
action="store_true",
|
|
243
|
+
help=(
|
|
244
|
+
"don't validate the ontology itself, only the data. "
|
|
245
|
+
"This is intended for projects that are already on the production server"
|
|
246
|
+
),
|
|
247
|
+
)
|
|
241
248
|
subparser.add_argument(
|
|
242
249
|
"--id2iri-replacement-with-file",
|
|
243
|
-
help=
|
|
250
|
+
help=(
|
|
251
|
+
"replaces internal IDs of an XML file (links and stand-off links inside richtext) "
|
|
252
|
+
"by IRIs provided in this mapping file"
|
|
253
|
+
),
|
|
244
254
|
)
|
|
245
255
|
subparser.add_argument(
|
|
246
256
|
"--do-not-request-resource-metadata-from-db",
|
|
@@ -268,13 +278,24 @@ def _add_xmlupload(
|
|
|
268
278
|
"-i", "--imgdir", default=".", help="folder from where the paths in the <bitstream> tags are evaluated"
|
|
269
279
|
)
|
|
270
280
|
subparser.add_argument(
|
|
271
|
-
"-V", "--validate-only", action="store_true", help="
|
|
281
|
+
"-V", "--validate-only", action="store_true", help="run the XML Schema validation without uploading the XML"
|
|
272
282
|
)
|
|
273
283
|
subparser.add_argument("--skip-validation", action="store_true", help="Skip the SHACL schema validation")
|
|
274
|
-
subparser.add_argument(
|
|
284
|
+
subparser.add_argument(
|
|
285
|
+
"--skip-ontology-validation",
|
|
286
|
+
action="store_true",
|
|
287
|
+
help=(
|
|
288
|
+
"don't validate the ontology itself, only the data. "
|
|
289
|
+
"This is intended for projects that are already on the production server"
|
|
290
|
+
),
|
|
291
|
+
)
|
|
275
292
|
subparser.add_argument("--interrupt-after", type=int, default=-1, help="interrupt after this number of resources")
|
|
276
293
|
subparser.add_argument("xmlfile", help="path to the XML file containing the data")
|
|
277
|
-
subparser.add_argument(
|
|
294
|
+
subparser.add_argument(
|
|
295
|
+
"--no-iiif-uri-validation",
|
|
296
|
+
action="store_true",
|
|
297
|
+
help="don't check if the IIIF links are valid URLs that can be reached online",
|
|
298
|
+
)
|
|
278
299
|
subparser.add_argument(
|
|
279
300
|
"--ignore-duplicate-files-warning",
|
|
280
301
|
action="store_true",
|
|
@@ -283,7 +304,10 @@ def _add_xmlupload(
|
|
|
283
304
|
subparser.add_argument(
|
|
284
305
|
"--validation-severity",
|
|
285
306
|
choices=["error", "warning", "info"],
|
|
286
|
-
help=
|
|
307
|
+
help=(
|
|
308
|
+
"Which severity level of validation message should be printed out. "
|
|
309
|
+
"Each level of severity includes the higher levels."
|
|
310
|
+
),
|
|
287
311
|
default="info",
|
|
288
312
|
)
|
|
289
313
|
subparser.add_argument(
|
|
@@ -295,7 +319,10 @@ def _add_xmlupload(
|
|
|
295
319
|
)
|
|
296
320
|
subparser.add_argument(
|
|
297
321
|
"--id2iri-replacement-with-file",
|
|
298
|
-
help=
|
|
322
|
+
help=(
|
|
323
|
+
"replaces internal IDs of an XML file (links and stand-off links inside richtext) "
|
|
324
|
+
"by IRIs provided in this mapping file"
|
|
325
|
+
),
|
|
299
326
|
)
|
|
300
327
|
|
|
301
328
|
|
|
@@ -315,13 +342,23 @@ def _add_validate_data(
|
|
|
315
342
|
action="store_true",
|
|
316
343
|
help="don't check if multimedia files are referenced more than once",
|
|
317
344
|
)
|
|
318
|
-
subparser.add_argument(
|
|
345
|
+
subparser.add_argument(
|
|
346
|
+
"--skip-ontology-validation",
|
|
347
|
+
action="store_true",
|
|
348
|
+
help=(
|
|
349
|
+
"don't validate the ontology itself, only the data. "
|
|
350
|
+
"This is intended for projects that are already on the production server"
|
|
351
|
+
),
|
|
352
|
+
)
|
|
319
353
|
subparser.add_argument(
|
|
320
354
|
"-s", "--server", default=default_dsp_api_url, help="URL of the DSP server where DSP-TOOLS sends the data to"
|
|
321
355
|
)
|
|
322
356
|
subparser.add_argument(
|
|
323
357
|
"--id2iri-replacement-with-file",
|
|
324
|
-
help=
|
|
358
|
+
help=(
|
|
359
|
+
"replaces internal IDs of an XML file (links and stand-off links inside richtext) "
|
|
360
|
+
"by IRIs provided in this mapping file"
|
|
361
|
+
),
|
|
325
362
|
)
|
|
326
363
|
subparser.add_argument(
|
|
327
364
|
"--do-not-request-resource-metadata-from-db",
|
|
@@ -331,7 +368,9 @@ def _add_validate_data(
|
|
|
331
368
|
),
|
|
332
369
|
)
|
|
333
370
|
subparser.add_argument(
|
|
334
|
-
"--save-graphs",
|
|
371
|
+
"--save-graphs",
|
|
372
|
+
action="store_true",
|
|
373
|
+
help="Save the data, onto and shacl graph as ttl files. This is primarily intended for development use.",
|
|
335
374
|
)
|
|
336
375
|
|
|
337
376
|
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import subprocess
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import requests
|
|
6
|
+
from loguru import logger
|
|
7
|
+
|
|
8
|
+
from dsp_tools.cli.args import NetworkRequirements
|
|
9
|
+
from dsp_tools.cli.args import PathDependencies
|
|
10
|
+
from dsp_tools.cli.args import ServerCredentials
|
|
11
|
+
from dsp_tools.error.exceptions import DockerNotReachableError
|
|
12
|
+
from dsp_tools.error.exceptions import DspApiNotReachableError
|
|
13
|
+
from dsp_tools.error.exceptions import UserDirectoryNotFoundError
|
|
14
|
+
from dsp_tools.error.exceptions import UserFilepathNotFoundError
|
|
15
|
+
|
|
16
|
+
LOCALHOST_API = "http://0.0.0.0:3333"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def get_creds(args: argparse.Namespace) -> ServerCredentials:
|
|
20
|
+
return ServerCredentials(
|
|
21
|
+
server=args.server,
|
|
22
|
+
user=args.user,
|
|
23
|
+
password=args.password,
|
|
24
|
+
dsp_ingest_url=args.dsp_ingest_url,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def check_input_dependencies(
|
|
29
|
+
paths: PathDependencies | None = None, network_dependencies: NetworkRequirements | None = None
|
|
30
|
+
) -> None:
|
|
31
|
+
if paths:
|
|
32
|
+
check_path_dependencies(paths)
|
|
33
|
+
if network_dependencies:
|
|
34
|
+
check_network_health(network_dependencies)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def check_path_dependencies(paths: PathDependencies) -> None:
|
|
38
|
+
for f_path in paths.required_files:
|
|
39
|
+
_check_filepath_exists(f_path)
|
|
40
|
+
for dir_path in paths.required_directories:
|
|
41
|
+
_check_directory_exists(dir_path)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _check_filepath_exists(file_path: Path) -> None:
|
|
45
|
+
if not file_path.exists():
|
|
46
|
+
raise UserFilepathNotFoundError(file_path)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _check_directory_exists(dir_path: Path) -> None:
|
|
50
|
+
if not dir_path.is_dir():
|
|
51
|
+
raise UserDirectoryNotFoundError(dir_path)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def check_network_health(network_requirements: NetworkRequirements) -> None:
|
|
55
|
+
if network_requirements.api_url == LOCALHOST_API or network_requirements.always_requires_docker:
|
|
56
|
+
check_docker_health()
|
|
57
|
+
_check_api_health(network_requirements.api_url)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def check_docker_health() -> None:
|
|
61
|
+
if subprocess.run("docker stats --no-stream".split(), check=False, capture_output=True).returncode != 0:
|
|
62
|
+
raise DockerNotReachableError()
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _check_api_health(api_url: str) -> None:
|
|
66
|
+
health_url = f"{api_url}/health"
|
|
67
|
+
msg = (
|
|
68
|
+
"The DSP-API could not be reached. Please check if your stack is healthy "
|
|
69
|
+
"or start a stack with 'dsp-tools start-stack' if none is running."
|
|
70
|
+
)
|
|
71
|
+
try:
|
|
72
|
+
response = requests.get(health_url, timeout=2)
|
|
73
|
+
if not response.ok:
|
|
74
|
+
if api_url != LOCALHOST_API:
|
|
75
|
+
msg = (
|
|
76
|
+
f"The DSP-API could not be reached (returned status {response.status_code}). "
|
|
77
|
+
f"Please contact the DaSCH engineering team for help."
|
|
78
|
+
)
|
|
79
|
+
logger.error(msg)
|
|
80
|
+
raise DspApiNotReachableError(msg)
|
|
81
|
+
logger.debug(f"DSP API health check passed: {health_url}")
|
|
82
|
+
except requests.exceptions.RequestException as e:
|
|
83
|
+
logger.error(e)
|
|
84
|
+
if api_url != LOCALHOST_API:
|
|
85
|
+
msg = "The DSP-API responded with a request exception. Please contact the DaSCH engineering team for help."
|
|
86
|
+
logger.error(msg)
|
|
87
|
+
raise DspApiNotReachableError(msg) from None
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Any
|
|
5
|
+
from typing import Protocol
|
|
6
|
+
|
|
7
|
+
from dsp_tools.clients.authentication_client import AuthenticationClient
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@dataclass
|
|
11
|
+
class OneList:
|
|
12
|
+
list_iri: str
|
|
13
|
+
list_name: str
|
|
14
|
+
nodes: list[OneNode]
|
|
15
|
+
|
|
16
|
+
def hlist(self) -> str:
|
|
17
|
+
return f'"hlist=<{self.list_iri}>"'
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@dataclass
|
|
21
|
+
class OneNode:
|
|
22
|
+
name: str
|
|
23
|
+
iri: str
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dataclass
|
|
27
|
+
class ListGetClient(Protocol):
|
|
28
|
+
"""Client to request and reformat the lists of a project."""
|
|
29
|
+
|
|
30
|
+
api_url: str
|
|
31
|
+
shortcode: str
|
|
32
|
+
|
|
33
|
+
def get_all_lists_and_nodes(self) -> list[OneList]:
|
|
34
|
+
"""Get all lists and its nodes from a project."""
|
|
35
|
+
|
|
36
|
+
def get_all_list_iris_and_names(self) -> dict[str, str]:
|
|
37
|
+
"""Get all list names and IRIs"""
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass
|
|
41
|
+
class ListCreateClient(Protocol):
|
|
42
|
+
api_url: str
|
|
43
|
+
auth: AuthenticationClient
|
|
44
|
+
|
|
45
|
+
def create_new_list(self, list_info: dict[str, Any]) -> str | None:
|
|
46
|
+
"""Create a new list."""
|
|
47
|
+
|
|
48
|
+
def add_list_node(self, node_info: dict[str, Any], parent_iri: str) -> str | None:
|
|
49
|
+
"""Add a list node to an existing list."""
|