soft7 0.2.0__tar.gz → 0.2.2__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 (56) hide show
  1. {soft7-0.2.0 → soft7-0.2.2}/.github/workflows/cd_docs.yml +2 -1
  2. {soft7-0.2.0 → soft7-0.2.2}/.github/workflows/cd_publish.yml +1 -1
  3. {soft7-0.2.0 → soft7-0.2.2}/.github/workflows/ci_tests.yml +5 -3
  4. {soft7-0.2.0 → soft7-0.2.2}/.pre-commit-config.yaml +6 -6
  5. {soft7-0.2.0 → soft7-0.2.2}/CHANGELOG.md +58 -5
  6. {soft7-0.2.0 → soft7-0.2.2}/PKG-INFO +13 -13
  7. {soft7-0.2.0 → soft7-0.2.2}/pyproject.toml +10 -10
  8. {soft7-0.2.0 → soft7-0.2.2}/s7/__init__.py +2 -2
  9. {soft7-0.2.0 → soft7-0.2.2}/s7/pydantic_models/_utils.py +1 -1
  10. {soft7-0.2.0 → soft7-0.2.2}/s7/pydantic_models/soft7_entity.py +3 -3
  11. {soft7-0.2.0 → soft7-0.2.2}/s7/pydantic_models/soft7_instance.py +20 -14
  12. {soft7-0.2.0 → soft7-0.2.2}/tests/factories/test_datasource_factory.py +4 -1
  13. {soft7-0.2.0 → soft7-0.2.2}/tests/oteapi_plugin/test_soft7_function.py +2 -0
  14. {soft7-0.2.0 → soft7-0.2.2}/.github/dependabot.yml +0 -0
  15. {soft7-0.2.0 → soft7-0.2.2}/.github/workflows/ci_bot_pr_changes.yml +0 -0
  16. {soft7-0.2.0 → soft7-0.2.2}/.gitignore +0 -0
  17. {soft7-0.2.0 → soft7-0.2.2}/LICENSE +0 -0
  18. {soft7-0.2.0 → soft7-0.2.2}/README.md +0 -0
  19. {soft7-0.2.0 → soft7-0.2.2}/agraph.cfg +0 -0
  20. {soft7-0.2.0 → soft7-0.2.2}/docker-compose.yml +0 -0
  21. {soft7-0.2.0 → soft7-0.2.2}/docs/conf.py +0 -0
  22. {soft7-0.2.0 → soft7-0.2.2}/docs/examples/advanced.ipynb +0 -0
  23. {soft7-0.2.0 → soft7-0.2.2}/docs/examples/basic.ipynb +0 -0
  24. {soft7-0.2.0 → soft7-0.2.2}/docs/examples/datasource.ipynb +0 -0
  25. {soft7-0.2.0 → soft7-0.2.2}/docs/examples/index.md +0 -0
  26. {soft7-0.2.0 → soft7-0.2.2}/docs/index.md +0 -0
  27. {soft7-0.2.0 → soft7-0.2.2}/graph/README.md +0 -0
  28. {soft7-0.2.0 → soft7-0.2.2}/graph/__init__.py +0 -0
  29. {soft7-0.2.0 → soft7-0.2.2}/graph/utils.py +0 -0
  30. {soft7-0.2.0 → soft7-0.2.2}/ontology/entity_soft7.ttl +0 -0
  31. {soft7-0.2.0 → soft7-0.2.2}/s7/exceptions.py +0 -0
  32. {soft7-0.2.0 → soft7-0.2.2}/s7/factories/__init__.py +0 -0
  33. {soft7-0.2.0 → soft7-0.2.2}/s7/factories/datasource_factory.py +0 -0
  34. {soft7-0.2.0 → soft7-0.2.2}/s7/factories/entity_factory.py +0 -0
  35. {soft7-0.2.0 → soft7-0.2.2}/s7/factories/generated_classes.py +0 -0
  36. {soft7-0.2.0 → soft7-0.2.2}/s7/oteapi_plugin/__init__.py +0 -0
  37. {soft7-0.2.0 → soft7-0.2.2}/s7/oteapi_plugin/models.py +0 -0
  38. {soft7-0.2.0 → soft7-0.2.2}/s7/oteapi_plugin/soft7_function.py +0 -0
  39. {soft7-0.2.0 → soft7-0.2.2}/s7/oteapi_plugin/yaml_parser.py +0 -0
  40. {soft7-0.2.0 → soft7-0.2.2}/s7/pydantic_models/__init__.py +0 -0
  41. {soft7-0.2.0 → soft7-0.2.2}/s7/pydantic_models/datasource.py +0 -0
  42. {soft7-0.2.0 → soft7-0.2.2}/s7/pydantic_models/oteapi.py +0 -0
  43. {soft7-0.2.0 → soft7-0.2.2}/tests/conftest.py +0 -0
  44. {soft7-0.2.0 → soft7-0.2.2}/tests/factories/conftest.py +0 -0
  45. {soft7-0.2.0 → soft7-0.2.2}/tests/graph/test_utils.py +0 -0
  46. {soft7-0.2.0 → soft7-0.2.2}/tests/pydantic_models/conftest.py +0 -0
  47. {soft7-0.2.0 → soft7-0.2.2}/tests/pydantic_models/test_datasource.py +0 -0
  48. {soft7-0.2.0 → soft7-0.2.2}/tests/pydantic_models/test_soft7_entity.py +0 -0
  49. {soft7-0.2.0 → soft7-0.2.2}/tests/static/onto-ns_OPTIMADEStructure.json +0 -0
  50. {soft7-0.2.0 → soft7-0.2.2}/tests/static/onto-ns_OPTIMADEStructureAssembly.json +0 -0
  51. {soft7-0.2.0 → soft7-0.2.2}/tests/static/onto-ns_OPTIMADEStructureAttributes.json +0 -0
  52. {soft7-0.2.0 → soft7-0.2.2}/tests/static/onto-ns_OPTIMADEStructureSpecies.json +0 -0
  53. {soft7-0.2.0 → soft7-0.2.2}/tests/static/optimade.materialsproject_mp-1228448.json +0 -0
  54. {soft7-0.2.0 → soft7-0.2.2}/tests/static/soft_datasource_content.yaml +0 -0
  55. {soft7-0.2.0 → soft7-0.2.2}/tests/static/soft_datasource_entity.yaml +0 -0
  56. {soft7-0.2.0 → soft7-0.2.2}/tests/static/soft_datasource_entity_test_data.yaml +0 -0
@@ -5,6 +5,7 @@ on:
5
5
  push:
6
6
  branches:
7
7
  - 'main'
8
+ - 'push-action/**' # For the CasperWA/push-protected action
8
9
 
9
10
  # Run for every new release
10
11
  release:
@@ -61,7 +62,7 @@ jobs:
61
62
  deploy:
62
63
  runs-on: ubuntu-latest
63
64
 
64
- if: github.event_name != 'pull_request'
65
+ if: github.event_name != 'pull_request' && ( ! startsWith(github.ref_name, 'push-action/') )
65
66
 
66
67
  needs: build
67
68
 
@@ -8,7 +8,7 @@ on:
8
8
  jobs:
9
9
  build:
10
10
  name: External
11
- uses: SINTEF/ci-cd/.github/workflows/cd_release.yml@v2.8.2
11
+ uses: SINTEF/ci-cd/.github/workflows/cd_release.yml@v2.8.3
12
12
  if: github.repository == 'SINTEF/soft7' && startsWith(github.ref, 'refs/tags/v')
13
13
  with:
14
14
  # General
@@ -5,11 +5,12 @@ on:
5
5
  push:
6
6
  branches:
7
7
  - 'main'
8
+ - 'push-action/**' # For the CasperWA/push-protected action
8
9
 
9
10
  jobs:
10
11
  basics:
11
12
  name: External
12
- uses: SINTEF/ci-cd/.github/workflows/ci_tests.yml@v2.8.2
13
+ uses: SINTEF/ci-cd/.github/workflows/ci_tests.yml@v2.8.3
13
14
  with:
14
15
  # General
15
16
  install_extras: '[dev]'
@@ -42,6 +43,7 @@ jobs:
42
43
  runs-on: ubuntu-latest
43
44
 
44
45
  strategy:
46
+ fail-fast: false
45
47
  matrix:
46
48
  # Supported Python versions (according to pyproject.toml)
47
49
  python-version: ['3.9', '3.10', '3.11', '3.12']
@@ -62,11 +64,11 @@ jobs:
62
64
  pip install -e .[testing]
63
65
 
64
66
  - name: Run pytest
65
- run: pytest -v -rs --cov=s7 --cov-report=xml --cov-report=term-missing
67
+ run: pytest -v -rs --cov=s7 --cov-report=xml --cov-report=term-missing --color=yes
66
68
 
67
69
  - name: Upload code coverage report
68
70
  if: github.repository == 'SINTEF/soft7'
69
- uses: codecov/codecov-action@v4
71
+ uses: codecov/codecov-action@v5
70
72
  with:
71
73
  token: ${{ secrets.CODECOV_TOKEN }}
72
74
  fail_ci_if_error: true
@@ -14,7 +14,7 @@ ci:
14
14
  # hooks
15
15
  repos:
16
16
  - repo: https://github.com/pre-commit/pre-commit-hooks
17
- rev: v4.6.0
17
+ rev: v5.0.0
18
18
  hooks:
19
19
  - id: end-of-file-fixer
20
20
  - id: debug-statements
@@ -26,18 +26,18 @@ repos:
26
26
  args: [--markdown-linebreak-ext=md]
27
27
 
28
28
  - repo: https://github.com/asottile/pyupgrade
29
- rev: v3.17.0
29
+ rev: v3.19.0
30
30
  hooks:
31
31
  - id: pyupgrade
32
32
  args: ["--py39-plus", "--keep-runtime-typing"]
33
33
 
34
34
  - repo: https://github.com/psf/black
35
- rev: 24.8.0
35
+ rev: 24.10.0
36
36
  hooks:
37
37
  - id: black
38
38
 
39
39
  - repo: https://github.com/astral-sh/ruff-pre-commit
40
- rev: v0.6.2
40
+ rev: v0.8.0
41
41
  hooks:
42
42
  - id: ruff
43
43
  args:
@@ -47,14 +47,14 @@ repos:
47
47
  - "--no-unsafe-fixes"
48
48
 
49
49
  - repo: https://github.com/PyCQA/bandit
50
- rev: 1.7.9
50
+ rev: 1.7.10
51
51
  hooks:
52
52
  - id: bandit
53
53
  args: ["-r"]
54
54
  files: ^s7/.*$
55
55
 
56
56
  - repo: https://github.com/pre-commit/mirrors-mypy
57
- rev: v1.11.2
57
+ rev: v1.13.0
58
58
  hooks:
59
59
  - id: mypy
60
60
  exclude: ^tests/.*$
@@ -2,15 +2,68 @@
2
2
 
3
3
  ## [Unreleased](https://github.com/SINTEF/soft7/tree/HEAD)
4
4
 
5
- [Full Changelog](https://github.com/SINTEF/soft7/compare/v0.2.0...HEAD)
5
+ [Full Changelog](https://github.com/SINTEF/soft7/compare/v0.2.2...HEAD)
6
6
 
7
- ## Support different SOFT flavors
7
+ # Fix issue with pydantic v2.10
8
8
 
9
- Implement support for different SOFT flavors, specifically, support the [DLite](https://github.com/SINTEF/dlite) flavor of SOFT entities.
9
+ There are some issues with pydantic's v2.10 concerning `Url` models.
10
+ Since we use the pydantic version specified by `oteapi-core`, we make sure to at least use v0.7.0.dev6, since this ensure v2.10.0 and v2.10.1 is not installed.
11
+ When v2.10.2 comes out, it can be tested on `oteapi-core` before a new release is done.
10
12
 
11
- ### DX
13
+ All other dependencies and dev tools have also been updated.
14
+
15
+ ## [v0.2.2](https://github.com/SINTEF/soft7/tree/v0.2.2) (2024-11-25)
16
+
17
+ [Full Changelog](https://github.com/SINTEF/soft7/compare/v0.2.1...v0.2.2)
18
+
19
+ # Fix issue with pydantic v2.10
12
20
 
13
- Update dev tools and use [PyPIs Trusted Publishers](https://docs.pypi.org/trusted-publishers/) scheme.
21
+ There are some issues with pydantic's v2.10 concerning `Url` models.
22
+ Since we use the pydantic version specified by `oteapi-core`, we make sure to at least use v0.7.0.dev6, since this ensure v2.10.0 and v2.10.1 is not installed.
23
+ When v2.10.2 comes out, it can be tested on `oteapi-core` before a new release is done.
24
+
25
+ All other dependencies and dev tools have also been updated.
26
+
27
+ **Merged pull requests:**
28
+
29
+ - Update pytest-httpx requirement from ~=0.33.0 to \>=0.33,\<0.35 in the dependencies group [\#82](https://github.com/SINTEF/soft7/pull/82) ([dependabot[bot]](https://github.com/apps/dependabot))
30
+ - \[pre-commit.ci\] pre-commit autoupdate [\#81](https://github.com/SINTEF/soft7/pull/81) ([pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci))
31
+ - Bump codecov/codecov-action from 4 to 5 in the actions group [\#80](https://github.com/SINTEF/soft7/pull/80) ([dependabot[bot]](https://github.com/apps/dependabot))
32
+ - \[pre-commit.ci\] pre-commit autoupdate [\#79](https://github.com/SINTEF/soft7/pull/79) ([pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci))
33
+ - \[pre-commit.ci\] pre-commit autoupdate [\#78](https://github.com/SINTEF/soft7/pull/78) ([pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci))
34
+ - Bump the dependencies group with 2 updates [\#77](https://github.com/SINTEF/soft7/pull/77) ([dependabot[bot]](https://github.com/apps/dependabot))
35
+ - \[pre-commit.ci\] pre-commit autoupdate [\#76](https://github.com/SINTEF/soft7/pull/76) ([pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci))
36
+ - Update pydata-sphinx-theme requirement from ~=0.15.2 to \>=0.15.2,\<0.17.0 in the dependencies group [\#75](https://github.com/SINTEF/soft7/pull/75) ([dependabot[bot]](https://github.com/apps/dependabot))
37
+ - \[pre-commit.ci\] pre-commit autoupdate [\#74](https://github.com/SINTEF/soft7/pull/74) ([pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci))
38
+ - Bump SINTEF/ci-cd from 2.8.2 to 2.8.3 in the actions group [\#73](https://github.com/SINTEF/soft7/pull/73) ([dependabot[bot]](https://github.com/apps/dependabot))
39
+ - \[pre-commit.ci\] pre-commit autoupdate [\#72](https://github.com/SINTEF/soft7/pull/72) ([pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci))
40
+ - \[pre-commit.ci\] pre-commit autoupdate [\#70](https://github.com/SINTEF/soft7/pull/70) ([pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci))
41
+ - Update pre-commit requirement from ~=3.7 to ~=4.0 in the dependencies group [\#69](https://github.com/SINTEF/soft7/pull/69) ([dependabot[bot]](https://github.com/apps/dependabot))
42
+ - \[pre-commit.ci\] pre-commit autoupdate [\#68](https://github.com/SINTEF/soft7/pull/68) ([pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci))
43
+ - Update pytest-httpx requirement from ~=0.31.1 to ~=0.32.0 in the dependencies group [\#67](https://github.com/SINTEF/soft7/pull/67) ([dependabot[bot]](https://github.com/apps/dependabot))
44
+ - \[pre-commit.ci\] pre-commit autoupdate [\#66](https://github.com/SINTEF/soft7/pull/66) ([pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci))
45
+ - Update pytest-httpx requirement from ~=0.30.0 to \>=0.30,\<0.32 in the dependencies group [\#65](https://github.com/SINTEF/soft7/pull/65) ([dependabot[bot]](https://github.com/apps/dependabot))
46
+
47
+ ## [v0.2.1](https://github.com/SINTEF/soft7/tree/v0.2.1) (2024-09-18)
48
+
49
+ [Full Changelog](https://github.com/SINTEF/soft7/compare/v0.2.0...v0.2.1)
50
+
51
+ ## Remove upper limit for `oteapi-core` dependency
52
+
53
+ While not recommended, this does make it possible to support the DataSpaces developed at SINTEF.
54
+ In the future a more stringent dependency tree/graph should be implemented for all packages.
55
+
56
+ **Fixed bugs:**
57
+
58
+ - Update example OpenAPI specs [\#61](https://github.com/SINTEF/soft7/issues/61)
59
+ - Fix deployment issue [\#57](https://github.com/SINTEF/soft7/issues/57)
60
+
61
+ **Merged pull requests:**
62
+
63
+ - Remove upper level version dependency for `oteapi-core` [\#62](https://github.com/SINTEF/soft7/pull/62) ([CasperWA](https://github.com/CasperWA))
64
+ - \[pre-commit.ci\] pre-commit autoupdate [\#60](https://github.com/SINTEF/soft7/pull/60) ([pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci))
65
+ - \[pre-commit.ci\] pre-commit autoupdate [\#59](https://github.com/SINTEF/soft7/pull/59) ([pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci))
66
+ - Ensure CI jobs are run for push-protected action branches [\#58](https://github.com/SINTEF/soft7/pull/58) ([CasperWA](https://github.com/CasperWA))
14
67
 
15
68
  ## [v0.2.0](https://github.com/SINTEF/soft7/tree/v0.2.0) (2024-08-27)
16
69
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: soft7
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: SOFT7 semantic interoperability framework.
5
5
  Keywords: interoperability,semantic
6
6
  Author-email: Thomas Fjæstad Hagelien <thomas.f.hagelien@sintef.no>, Casper Welzel Andersen <casper.w.andersen@sintef.no>, Treesa Rose Joseph <treesa.joseph@sintef.no>
@@ -15,22 +15,22 @@ Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
16
  Classifier: Natural Language :: English
17
17
  Classifier: Operating System :: OS Independent
18
- Requires-Dist: httpx~=0.27.0
19
- Requires-Dist: oteapi-core>=0.7.0.dev2,<1
20
- Requires-Dist: otelib~=0.5.0.dev0
18
+ Requires-Dist: httpx~=0.27.2
19
+ Requires-Dist: oteapi-core>=0.7.0.dev6
20
+ Requires-Dist: otelib~=0.5.0.dev1
21
21
  Requires-Dist: pyyaml~=6.0
22
22
  Requires-Dist: typing-extensions~=4.12; python_version < '3.12'
23
- Requires-Dist: pre-commit~=3.7 ; extra == "dev"
24
- Requires-Dist: soft7[docs,graph,testing] ; extra == "dev"
23
+ Requires-Dist: pre-commit~=4.0 ; extra == "dev"
24
+ Requires-Dist: soft7[docs, graph, testing] ; extra == "dev"
25
25
  Requires-Dist: myst-nb~=1.1 ; extra == "docs"
26
- Requires-Dist: pydata-sphinx-theme~=0.15.2 ; extra == "docs"
27
- Requires-Dist: sphinx>=7.3,<9.0 ; extra == "docs"
26
+ Requires-Dist: pydata-sphinx-theme~=0.16.0 ; extra == "docs"
27
+ Requires-Dist: sphinx>=7.4.7,<9 ; extra == "docs"
28
28
  Requires-Dist: jinja2~=3.1 ; extra == "graph"
29
- Requires-Dist: rdflib~=7.0 ; extra == "graph"
29
+ Requires-Dist: rdflib~=7.1 ; extra == "graph"
30
30
  Requires-Dist: sparqlwrapper~=2.0 ; extra == "graph"
31
- Requires-Dist: pytest~=8.2 ; extra == "testing"
32
- Requires-Dist: pytest-cov~=5.0 ; extra == "testing"
33
- Requires-Dist: pytest-httpx~=0.30.0 ; extra == "testing"
31
+ Requires-Dist: pytest~=8.3 ; extra == "testing"
32
+ Requires-Dist: pytest-cov~=6.0 ; extra == "testing"
33
+ Requires-Dist: pytest-httpx~=0.34.0 ; extra == "testing"
34
34
  Requires-Dist: requests-mock~=1.12 ; extra == "testing"
35
35
  Requires-Dist: soft7[graph] ; extra == "testing"
36
36
  Project-URL: Changelog, https://github.com/SINTEF/soft7/blob/main/CHANGELOG.md
@@ -29,9 +29,9 @@ requires-python = "~=3.9"
29
29
  dynamic = ["version"]
30
30
 
31
31
  dependencies = [
32
- "httpx~=0.27.0",
33
- "oteapi-core>=0.7.0.dev2,<1",
34
- "otelib~=0.5.0.dev0",
32
+ "httpx~=0.27.2",
33
+ "oteapi-core>=0.7.0.dev6",
34
+ "otelib~=0.5.0.dev1",
35
35
  "pyyaml~=6.0",
36
36
  "typing-extensions~=4.12; python_version < '3.12'",
37
37
  ]
@@ -42,23 +42,23 @@ dependencies = [
42
42
  [project.optional-dependencies]
43
43
  docs = [
44
44
  "myst-nb~=1.1",
45
- "pydata-sphinx-theme~=0.15.2",
46
- "sphinx>=7.3,<9.0",
45
+ "pydata-sphinx-theme~=0.16.0",
46
+ "sphinx>=7.4.7,<9", # Allow v7 to support Python 3.9
47
47
  ]
48
48
  graph = [
49
49
  "jinja2~=3.1",
50
- "rdflib~=7.0",
50
+ "rdflib~=7.1",
51
51
  "sparqlwrapper~=2.0",
52
52
  ]
53
53
  testing = [
54
- "pytest~=8.2",
55
- "pytest-cov~=5.0",
56
- "pytest-httpx~=0.30.0",
54
+ "pytest~=8.3",
55
+ "pytest-cov~=6.0",
56
+ "pytest-httpx~=0.34.0",
57
57
  "requests-mock~=1.12",
58
58
  "soft7[graph]",
59
59
  ]
60
60
  dev = [
61
- "pre-commit~=3.7",
61
+ "pre-commit~=4.0",
62
62
  "soft7[docs,graph,testing]",
63
63
  ]
64
64
 
@@ -7,8 +7,8 @@ import logging
7
7
  from .pydantic_models.soft7_entity import SOFT7Entity, SOFT7EntityPropertyType
8
8
  from .pydantic_models.soft7_entity import parse_input_entity as get_entity
9
9
 
10
- __version__ = "0.2.0"
10
+ __version__ = "0.2.2"
11
11
 
12
- __all__ = ("__version__", "SOFT7Entity", "SOFT7EntityPropertyType", "get_entity")
12
+ __all__ = ("SOFT7Entity", "SOFT7EntityPropertyType", "__version__", "get_entity")
13
13
 
14
14
  logging.getLogger("s7").setLevel(logging.DEBUG)
@@ -150,7 +150,7 @@ def try_load_from_url(
150
150
  "assert_dict_exception_msg should be a string when assert_dict is True."
151
151
  )
152
152
 
153
- with httpx.Client(follow_redirects=True) as client:
153
+ with httpx.Client(follow_redirects=True, timeout=10) as client:
154
154
  try:
155
155
  response = client.get(
156
156
  str(source),
@@ -30,7 +30,6 @@ from pydantic.functional_validators import (
30
30
  model_validator,
31
31
  )
32
32
  from pydantic.networks import UrlConstraints
33
- from pydantic_core import Url
34
33
 
35
34
  from s7.exceptions import EntityNotFound
36
35
  from s7.pydantic_models._utils import (
@@ -50,7 +49,8 @@ if TYPE_CHECKING: # pragma: no cover
50
49
 
51
50
 
52
51
  SOFT7IdentityURIType = Annotated[
53
- Url, UrlConstraints(allowed_schemes=["http", "https", "file"], host_required=True)
52
+ AnyUrl,
53
+ UrlConstraints(allowed_schemes=["http", "https", "file"], host_required=True),
54
54
  ]
55
55
 
56
56
 
@@ -78,7 +78,7 @@ def SOFT7IdentityURI(url: str) -> SOFT7IdentityURIType:
78
78
  url = url.split("#", maxsplit=1)[0].split("?", maxsplit=1)[0]
79
79
  return SOFT7IdentityURIType(url)
80
80
 
81
- raise TypeError(f"Expected str or Url, got {type(url)}")
81
+ raise TypeError(f"Expected str or AnyUrl, got {type(url)}")
82
82
 
83
83
 
84
84
  SOFT7EntityPropertyType = Union[
@@ -60,26 +60,32 @@ class SOFT7EntityInstance(BaseModel):
60
60
  if entity_property_value.shape
61
61
  }
62
62
 
63
- dimensions = self.dimensions.model_copy() if self.dimensions else {}
64
- properties = self.properties.model_copy()
65
-
66
63
  for property_name, shape in shaped_properties.items():
67
- property_value = getattr(properties, property_name)
64
+ property_value = getattr(self.properties, property_name)
68
65
 
69
66
  # Let us ignore None valued properties
70
67
  if property_value is None:
71
68
  continue
72
69
 
73
70
  # Retrieve the dimension values for dimensions in the shape
74
- try:
75
- literal_dimensions = [
76
- getattr(dimensions, dimension_name) for dimension_name in shape
77
- ]
78
- except AttributeError as exc:
79
- raise ValueError(
80
- f"Property {property_name!r} is shaped, but not all the dimensions "
81
- "are defined"
82
- ) from exc
71
+ if self.dimensions is None:
72
+ if shape:
73
+ raise ValueError(
74
+ f"Property {property_name!r} is shaped, but no dimensions are "
75
+ "defined for the instance."
76
+ )
77
+ literal_dimensions = []
78
+ else:
79
+ try:
80
+ literal_dimensions = [
81
+ getattr(self.dimensions, dimension_name)
82
+ for dimension_name in shape
83
+ ]
84
+ except AttributeError as exc:
85
+ raise ValueError(
86
+ f"Property {property_name!r} is shaped, but not all the "
87
+ "dimensions are defined"
88
+ ) from exc
83
89
 
84
90
  if not all(isinstance(_, int) for _ in literal_dimensions):
85
91
  raise TypeError(
@@ -91,7 +97,7 @@ class SOFT7EntityInstance(BaseModel):
91
97
  literal_dimensions = cast(list[int], literal_dimensions)
92
98
 
93
99
  # Get the inner most (non-list) Python type/class
94
- property_type = properties.model_fields[property_name].annotation
100
+ property_type = self.properties.model_fields[property_name].annotation
95
101
 
96
102
  while True:
97
103
  _temp = property_type
@@ -20,6 +20,9 @@ if TYPE_CHECKING:
20
20
  from requests_mock import Mocker
21
21
 
22
22
 
23
+ pytestmark = pytest.mark.httpx_mock(can_send_already_matched_responses=True)
24
+
25
+
23
26
  def test_create_datasource(
24
27
  soft_entity_init: dict[str, str | dict],
25
28
  soft_datasource_init: dict[str, Any],
@@ -553,7 +556,7 @@ Attributes:
553
556
  "x-soft7-unit": "Å",
554
557
  },
555
558
  "soft7___dimensions": {
556
- "allOf": [{"$ref": "#/$defs/MolecularSpeciesDataSourceDimensions"}],
559
+ "$ref": "#/$defs/MolecularSpeciesDataSourceDimensions",
557
560
  "default": {"N": 5},
558
561
  },
559
562
  "soft7___identity": {
@@ -16,6 +16,8 @@ if TYPE_CHECKING:
16
16
  from s7.pydantic_models.soft7_entity import SOFT7Entity
17
17
  from s7.pydantic_models.soft7_instance import SOFT7EntityInstance
18
18
 
19
+ pytestmark = pytest.mark.httpx_mock(can_send_already_matched_responses=True)
20
+
19
21
 
20
22
  def test__flatten_mapping(httpx_mock: HTTPXMock, static_folder: Path) -> None:
21
23
  """Test the `_flatten_mapping()` method."""
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes