development-framework-cli 1.8.0__tar.gz → 1.8.1__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.
Files changed (123) hide show
  1. development_framework_cli-1.8.1/.release-please-manifest.json +3 -0
  2. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/CHANGELOG.md +8 -0
  3. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/PKG-INFO +2 -2
  4. development_framework_cli-1.8.1/dm_cli/__init__.py +1 -0
  5. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/cli.py +3 -3
  6. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/command_group/entities.py +1 -1
  7. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/import_entity.py +4 -6
  8. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/import_package.py +10 -10
  9. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/package_tree_from_zip.py +9 -8
  10. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/utils/reference.py +5 -3
  11. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/utils/utils.py +7 -5
  12. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/unit/test_replace_references.py +2 -2
  13. development_framework_cli-1.8.0/.release-please-manifest.json +0 -3
  14. development_framework_cli-1.8.0/dm_cli/__init__.py +0 -1
  15. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/.github/CODEOWNERS +0 -0
  16. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/.github/ISSUE_TEMPLATE/bug-report.md +0 -0
  17. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/.github/ISSUE_TEMPLATE/code-maintenance.md +0 -0
  18. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/.github/ISSUE_TEMPLATE/feature-request.md +0 -0
  19. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/.github/dependabot.yml +0 -0
  20. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/.github/pull_request_template.md +0 -0
  21. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/.github/workflows/create-release-pr.yaml +0 -0
  22. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/.github/workflows/on-main-push.yaml +0 -0
  23. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/.github/workflows/on-push.yaml +0 -0
  24. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/.github/workflows/publish.yaml +0 -0
  25. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/.github/workflows/stale.yml +0 -0
  26. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/.github/workflows/tests.yaml +0 -0
  27. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/.gitignore +0 -0
  28. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/.pre-commit-config.yaml +0 -0
  29. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/LICENSE +0 -0
  30. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/README.md +0 -0
  31. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/SECURITY.md +0 -0
  32. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/command_group/__init__.py +0 -0
  33. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/command_group/data_source.py +0 -0
  34. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss.py +0 -0
  35. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/__init__.py +0 -0
  36. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api/__init__.py +0 -0
  37. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api/access_control_api.py +0 -0
  38. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api/attribute_api.py +0 -0
  39. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api/blob_api.py +0 -0
  40. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api/blueprint_api.py +0 -0
  41. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api/datasource_api.py +0 -0
  42. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api/default_api.py +0 -0
  43. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api/document_api.py +0 -0
  44. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api/entity_api.py +0 -0
  45. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api/export_api.py +0 -0
  46. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api/file_api.py +0 -0
  47. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api/health_check_api.py +0 -0
  48. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api/lookup_table_api.py +0 -0
  49. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api/meta_api.py +0 -0
  50. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api/personal_access_token_api.py +0 -0
  51. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api/search_api.py +0 -0
  52. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api/whoami_api.py +0 -0
  53. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api_client.py +0 -0
  54. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/api_response.py +0 -0
  55. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/configuration.py +0 -0
  56. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/exceptions.py +0 -0
  57. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/__init__.py +0 -0
  58. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/access_control_list.py +0 -0
  59. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/access_level.py +0 -0
  60. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/data_source_information.py +0 -0
  61. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/data_source_request.py +0 -0
  62. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/dependency.py +0 -0
  63. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/entity.py +0 -0
  64. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/error_response.py +0 -0
  65. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/export_meta_response.py +0 -0
  66. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/get_attribute_response.py +0 -0
  67. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/get_blueprint_response.py +0 -0
  68. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/lookup.py +0 -0
  69. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/pat_data.py +0 -0
  70. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/recipe.py +0 -0
  71. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/recipe_attribute.py +0 -0
  72. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/repository.py +0 -0
  73. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/storage_attribute.py +0 -0
  74. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/storage_data_types.py +0 -0
  75. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/models/storage_recipe.py +0 -0
  76. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/py.typed +0 -0
  77. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/dmss_api/rest.py +0 -0
  78. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/domain.py +0 -0
  79. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/enums.py +0 -0
  80. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/state.py +0 -0
  81. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/utils/__init__.py +0 -0
  82. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/utils/file_structure.py +0 -0
  83. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/utils/resolve_local_ids.py +0 -0
  84. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/dm_cli/utils/zip.py +0 -0
  85. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/generate-dmss-api.sh +0 -0
  86. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/pyproject.toml +0 -0
  87. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/release-please-config.json +0 -0
  88. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/integration/docker-compose.yaml +0 -0
  89. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/more_documents/bmw.json +0 -0
  90. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/more_documents/engines/engineA.json +0 -0
  91. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/more_documents/engines/engineB.json +0 -0
  92. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/global/globalEntity.json +0 -0
  93. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/global/globalImage.jpg +0 -0
  94. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/instances/data/simulation.json +0 -0
  95. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/instances/demoApplication.json +0 -0
  96. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/instances/externalFile.json +0 -0
  97. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/instances/nameList +0 -0
  98. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/instances/package.json +0 -0
  99. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/instances/simulation.json +0 -0
  100. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/models/CarPackage/Car.json +0 -0
  101. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/models/CarPackage/EnginePackage/Engine.json +0 -0
  102. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/models/CarPackage/EnginePackage/package.json +0 -0
  103. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/models/CarPackage/Wheel.json +0 -0
  104. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/models/CarPackage/package.json +0 -0
  105. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/models/DemoApplication.json +0 -0
  106. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/models/ExtendsRelative.json +0 -0
  107. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/models/ExternalFile.json +0 -0
  108. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/models/more_recipe_links/wheel.json +0 -0
  109. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/models/package.json +0 -0
  110. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/models/recipe_links/Engine.json +0 -0
  111. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/models/recipe_links/car.json +0 -0
  112. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/models/recipe_links/simulation.recipe.json +0 -0
  113. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/models/storage_uncontained/Result.blueprint.json +0 -0
  114. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data/DemoApplicationDataSource/models/storage_uncontained/Simulation.blueprint.json +0 -0
  115. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_app_dir_struct/data_sources/DemoApplicationDataSource.json +0 -0
  116. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/test_data/test_pdf.pdf +0 -0
  117. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/unit/resolve_local_ids_test_data/carRentalCompany.final.json +0 -0
  118. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/unit/resolve_local_ids_test_data/carRentalCompany.json +0 -0
  119. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/unit/test_dependencies_of.py +0 -0
  120. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/unit/test_import_package.py +0 -0
  121. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/unit/test_json_api_client.py +0 -0
  122. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/unit/test_resolve_local_ids.py +0 -0
  123. {development_framework_cli-1.8.0 → development_framework_cli-1.8.1}/tests/unit/test_utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "1.8.1"
3
+ }
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.8.1](https://github.com/equinor/dm-cli/compare/v1.8.0...v1.8.1) (2026-11-09)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * handle DMSS addresses and zip entry names as POSIX paths on Windows ([075b785](https://github.com/equinor/dm-cli/commit/075b785d76d3bae4fb5243793d69ec0fa98c06ac))
9
+ * handle DMSS addresses and zip entry names as POSIX paths on Windows ([b6f652b](https://github.com/equinor/dm-cli/commit/b6f652b06a034509c9416a3b247370bd66b99733))
10
+
3
11
  ## [1.8.0](https://github.com/equinor/dm-cli/compare/v1.7.3...v1.8.0) (2026-08-06)
4
12
 
5
13
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: development-framework-cli
3
- Version: 1.8.0
3
+ Version: 1.8.1
4
4
  Summary: CLI tool for working with Data Modelling Storage Service
5
5
  Project-URL: Homepage, https://github.com/equinor/dm-cli
6
6
  Project-URL: Repository, https://github.com/equinor/dm-cli
@@ -0,0 +1 @@
1
+ VERSION = "1.8.1" # x-release-please-version
@@ -87,7 +87,7 @@ def import_plugin_blueprints(
87
87
  def create_lookup(
88
88
  name: Annotated[str, typer.Argument(help="Name of the lookup (application context) to create.")],
89
89
  paths: Annotated[
90
- List[Path],
90
+ List[str],
91
91
  typer.Argument(
92
92
  help="one or more remote location for recursively looking for RecipeLinks. "
93
93
  "A remote location is a path in DMSS on the format <dataSource>/<rootPackage>/<subPacakge>/..."
@@ -97,8 +97,8 @@ def create_lookup(
97
97
  """
98
98
  Create a named Ui-/StorageRecipe-lookup-table from all RecipeLinks in a package existing in DMSS (requires admin privileges).
99
99
  """
100
- # TODO change type of paths argument to be list of str to avoid this path as strings conversion below
101
- paths_as_strings = [str(path) for path in paths]
100
+ # DMSS addresses, not local paths: a Path would turn '/' into '\' on Windows.
101
+ paths_as_strings = [path.rstrip("/") for path in paths]
102
102
  print(f"Creating lookup table from paths: {paths_as_strings}")
103
103
  dmss_exception_wrapper(dmss_api.create_lookup, recipe_package=paths_as_strings, application=name)
104
104
 
@@ -42,7 +42,7 @@ def import_entity(
42
42
  source_path = Path(source)
43
43
  destination = destination.rstrip("/\\")
44
44
  # Not replacing a package, but appending to. Can therefore not use "fast mode"
45
- fast = destination_is_root(Path(destination))
45
+ fast = destination_is_root(destination)
46
46
 
47
47
  def inner_import():
48
48
  if source_path.is_dir():
@@ -59,7 +59,7 @@ def import_document(source_path: Path, destination: str, document: dict):
59
59
 
60
60
 
61
61
  def import_single_entity(source_path: Path, destination: str, validate: bool = False):
62
- ensure_package_structure(Path(destination))
62
+ ensure_package_structure(destination)
63
63
  print(f"Importing ENTITY '{source_path.name}' --> '{destination}'")
64
64
 
65
65
  try: # Load the JSON document
@@ -96,8 +96,6 @@ def import_folder_entity(
96
96
  raw_package_import: bool = False,
97
97
  resolve_local_ids: bool = False,
98
98
  ) -> dict:
99
- destination_path = Path(destination)
100
-
101
99
  # Check if target already exists on remote. Then delete or raise exception
102
100
  target = f"{destination}/{source_path.name}"
103
101
  exists = dmss_api.document_check(target)
@@ -108,9 +106,9 @@ def import_folder_entity(
108
106
  dmss_api.document_remove(target)
109
107
 
110
108
  dependencies = {}
111
- is_root = destination_is_root(destination_path)
109
+ is_root = destination_is_root(destination)
112
110
  if not is_root:
113
- ensure_package_structure(destination_path)
111
+ ensure_package_structure(destination)
114
112
  dependencies = dependencies_of(dmss_api.export_meta(destination))
115
113
 
116
114
  memory_file = io.BytesIO()
@@ -172,7 +170,7 @@ def import_folders_as_one_package(source_path: Path, destination: str, package_n
172
170
  console.print(f"'{target}' already exists. Replacing it...", style="dark_orange")
173
171
  dmss_api.document_remove(target)
174
172
 
175
- ensure_package_structure(Path(destination))
173
+ ensure_package_structure(destination)
176
174
  dependencies = dependencies_of(dmss_api.export_meta(destination))
177
175
 
178
176
  entries = sorted(source_path.iterdir())
@@ -3,7 +3,7 @@ import json
3
3
  import os
4
4
  from concurrent.futures import ThreadPoolExecutor, as_completed
5
5
  from json import JSONDecodeError
6
- from pathlib import Path
6
+ from pathlib import Path, PurePosixPath
7
7
  from typing import Callable, Dict, List, Tuple
8
8
  from uuid import uuid4
9
9
 
@@ -99,7 +99,7 @@ def _upload_documents(description: str, data_source: str, documents: List[dict])
99
99
  run_with_progress(description, documents, lambda document: dmss_api.document_add_simple(data_source, document))
100
100
 
101
101
 
102
- def add_object_to_package(path: Path, package: Package, object: io.BytesIO) -> None:
102
+ def add_object_to_package(path: PurePosixPath, package: Package, object: io.BytesIO) -> None:
103
103
  if len(path.parts) == 1: # End of path means the actual document
104
104
  file = File(
105
105
  uid=str(uuid4()), # This UID will be the data source ID for this file
@@ -115,11 +115,11 @@ def add_object_to_package(path: Path, package: Package, object: io.BytesIO) -> N
115
115
  sub_folder = Package(name=path.parts[0], parent=package)
116
116
  package.content.append(sub_folder)
117
117
 
118
- new_path = str(path).split("/", 1)[1] # Remove first element in path before stepping down
119
- return add_object_to_package(Path(new_path), sub_folder, object)
118
+ new_path = PurePosixPath(*path.parts[1:]) # Remove first element in path before stepping down
119
+ return add_object_to_package(new_path, sub_folder, object)
120
120
 
121
121
 
122
- def add_file_to_package(path: Path, package: Package, document: dict) -> None:
122
+ def add_file_to_package(path: PurePosixPath, package: Package, document: dict) -> None:
123
123
  if len(path.parts) == 1: # End of path means the actual document
124
124
  if path.name.endswith("package.json"):
125
125
  # if document is a package.json file, add meta info to package instead of adding it to content list.
@@ -134,11 +134,11 @@ def add_file_to_package(path: Path, package: Package, document: dict) -> None:
134
134
  sub_folder = Package(name=path.parts[0], parent=package)
135
135
  package.content.append(sub_folder)
136
136
 
137
- new_path = str(path).split("/", 1)[1] # Remove first element in path before stepping down
138
- return add_file_to_package(Path(new_path), sub_folder, document)
137
+ new_path = PurePosixPath(*path.parts[1:]) # Remove first element in path before stepping down
138
+ return add_file_to_package(new_path, sub_folder, document)
139
139
 
140
140
 
141
- def add_package_to_package(path: Path, package: Package) -> None:
141
+ def add_package_to_package(path: PurePosixPath, package: Package) -> None:
142
142
  if len(path.parts) == 1:
143
143
  package.content.append(Package(name=path.parts[0], parent=package))
144
144
  return
@@ -148,8 +148,8 @@ def add_package_to_package(path: Path, package: Package) -> None:
148
148
  sub_folder = Package(name=path.parts[0], parent=package)
149
149
  package.content.append(sub_folder)
150
150
 
151
- new_path = str(path).split("/", 1)[1] # Remove first element in path before stepping down
152
- return add_package_to_package(Path(new_path), sub_folder)
151
+ new_path = PurePosixPath(*path.parts[1:]) # Remove first element in path before stepping down
152
+ return add_package_to_package(new_path, sub_folder)
153
153
 
154
154
 
155
155
  def import_package_tree(package: Package, destination: str, raw_package_import: bool, resolve_local_ids: bool) -> None:
@@ -1,7 +1,7 @@
1
1
  import io
2
2
  import json
3
3
  from json import JSONDecodeError
4
- from pathlib import Path
4
+ from pathlib import Path, PurePosixPath
5
5
  from typing import Dict, Union
6
6
  from zipfile import ZipFile
7
7
 
@@ -58,26 +58,27 @@ def package_tree_from_zip(
58
58
  is_root=is_root,
59
59
  meta=package_entity.get("_meta_"),
60
60
  )
61
- # Construct a nested Package object of the package to import
61
+ # Construct a nested Package object of the package to import.
62
+ # Zip entry names and DMSS addresses always use '/', so they are handled as POSIX paths on every OS.
62
63
  for file_info in zip_file.filelist:
63
64
  filename = file_info.filename.split("/", 1)[1] # Remove RootPackage prefix
64
65
  if file_info.is_dir():
65
66
  if filename == "": # Skip rootPackage
66
67
  continue
67
- add_package_to_package(Path(filename), root_package)
68
+ add_package_to_package(PurePosixPath(filename), root_package)
68
69
  continue
69
- if Path(filename).suffix != ".json":
70
+ if PurePosixPath(filename).suffix != ".json":
70
71
  file_like = io.BytesIO(zip_file.read(f"{folder_name}/{filename}"))
71
- file_like.name = Path(filename).name # stem
72
- file_like.destination = Path(f"/{destination}/{folder_name}/{filename}").parent
73
- add_object_to_package(Path(filename), root_package, file_like)
72
+ file_like.name = PurePosixPath(filename).name # stem
73
+ file_like.destination = PurePosixPath(f"/{destination}/{folder_name}/{filename}").parent
74
+ add_object_to_package(PurePosixPath(filename), root_package, file_like)
74
75
  continue
75
76
  try:
76
77
  json_doc = json.loads(zip_file.read(f"{folder_name}/{filename}"))
77
78
  except JSONDecodeError:
78
79
  raise Exception(f"Failed to load the file '{filename}' as a JSON document")
79
80
 
80
- add_file_to_package(Path(filename), root_package, json_doc)
81
+ add_file_to_package(PurePosixPath(filename), root_package, json_doc)
81
82
 
82
83
  # Add dependencies from entity to the global dependencies list
83
84
  dependencies = concat_dependencies(
@@ -1,5 +1,6 @@
1
- from os.path import normpath
1
+ import os
2
2
  from pathlib import Path
3
+ from posixpath import normpath # references are DMSS addresses, always '/'-separated
3
4
  from typing import Dict, List, Union
4
5
 
5
6
  from ..dmss import ApplicationException
@@ -81,8 +82,9 @@ def replace_relative_references(
81
82
  if value["referenceType"] == ReferenceTypes.LINK.value:
82
83
  value["address"] = _resolve_reference(value["address"])
83
84
  else:
84
- # Handle storage references
85
- local_file_path = "/".join(str(source_path).split("/")[:-1])
85
+ # Handle storage references. source_path is a folder on disk: take its parent with
86
+ # the OS path rules, the address itself is appended as-is ('/' works on Windows too).
87
+ local_file_path = os.path.dirname(str(source_path)) if source_path else ""
86
88
  if value["address"][0] == ".":
87
89
  raise ApplicationException(
88
90
  f"Relative references by . are not supported", data=value, debug=file_path
@@ -1,7 +1,7 @@
1
1
  import json
2
2
  import os
3
3
  import pprint
4
- from pathlib import Path
4
+ from pathlib import Path, PurePosixPath
5
5
  from typing import Callable, Dict, List
6
6
 
7
7
  import typer
@@ -68,7 +68,7 @@ def document_already_exists(api_exception: ApiException) -> bool:
68
68
  return False
69
69
 
70
70
 
71
- def add_package_to_path(name: str, path: Path):
71
+ def add_package_to_path(name: str, path: PurePosixPath):
72
72
  package = Package(name, is_root=len(path.parts) == 2)
73
73
  dmss_api.document_add(
74
74
  str(path.parent),
@@ -102,14 +102,16 @@ def replace_global_addresses(
102
102
  return document
103
103
 
104
104
 
105
- def destination_is_root(destination: Path) -> bool:
106
- if len(destination.parts) > 1:
105
+ def destination_is_root(destination: str | PurePosixPath) -> bool:
106
+ if len(PurePosixPath(destination).parts) > 1:
107
107
  return False
108
108
  return True
109
109
 
110
110
 
111
- def ensure_package_structure(path: Path):
111
+ def ensure_package_structure(path: str | PurePosixPath):
112
112
  """Create any missing packages in the provided path (mkdir -R)"""
113
+ # A DMSS address, not a path on disk: keep it '/'-separated on every OS.
114
+ path = PurePosixPath(path)
113
115
  try:
114
116
  dmss_api.document_get(f"dmss://{path}/")
115
117
  except NotFoundException as e:
@@ -98,7 +98,7 @@ class ReplaceReferences(unittest.TestCase):
98
98
  data_source_id, package = dst_path.split("/", 1)
99
99
 
100
100
  # Load the document
101
- document = test_documents[str(src_path)]
101
+ document = test_documents[src_path.as_posix()]
102
102
  dependencies = concat_dependencies(document.get("_meta_", {}).get("dependencies", []), {}, src_path.name)
103
103
 
104
104
  # Replace references
@@ -132,7 +132,7 @@ class ReplaceReferences(unittest.TestCase):
132
132
  data_source_id, package = dst_path.split("/", 1)
133
133
 
134
134
  # Load the document
135
- document = test_documents[str(src_path)]
135
+ document = test_documents[src_path.as_posix()]
136
136
  dependencies = concat_dependencies(document.get("_meta_", {}).get("dependencies", []), {}, src_path.name)
137
137
 
138
138
  with self.assertRaises(ApplicationException):
@@ -1,3 +0,0 @@
1
- {
2
- ".": "1.8.0"
3
- }
@@ -1 +0,0 @@
1
- VERSION = "1.8.0" # x-release-please-version