imas-python 0.1.dev1629__tar.gz → 0.1.dev1630__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 imas-python might be problematic. Click here for more details.

Files changed (222) hide show
  1. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/.gitignore +1 -4
  2. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/PKG-INFO +4 -2
  3. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/README.md +1 -1
  4. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/ci_config.rst +2 -2
  5. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/__init__.py +1 -4
  6. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/_version.py +2 -2
  7. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/assets/IDSDef.zip +0 -0
  8. imas_python-0.1.dev1630/imas/dd_helpers.py +169 -0
  9. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/ids_structure.py +2 -2
  10. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas_python.egg-info/PKG-INFO +4 -2
  11. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas_python.egg-info/requires.txt +2 -0
  12. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/pyproject.toml +3 -2
  13. imas_python-0.1.dev1629/imas/dd_helpers.py +0 -300
  14. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/.git-blame-ignore-revs +0 -0
  15. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/.git_archival.txt +0 -0
  16. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/.gitattributes +0 -0
  17. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/.github/workflows/liniting.yml +0 -0
  18. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/.github/workflows/publish.yml +0 -0
  19. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/.pylintrc +0 -0
  20. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/.readthedocs.yml +0 -0
  21. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/CODE_OF_CONDUCT.md +0 -0
  22. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/CONTRIBUTING.md +0 -0
  23. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/LICENSE.txt +0 -0
  24. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/MANIFEST.in +0 -0
  25. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/asv.conf.json +0 -0
  26. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/benchmarks/__init__.py +0 -0
  27. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/benchmarks/core_profiles.py +0 -0
  28. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/benchmarks/edge_profiles.py +0 -0
  29. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/benchmarks/technical.py +0 -0
  30. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/benchmarks/utils.py +0 -0
  31. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/ci/build_dd_zip.sh +0 -0
  32. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/ci/build_docs_and_dist.sh +0 -0
  33. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/ci/linting.sh +0 -0
  34. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/ci/run_benchmark.sh +0 -0
  35. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/ci/run_pytest.sh +0 -0
  36. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/conftest.py +0 -0
  37. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/.gitignore +0 -0
  38. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/Makefile +0 -0
  39. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/.gitignore +0 -0
  40. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/_static/imas.css +0 -0
  41. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/_static/imas_200x200.png +0 -0
  42. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/_templates/autosummary/accessor.rst +0 -0
  43. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/_templates/autosummary/accessor_attribute.rst +0 -0
  44. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/_templates/autosummary/accessor_callable.rst +0 -0
  45. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/_templates/autosummary/accessor_method.rst +0 -0
  46. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/_templates/autosummary/base.rst +0 -0
  47. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/_templates/custom-class-template.rst +0 -0
  48. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/_templates/custom-module-template.rst +0 -0
  49. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/_templates/layout.html +0 -0
  50. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/api-hidden.rst +0 -0
  51. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/api.rst +0 -0
  52. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/benchmarking.rst +0 -0
  53. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/changelog.rst +0 -0
  54. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/cli.rst +0 -0
  55. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/code_style.rst +0 -0
  56. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/conf.py +0 -0
  57. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/configuring.rst +0 -0
  58. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/advanced/dd_versions.rst +0 -0
  59. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/advanced/explore.rst +0 -0
  60. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/advanced/hashing.rst +0 -0
  61. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/advanced/imas_snippets/alternative_coordinates.py +0 -0
  62. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/advanced/imas_snippets/autoconvert_get.py +0 -0
  63. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/advanced/imas_snippets/autoconvert_put.py +0 -0
  64. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/advanced/imas_snippets/calc_with_units.py +0 -0
  65. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/advanced/imas_snippets/coordinates.py +0 -0
  66. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/advanced/imas_snippets/dd_versions.py +0 -0
  67. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/advanced/imas_snippets/explore_data.py +0 -0
  68. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/advanced/imas_snippets/explore_structures.py +0 -0
  69. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/advanced/imas_snippets/hashing.py +0 -0
  70. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/advanced/imas_snippets/ids_convert.py +0 -0
  71. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/advanced/imas_snippets/ids_to_xarray.py +0 -0
  72. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/advanced/imas_snippets/tensorized_ids_to_xarray.py +0 -0
  73. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/advanced/metadata.rst +0 -0
  74. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/advanced/xarray.rst +0 -0
  75. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/advanced_user_training.rst +0 -0
  76. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/analyze.rst +0 -0
  77. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/core_profiles_ne_timeslice.png +0 -0
  78. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/core_profiles_te.png +0 -0
  79. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/create.rst +0 -0
  80. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/explore.rst +0 -0
  81. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/imas_inspect.png +0 -0
  82. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/imas_snippets/create_core_profiles.py +0 -0
  83. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/imas_snippets/explore_public_ec_launchers.py +0 -0
  84. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/imas_snippets/explore_public_pf_active.py +0 -0
  85. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/imas_snippets/explore_training_data.py +0 -0
  86. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/imas_snippets/find_paths.py +0 -0
  87. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/imas_snippets/iterate_core_profiles.py +0 -0
  88. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/imas_snippets/plot_core_profiles_ne_timeslice.py +0 -0
  89. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/imas_snippets/plot_core_profiles_te.py +0 -0
  90. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/imas_snippets/print_idss.py +0 -0
  91. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/imas_snippets/read_core_profiles_ne_timeslice.py +0 -0
  92. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/imas_snippets/read_equilibrium_time_array.py +0 -0
  93. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/imas_snippets/read_whole_equilibrium.py +0 -0
  94. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/imas_snippets/transform_grid.py +0 -0
  95. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/interactive_tab_core_profiles_toplevel.png +0 -0
  96. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/print_tree_ids_properties.png +0 -0
  97. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/setup.rst +0 -0
  98. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic/transform.rst +0 -0
  99. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/courses/basic_user_training.rst +0 -0
  100. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/identifiers.rst +0 -0
  101. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/imas_architecture.rst +0 -0
  102. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/imas_structure.png +0 -0
  103. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/index.rst +0 -0
  104. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/installing.rst +0 -0
  105. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/intro.rst +0 -0
  106. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/lazy_loading.rst +0 -0
  107. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/mdsplus.rst +0 -0
  108. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/metadata.rst +0 -0
  109. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/multi-dd.rst +0 -0
  110. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/netcdf/conventions.rst +0 -0
  111. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/netcdf.rst +0 -0
  112. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/release_imas.rst +0 -0
  113. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/resampling.rst +0 -0
  114. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/docs/source/validation.rst +0 -0
  115. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/__main__.py +0 -0
  116. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/_util.py +0 -0
  117. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/assets/IDSDef2MDSpreTree.xsl +0 -0
  118. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/assets/IDS_fake_toplevel.xml +0 -0
  119. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/assets/IDS_minimal.xml +0 -0
  120. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/assets/IDS_minimal_2.xml +0 -0
  121. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/assets/IDS_minimal_struct_array.xml +0 -0
  122. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/assets/IDS_minimal_types.xml +0 -0
  123. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/assets/ITER_134173_106_core_profiles.ids +0 -0
  124. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/assets/ITER_134173_106_equilibrium.ids +0 -0
  125. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/assets/README.md +0 -0
  126. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/assets/core_profiles.ids +0 -0
  127. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/assets/equilibrium.ids +0 -0
  128. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/backends/__init__.py +0 -0
  129. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/backends/db_entry_impl.py +0 -0
  130. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/backends/imas_core/__init__.py +0 -0
  131. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/backends/imas_core/al_context.py +0 -0
  132. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/backends/imas_core/db_entry_al.py +0 -0
  133. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/backends/imas_core/db_entry_helpers.py +0 -0
  134. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/backends/imas_core/imas_interface.py +0 -0
  135. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/backends/imas_core/mdsplus_model.py +0 -0
  136. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/backends/imas_core/uda_support.py +0 -0
  137. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/backends/netcdf/__init__.py +0 -0
  138. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/backends/netcdf/db_entry_nc.py +0 -0
  139. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/backends/netcdf/ids2nc.py +0 -0
  140. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/backends/netcdf/nc2ids.py +0 -0
  141. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/backends/netcdf/nc_metadata.py +0 -0
  142. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/backends/netcdf/nc_validate.py +0 -0
  143. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/command/cli.py +0 -0
  144. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/command/db_analysis.py +0 -0
  145. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/command/helpers.py +0 -0
  146. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/command/timer.py +0 -0
  147. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/db_entry.py +0 -0
  148. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/dd_zip.py +0 -0
  149. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/exception.py +0 -0
  150. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/ids_base.py +0 -0
  151. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/ids_convert.py +0 -0
  152. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/ids_coordinates.py +0 -0
  153. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/ids_data_type.py +0 -0
  154. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/ids_defs.py +0 -0
  155. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/ids_factory.py +0 -0
  156. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/ids_identifiers.py +0 -0
  157. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/ids_metadata.py +0 -0
  158. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/ids_path.py +0 -0
  159. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/ids_primitive.py +0 -0
  160. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/ids_struct_array.py +0 -0
  161. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/ids_toplevel.py +0 -0
  162. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/setup_logging.py +0 -0
  163. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_all_dd_versions.py +0 -0
  164. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_cli.py +0 -0
  165. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_dbentry.py +0 -0
  166. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_dd_helpers.py +0 -0
  167. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_dd_zip.py +0 -0
  168. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_deepcopy.py +0 -0
  169. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_exception.py +0 -0
  170. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_get_sample.py +0 -0
  171. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_hash.py +0 -0
  172. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_helpers.py +0 -0
  173. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_identifiers.py +0 -0
  174. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_ids2nc.py +0 -0
  175. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_ids_ascii_data.py +0 -0
  176. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_ids_convert.py +0 -0
  177. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_ids_coordinates.py +0 -0
  178. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_ids_data_type.py +0 -0
  179. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_ids_factory.py +0 -0
  180. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_ids_metadata.py +0 -0
  181. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_ids_mixin.py +0 -0
  182. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_ids_path.py +0 -0
  183. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_ids_primitive.py +0 -0
  184. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_ids_struct_array.py +0 -0
  185. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_ids_structure.py +0 -0
  186. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_ids_toplevel.py +0 -0
  187. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_ids_validate.py +0 -0
  188. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_latest_dd_autofill.py +0 -0
  189. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_latest_dd_manual.py +0 -0
  190. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_latest_dd_resample.py +0 -0
  191. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_lazy_loading.py +0 -0
  192. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_list_occurrences.py +0 -0
  193. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_minimal.py +0 -0
  194. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_minimal_conversion.py +0 -0
  195. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_minimal_io.py +0 -0
  196. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_minimal_struct_array_io.py +0 -0
  197. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_minimal_types.py +0 -0
  198. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_minimal_types_io.py +0 -0
  199. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_minimal_types_io_automatic.py +0 -0
  200. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_nbc_change.py +0 -0
  201. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_nc_autofill.py +0 -0
  202. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_nc_entry.py +0 -0
  203. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_nc_metadata.py +0 -0
  204. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_nc_validation.py +0 -0
  205. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_snippets.py +0 -0
  206. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_static_ids.py +0 -0
  207. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_str_1d.py +0 -0
  208. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_time_slicing.py +0 -0
  209. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_uda_support.py +0 -0
  210. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/test/test_util.py +0 -0
  211. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/training.py +0 -0
  212. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas/util.py +0 -0
  213. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas_python.egg-info/SOURCES.txt +0 -0
  214. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas_python.egg-info/dependency_links.txt +0 -0
  215. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas_python.egg-info/entry_points.txt +0 -0
  216. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas_python.egg-info/not-zip-safe +0 -0
  217. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/imas_python.egg-info/top_level.txt +0 -0
  218. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/setup.cfg +0 -0
  219. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/setup.py +0 -0
  220. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/tools/compare_lowlevel_access_patterns.py +0 -0
  221. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/tools/extract_test_data.py +0 -0
  222. {imas_python-0.1.dev1629 → imas_python-0.1.dev1630}/tools/get_tagnames.py +0 -0
@@ -91,10 +91,7 @@ ENV/
91
91
  *.swo
92
92
 
93
93
  # SCM setuptools
94
- imas/version.py
95
-
96
- # Saxon symlink or downloaded file
97
- saxon*.jar
94
+ imas/_version.py
98
95
 
99
96
  # IMAS DD
100
97
  data-dictionary
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: imas-python
3
- Version: 0.1.dev1629
3
+ Version: 0.1.dev1630
4
4
  Summary: Pythonic wrappers for the IMAS Access Layer
5
5
  Author: imas-python developers
6
6
  Author-email: Olivier Hoenen <olivier.hoenen@iter.org>
@@ -212,6 +212,8 @@ Requires-Dist: click
212
212
  Requires-Dist: importlib_resources; python_version < "3.9"
213
213
  Requires-Dist: packaging
214
214
  Requires-Dist: xxhash>=2
215
+ Requires-Dist: saxonche
216
+ Requires-Dist: gitpython
215
217
  Provides-Extra: all
216
218
  Requires-Dist: imas[docs,h5py,imas-core,netcdf,test]; extra == "all"
217
219
  Provides-Extra: docs
@@ -247,7 +249,7 @@ Data Model.
247
249
  Install steps are described in the documentation generated from `/docs/source/installing.rst`.
248
250
 
249
251
  Documentation is autogenerated from the source using [Sphinx](http://sphinx-doc.org/)
250
- and can be found at the [ITER sharepoint](https://sharepoint.iter.org/departments/POP/CM/IMDesign/Code%20Documentation/IMAS-doc/index.html)
252
+ and can be found at the [readthedocs](https://imas-python.readthedocs.io/en/latest/)
251
253
 
252
254
  The documentation can be manually generated by installing sphinx and running:
253
255
 
@@ -11,7 +11,7 @@ Data Model.
11
11
  Install steps are described in the documentation generated from `/docs/source/installing.rst`.
12
12
 
13
13
  Documentation is autogenerated from the source using [Sphinx](http://sphinx-doc.org/)
14
- and can be found at the [ITER sharepoint](https://sharepoint.iter.org/departments/POP/CM/IMDesign/Code%20Documentation/IMAS-doc/index.html)
14
+ and can be found at the [readthedocs](https://imas-python.readthedocs.io/en/latest/)
15
15
 
16
16
  The documentation can be manually generated by installing sphinx and running:
17
17
 
@@ -76,8 +76,8 @@ Deployment projects
76
76
  There are two Bamboo deployment projects for imas-python:
77
77
 
78
78
  `Deploy imas-python-doc <https://ci.iter.org/deploy/viewDeploymentProjectEnvironments.action?id=1784709122>`_
79
- Deploy the documentation created in the `Build docs and dists` job to `Sharepoint
80
- <https://sharepoint.iter.org/departments/POP/CM/IMDesign/Code%20Documentation/imas-python-doc/index.html>`_.
79
+ Deploy the documentation created in the `Build docs and dists` job to `readthedocs
80
+ <https://imas-python.readthedocs.io/en/latest/>`_.
81
81
 
82
82
  This deployment project runs for after each successful CI build of the imas-python main
83
83
  branch.
@@ -25,10 +25,7 @@ from . import (
25
25
  util,
26
26
  )
27
27
 
28
- PUBLISHED_DOCUMENTATION_ROOT = (
29
- "https://sharepoint.iter.org/departments/POP/CM/IMDesign/"
30
- "Code%20Documentation/imas-python-doc"
31
- )
28
+ PUBLISHED_DOCUMENTATION_ROOT = "https://imas-python.readthedocs.io/en/latest/"
32
29
  """URL to the published documentation."""
33
30
  OLDEST_SUPPORTED_VERSION = _V("3.22.0")
34
31
  """Oldest Data Dictionary version that is supported by imas-python."""
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.1.dev1629'
16
- __version_tuple__ = version_tuple = (0, 1, 'dev1629')
15
+ __version__ = version = '0.1.dev1630'
16
+ __version_tuple__ = version_tuple = (0, 1, 'dev1630')
@@ -0,0 +1,169 @@
1
+ # This file is part of imas-python.
2
+ # You should have received the imas-python LICENSE file with this project.
3
+ """Helper functions to build IDSDef.xml"""
4
+
5
+ import logging
6
+ import os
7
+ import shutil
8
+ from pathlib import Path
9
+ from typing import Tuple
10
+ from zipfile import ZIP_DEFLATED, ZipFile
11
+
12
+ from packaging.version import Version as V
13
+ from saxonche import PySaxonProcessor
14
+
15
+ logger = logging.getLogger(__name__)
16
+
17
+ _idsdef_zip_relpath = Path("imas/assets/IDSDef.zip")
18
+ _build_dir = Path("build")
19
+
20
+
21
+ def prepare_data_dictionaries():
22
+ """Build IMAS IDSDef.xml files for each tagged version in the DD repository
23
+ 1. Use saxonche for transformations
24
+ 2. Clone the DD repository (ask for user/pass unless ssh key access is available)
25
+ 3. Generate IDSDef.xml and rename to IDSDef_${version}.xml
26
+ 4. Zip all these IDSDefs together and include in wheel
27
+ """
28
+ print("prepare_data_dictionaries")
29
+ from git import Repo
30
+
31
+ repo: Repo = get_data_dictionary_repo()
32
+ if repo:
33
+ newest_version_and_tag = (V("0"), None)
34
+ for tag in repo.tags:
35
+ version_and_tag = (V(str(tag)), tag)
36
+ if V(str(tag)) > V("3.21.1"):
37
+ newest_version_and_tag = max(newest_version_and_tag, version_and_tag)
38
+ logger.debug("Building data dictionary version %s", tag)
39
+ build_data_dictionary(repo, tag)
40
+
41
+ logger.info("Creating zip file of DD versions")
42
+
43
+ if _idsdef_zip_relpath.is_file():
44
+ logger.warning("Overwriting '%s'", _idsdef_zip_relpath)
45
+
46
+ with ZipFile(
47
+ _idsdef_zip_relpath,
48
+ mode="w", # this needs w, since zip can have multiple same entries
49
+ compression=ZIP_DEFLATED,
50
+ ) as dd_zip:
51
+ for filename in _build_dir.glob("[0-9]*.xml"):
52
+ arcname = Path("data-dictionary").joinpath(*filename.parts[1:])
53
+ dd_zip.write(filename, arcname=arcname)
54
+ # Include identifiers from latest tag in zip file
55
+ repo.git.checkout(newest_version_and_tag[1], force=True)
56
+ # DD layout <= 4.0.0
57
+ for filename in Path("data-dictionary").glob("*/*identifier.xml"):
58
+ arcname = Path("identifiers").joinpath(*filename.parts[1:])
59
+ dd_zip.write(filename, arcname=arcname)
60
+ # DD layout > 4.0.0
61
+ for filename in Path("data-dictionary").glob("schemas/*/*identifier.xml"):
62
+ arcname = Path("identifiers").joinpath(*filename.parts[2:])
63
+ dd_zip.write(filename, arcname=arcname)
64
+
65
+
66
+ def get_data_dictionary_repo() -> Tuple[bool, bool]:
67
+ try:
68
+ import git # Import git here, the user might not have it!
69
+ except ModuleNotFoundError:
70
+ raise RuntimeError(
71
+ "Could not find 'git' module, try 'pip install gitpython'. \
72
+ Will not build Data Dictionaries!"
73
+ )
74
+
75
+ # We need the actual source code (for now) so grab it from ITER
76
+ dd_repo_path = "data-dictionary"
77
+
78
+ if "DD_DIRECTORY" in os.environ:
79
+ logger.info("Found DD_DIRECTORY, copying")
80
+ try:
81
+ shutil.copytree(os.environ["DD_DIRECTORY"], dd_repo_path)
82
+ except FileExistsError:
83
+ pass
84
+ else:
85
+ logger.info("Trying to pull data dictionary git repo from ITER")
86
+
87
+ # Set up a bare repo and fetch the data-dictionary repository in it
88
+ os.makedirs(dd_repo_path, exist_ok=True)
89
+ try:
90
+ repo = git.Repo(dd_repo_path)
91
+ except git.exc.InvalidGitRepositoryError:
92
+ repo = git.Repo.init(dd_repo_path)
93
+ logger.info("Set up local git repository {!s}".format(repo))
94
+
95
+ try:
96
+ origin = repo.remote()
97
+ except ValueError:
98
+ dd_repo_url = "https://github.com/iterorganization/imas-data-dictionary.git"
99
+ origin = repo.create_remote("origin", url=dd_repo_url)
100
+ logger.info("Set up remote '{!s}' linking to '{!s}'".format(origin, origin.url))
101
+
102
+ try:
103
+ origin.fetch(tags=True)
104
+ except git.exc.GitCommandError as ee:
105
+ logger.warning(
106
+ "Could not fetch tags from %s. Git reports:\n %s." "\nTrying to continue",
107
+ list(origin.urls),
108
+ ee,
109
+ )
110
+ else:
111
+ logger.info("Remote tags fetched")
112
+ return repo
113
+
114
+
115
+ def _run_xsl_transformation(
116
+ xsd_file: Path, xsl_file: Path, tag: str, output_file: Path
117
+ ) -> None:
118
+ """
119
+ This function performs an XSL transformation using Saxon-HE (saxonche)
120
+ with the provided XSD file, XSL file, tag, and output file.
121
+
122
+ Args:
123
+ xsd_file (Path): XML Schema Definition (XSD) file
124
+ xsl_file (Path): The `xsl_file` parameter
125
+ tag (str): tag name to provide to 'DD_GIT_DESCRIBE' parameter
126
+ output_file (Path): The `output_file` parameter for resulting xml
127
+ """
128
+ with PySaxonProcessor(license=False) as proc:
129
+ logger.debug("Initializing Saxon Processor")
130
+ xsltproc = proc.new_xslt30_processor()
131
+ xdm_ddgit = proc.make_string_value(tag)
132
+ xsltproc.set_parameter("DD_GIT_DESCRIBE", xdm_ddgit)
133
+ xsltproc.transform_to_file(
134
+ source_file=str(xsd_file),
135
+ stylesheet_file=str(xsl_file),
136
+ output_file=str(output_file),
137
+ )
138
+ logger.info("Transformation complete: %s -> %s", xsd_file, output_file)
139
+
140
+
141
+ def build_data_dictionary(repo, tag: str, rebuild=False) -> None:
142
+ """Build a single version of the data dictionary given by the tag argument
143
+ if the IDS does not already exist.
144
+
145
+ In the data-dictionary repository sometimes IDSDef.xml is stored
146
+ directly, in which case we do not call make.
147
+
148
+ Args:
149
+ repo: Repository object containing the DD source code
150
+ tag: The DD version tag that will be build
151
+ rebuild: If true, overwrites existing pre-build tagged DD version
152
+ """
153
+ _build_dir.mkdir(exist_ok=True)
154
+ result_xml = _build_dir / f"{tag}.xml"
155
+
156
+ if result_xml.exists() and not rebuild:
157
+ logger.debug(f"XML for tag '{tag}' already exists, skipping")
158
+ return
159
+
160
+ repo.git.checkout(tag, force=True)
161
+
162
+ # Perform the XSL transformation with saxonche
163
+ dd_xsd = Path("data-dictionary/dd_data_dictionary.xml.xsd")
164
+ dd_xsl = Path("data-dictionary/dd_data_dictionary.xml.xsl")
165
+ _run_xsl_transformation(dd_xsd, dd_xsl, tag.name, result_xml)
166
+
167
+
168
+ if __name__ == "__main__":
169
+ prepare_data_dictionaries()
@@ -252,8 +252,8 @@ class IDSStructure(IDSBase):
252
252
  "Iterating over non-empty nodes of a lazy loaded IDS will skip nodes "
253
253
  "that are not loaded. Set accept_lazy=True to continue. "
254
254
  "See the documentation for more information: "
255
- "https://sharepoint.iter.org/departments/POP/CM/IMDesign/"
256
- "Code%20Documentation/imas-python-doc/generated/imas.ids_structure."
255
+ "https://imas-python.readthedocs.io/en/latest"
256
+ "/generated/imas.ids_structure."
257
257
  "IDSStructure.html#imas.ids_structure.IDSStructure.iter_nonempty_"
258
258
  )
259
259
  for child in self._children:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: imas-python
3
- Version: 0.1.dev1629
3
+ Version: 0.1.dev1630
4
4
  Summary: Pythonic wrappers for the IMAS Access Layer
5
5
  Author: imas-python developers
6
6
  Author-email: Olivier Hoenen <olivier.hoenen@iter.org>
@@ -212,6 +212,8 @@ Requires-Dist: click
212
212
  Requires-Dist: importlib_resources; python_version < "3.9"
213
213
  Requires-Dist: packaging
214
214
  Requires-Dist: xxhash>=2
215
+ Requires-Dist: saxonche
216
+ Requires-Dist: gitpython
215
217
  Provides-Extra: all
216
218
  Requires-Dist: imas[docs,h5py,imas-core,netcdf,test]; extra == "all"
217
219
  Provides-Extra: docs
@@ -247,7 +249,7 @@ Data Model.
247
249
  Install steps are described in the documentation generated from `/docs/source/installing.rst`.
248
250
 
249
251
  Documentation is autogenerated from the source using [Sphinx](http://sphinx-doc.org/)
250
- and can be found at the [ITER sharepoint](https://sharepoint.iter.org/departments/POP/CM/IMDesign/Code%20Documentation/IMAS-doc/index.html)
252
+ and can be found at the [readthedocs](https://imas-python.readthedocs.io/en/latest/)
251
253
 
252
254
  The documentation can be manually generated by installing sphinx and running:
253
255
 
@@ -4,6 +4,8 @@ scipy
4
4
  click
5
5
  packaging
6
6
  xxhash>=2
7
+ saxonche
8
+ gitpython
7
9
 
8
10
  [:python_version < "3.9"]
9
11
  importlib_resources
@@ -1,8 +1,7 @@
1
1
  [build-system]
2
2
  # Minimum requirements for the build system to execute.
3
3
  # Keep this on a single line for the grep magic of build scripts to work
4
- requires = ["setuptools>=61", "wheel", "numpy", "gitpython", "packaging", "tomli;python_version<'3.11'", "setuptools_scm>8"]
5
- # needs saxon9he.jar in CLASSPATH
4
+ requires = ["setuptools>=61", "wheel", "numpy", "gitpython", "saxonche","packaging", "tomli;python_version<'3.11'", "setuptools_scm>8"]
6
5
 
7
6
  build-backend = "setuptools.build_meta"
8
7
 
@@ -64,6 +63,8 @@ dependencies = [
64
63
  "importlib_resources;python_version<'3.9'",
65
64
  "packaging",
66
65
  "xxhash >= 2",
66
+ "saxonche",
67
+ "gitpython"
67
68
  ]
68
69
 
69
70
  [project.optional-dependencies]
@@ -1,300 +0,0 @@
1
- # This file is part of imas-python.
2
- # You should have received the imas-python LICENSE file with this project.
3
- """Helper functions to build IDSDef.xml"""
4
-
5
- import logging
6
- import os
7
- import re
8
- import shutil
9
- import subprocess
10
- from io import BytesIO
11
- from pathlib import Path
12
- from typing import Sequence, Tuple, Union
13
- from urllib.request import urlopen
14
- from zipfile import ZIP_DEFLATED, ZipFile
15
-
16
- from packaging.version import Version as V
17
-
18
- logger = logging.getLogger(__name__)
19
-
20
- _idsdef_zip_relpath = Path("imas/assets/IDSDef.zip")
21
- _build_dir = Path("build")
22
- _saxon_local_default_name = "saxon9he.jar" # For pre-3.30.0 builds
23
- _saxon_regex = "saxon((.(?!test|xqj))*).jar" # Can be used in re.match
24
-
25
-
26
- def prepare_data_dictionaries():
27
- """Build IMAS IDSDef.xml files for each tagged version in the DD repository
28
- 1. Search for saxon or download it
29
- 2. Clone the DD repository (ask for user/pass unless ssh key access is available)
30
- 3. Generate IDSDef.xml and rename to IDSDef_${version}.xml
31
- 4. Zip all these IDSDefs together and include in wheel
32
- """
33
- from git import Repo
34
-
35
- saxon_jar_path = get_saxon()
36
- repo: Repo = get_data_dictionary_repo()
37
- if repo:
38
- newest_version_and_tag = (V("0"), None)
39
- for tag in repo.tags:
40
- version_and_tag = (V(str(tag)), tag)
41
- if V(str(tag)) > V("3.21.1"):
42
- newest_version_and_tag = max(newest_version_and_tag, version_and_tag)
43
- logger.debug("Building data dictionary version %s", tag)
44
- build_data_dictionary(repo, tag, saxon_jar_path)
45
-
46
- logger.info("Creating zip file of DD versions")
47
-
48
- if _idsdef_zip_relpath.is_file():
49
- logger.warning("Overwriting '%s'", _idsdef_zip_relpath)
50
-
51
- with ZipFile(
52
- _idsdef_zip_relpath,
53
- mode="w", # this needs w, since zip can have multiple same entries
54
- compression=ZIP_DEFLATED,
55
- ) as dd_zip:
56
- for filename in _build_dir.glob("[0-9]*.xml"):
57
- arcname = Path("data-dictionary").joinpath(*filename.parts[1:])
58
- dd_zip.write(filename, arcname=arcname)
59
- # Include identifiers from latest tag in zip file
60
- repo.git.checkout(newest_version_and_tag[1], force=True)
61
- # DD layout <= 4.0.0
62
- for filename in Path("data-dictionary").glob("*/*identifier.xml"):
63
- arcname = Path("identifiers").joinpath(*filename.parts[1:])
64
- dd_zip.write(filename, arcname=arcname)
65
- # DD layout > 4.0.0
66
- for filename in Path("data-dictionary").glob("schemas/*/*identifier.xml"):
67
- arcname = Path("identifiers").joinpath(*filename.parts[2:])
68
- dd_zip.write(filename, arcname=arcname)
69
-
70
-
71
- # pre 3.30.0 versions of the DD have the `saxon9he.jar` file path hardcoded
72
- # in their makefiles. To be sure we can build everything, we link whatever
73
- # saxon we can find to a local file called saxon9he.jar
74
- def get_saxon() -> Path:
75
- """Search for saxon*.jar and return the path or download it.
76
- The DD build works by having Saxon in the CLASSPATH, called saxon9he.jar
77
- until DD version 3.30.0. After 3.30.0 Saxon is found by the SAXONJARFILE env
78
- variable. We will 'cheat' a little bit later by symlinking saxon9he.jar to
79
- any version of saxon we found.
80
-
81
- Check:
82
- 1. CLASSPATH
83
- 2. `which saxon`
84
- 3. /usr/share/java/*
85
- 4. or download it
86
- """
87
-
88
- local_saxon_path = Path.cwd() / _saxon_local_default_name
89
- if local_saxon_path.exists():
90
- logger.debug("Something already at '%s' not creating anew", local_saxon_path)
91
- return local_saxon_path
92
-
93
- saxon_jar_origin = Path(
94
- find_saxon_classpath()
95
- or find_saxon_bin()
96
- or find_saxon_jar()
97
- or download_saxon()
98
- )
99
- logger.info("Found Saxon JAR '%s'", saxon_jar_origin)
100
- if saxon_jar_origin.name != _saxon_local_default_name:
101
- try:
102
- os.symlink(saxon_jar_origin, local_saxon_path)
103
- except FileExistsError:
104
- # Another process could have created the symlink while we were searching
105
- logger.debug(
106
- "Link '%s' exists, parallel process might've created it",
107
- local_saxon_path,
108
- )
109
- return local_saxon_path
110
- return saxon_jar_origin
111
-
112
-
113
- def find_saxon_jar():
114
- # This finds multiple versions on my system, but they are symlinked together.
115
- # take the shortest one.
116
- jars = [
117
- path
118
- for path in Path("/usr/share/java").rglob("*")
119
- if re.match(_saxon_regex, path.name, flags=re.IGNORECASE)
120
- ]
121
-
122
- if jars:
123
- saxon_jar_path = min(jars, key=lambda x: len(x.parts))
124
- return saxon_jar_path
125
-
126
-
127
- def find_saxon_classpath():
128
- """Search JAVAs CLASSPATH for a Saxon .jar"""
129
- classpath = os.environ.get("CLASSPATH", "")
130
- for part in re.split(";|:", classpath):
131
- if (
132
- part.endswith(".jar")
133
- and part.split("/")[-1].startswith("saxon")
134
- and "test" not in part
135
- and "xqj" not in part
136
- ):
137
- return part
138
-
139
-
140
- def find_saxon_bin():
141
- """Search for a saxon executable"""
142
- saxon_bin = shutil.which("saxon")
143
- if saxon_bin:
144
- with open(saxon_bin, "r") as file:
145
- for line in file:
146
- saxon_jar_path = re.search("[^ ]*saxon[^ ]*jar", line)
147
- if saxon_jar_path:
148
- return saxon_jar_path.group(0)
149
-
150
-
151
- def download_saxon():
152
- """Downloads a zipfile containing Saxon and extract it to the current dir.
153
- Return the full path to Saxon. This can be any Saxon version. Scripts that
154
- wrap this should probably manipulate either the name of this file, and/or
155
- the CLASSPATH"""
156
-
157
- SAXON_PATH = "https://github.com/Saxonica/Saxon-HE/releases/download/SaxonHE10-9/SaxonHE10-9J.zip" # noqa: E501
158
-
159
- resp = urlopen(SAXON_PATH, timeout=120.0)
160
- zipfile = ZipFile(BytesIO(resp.read()))
161
- # Zipfile has a list of the ZipInfos. Look inside for a Saxon jar
162
- for file in zipfile.filelist:
163
- if re.match(_saxon_regex, file.filename, flags=re.IGNORECASE):
164
- path = zipfile.extract(file)
165
- del zipfile
166
- return path
167
- raise FileNotFoundError(f"No Saxon jar found in given zipfile '{SAXON_PATH}'")
168
-
169
-
170
- def get_data_dictionary_repo() -> Tuple[bool, bool]:
171
- try:
172
- import git # Import git here, the user might not have it!
173
- except ModuleNotFoundError:
174
- raise RuntimeError(
175
- "Could not find 'git' module, try 'pip install gitpython'. \
176
- Will not build Data Dictionaries!"
177
- )
178
-
179
- # We need the actual source code (for now) so grab it from ITER
180
- dd_repo_path = "data-dictionary"
181
-
182
- if "DD_DIRECTORY" in os.environ:
183
- logger.info("Found DD_DIRECTORY, copying")
184
- try:
185
- shutil.copytree(os.environ["DD_DIRECTORY"], dd_repo_path)
186
- except FileExistsError:
187
- pass
188
- else:
189
- logger.info("Trying to pull data dictionary git repo from ITER")
190
-
191
- # Set up a bare repo and fetch the data-dictionary repository in it
192
- os.makedirs(dd_repo_path, exist_ok=True)
193
- try:
194
- repo = git.Repo(dd_repo_path)
195
- except git.exc.InvalidGitRepositoryError:
196
- repo = git.Repo.init(dd_repo_path)
197
- logger.info("Set up local git repository {!s}".format(repo))
198
-
199
- try:
200
- origin = repo.remote()
201
- except ValueError:
202
- dd_repo_url = "https://github.com/iterorganization/imas-data-dictionary.git"
203
- origin = repo.create_remote("origin", url=dd_repo_url)
204
- logger.info("Set up remote '{!s}' linking to '{!s}'".format(origin, origin.url))
205
-
206
- try:
207
- origin.fetch(tags=True)
208
- except git.exc.GitCommandError as ee:
209
- logger.warning(
210
- "Could not fetch tags from %s. Git reports:\n %s." "\nTrying to continue",
211
- list(origin.urls),
212
- ee,
213
- )
214
- else:
215
- logger.info("Remote tags fetched")
216
- return repo
217
-
218
-
219
- def _run_data_dictionary(
220
- args: Union[Sequence, str], tag: str, saxon_jar_path: str
221
- ) -> int:
222
- """Run in a Data Dictionary environment. Used e.g. to run the DD Makefile
223
-
224
- Args:
225
- args: The "args" argument directly passed to :func:`subprocess.run`,
226
- e.g. ``["make", "clean"]``
227
- tag: The DD version tag that will be printed on error
228
- saxon_jar_path: The path to the saxon jar; Added to CLASSPATH and used
229
- to generate the DD
230
- """
231
- env = os.environ.copy()
232
- env["CLASSPATH"] = f"{saxon_jar_path}:{env.get('CLASSPATH', '')}"
233
- result = subprocess.run(
234
- args,
235
- bufsize=0,
236
- capture_output=True,
237
- cwd=os.getcwd() + "/data-dictionary",
238
- env=env,
239
- text=True,
240
- )
241
-
242
- if result.returncode != 0:
243
- logger.warning("Error making DD version %s, make reported:", tag)
244
- logger.warning("CLASSPATH ='%s'", saxon_jar_path)
245
- logger.warning("PATH = '%s'", os.environ.get("PATH", ""))
246
- logger.warning("stdout = '%s'", result.stdout.strip())
247
- logger.warning("stderr = '%s'", result.stderr.strip())
248
- logger.warning("continuing without DD version %s", tag)
249
- else:
250
- logger.debug(
251
- "Successful make for DD %s.\n-- Make stdout --\n%s\n-- Make stderr --\n%s",
252
- tag,
253
- result.stdout,
254
- result.stderr,
255
- )
256
- return result.returncode
257
-
258
-
259
- def build_data_dictionary(repo, tag: str, saxon_jar_path: str, rebuild=False) -> None:
260
- """Build a single version of the data dictionary given by the tag argument
261
- if the IDS does not already exist.
262
-
263
- In the data-dictionary repository sometimes IDSDef.xml is stored
264
- directly, in which case we do not call make.
265
-
266
- Args:
267
- repo: Repository object containing the DD source code
268
- tag: The DD version tag that will be build
269
- saxon_jar_path: The path to the saxon jar; Added to CLASSPATH and used
270
- to generate the DD
271
- rebuild: If true, overwrites existing pre-build tagged DD version
272
- """
273
- _build_dir.mkdir(exist_ok=True)
274
- result_xml = _build_dir / f"{tag}.xml"
275
-
276
- if result_xml.exists() and not rebuild:
277
- logger.debug(f"XML for tag '{tag}' already exists, skipping")
278
- return
279
-
280
- repo.git.checkout(tag, force=True)
281
- if _run_data_dictionary(["make", "clean"], tag, saxon_jar_path) != 0:
282
- return
283
- if _run_data_dictionary(["make", "IDSDef.xml"], tag, saxon_jar_path) != 0:
284
- return
285
-
286
- # copy and delete original instead of move (to follow symlink)
287
- IDSDef = Path("data-dictionary/IDSDef.xml")
288
- try:
289
- shutil.copy(
290
- IDSDef, # Hardcoded in access-layer makefile
291
- result_xml,
292
- follow_symlinks=True,
293
- )
294
- except shutil.SameFileError:
295
- pass
296
- IDSDef.unlink(missing_ok=True)
297
-
298
-
299
- if __name__ == "__main__":
300
- prepare_data_dictionaries()