From da06215138f2ff024ca7f5ca4e8dc3cff99ccc28 Mon Sep 17 00:00:00 2001 From: Jean SIMARD Date: Fri, 7 Feb 2025 15:01:02 +0100 Subject: [PATCH] osrd_schemas: move to 'poetry:2.0' Signed-off-by: Jean SIMARD --- .github/workflows/build.yml | 6 +- front/src/reducers/osrdconf/infra_schema.json | 55 ++++--------------- python/osrd_schemas/.python-version | 1 - python/osrd_schemas/osrd_schemas/infra.py | 2 +- python/osrd_schemas/poetry.lock | 28 +++++++--- python/osrd_schemas/pyproject.toml | 21 ++----- 6 files changed, 41 insertions(+), 72 deletions(-) delete mode 100644 python/osrd_schemas/.python-version diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e35f2b3d982..1aa749accc1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -385,7 +385,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install poetry - run: pipx install 'poetry<2.0' + run: pipx install poetry - name: Set up Python uses: actions/setup-python@v5 with: @@ -394,7 +394,7 @@ jobs: - name: Install dependencies run: | cd python/osrd_schemas - poetry install + poetry install --extras=dev - name: Ruff run: | cd python/osrd_schemas @@ -426,7 +426,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: Install poetry - run: pipx install 'poetry<2.0' + run: pipx install poetry - uses: actions/setup-python@v5 with: python-version: "3.11" diff --git a/front/src/reducers/osrdconf/infra_schema.json b/front/src/reducers/osrdconf/infra_schema.json index 9e1537d5b78..0bccec38126 100644 --- a/front/src/reducers/osrdconf/infra_schema.json +++ b/front/src/reducers/osrdconf/infra_schema.json @@ -187,12 +187,9 @@ "BufferStopExtensions": { "properties": { "sncf": { - "anyOf": [ + "allOf": [ { "$ref": "#/$defs/BufferStopSncfExtension" - }, - { - "type": "null" } ], "default": null @@ -334,12 +331,9 @@ "DetectorExtensions": { "properties": { "sncf": { - "anyOf": [ + "allOf": [ { "$ref": "#/$defs/DetectorSncfExtension" - }, - { - "type": "null" } ], "default": null @@ -818,12 +812,9 @@ "NeutralSectionExtensions": { "properties": { "neutral_sncf": { - "anyOf": [ + "allOf": [ { "$ref": "#/$defs/NeutralSectionNeutralSncfExtension" - }, - { - "type": "null" } ], "default": null @@ -926,23 +917,17 @@ "OperationalPointExtensions": { "properties": { "identifier": { - "anyOf": [ + "allOf": [ { "$ref": "#/$defs/OperationalPointIdentifierExtension" - }, - { - "type": "null" } ], "default": null }, "sncf": { - "anyOf": [ + "allOf": [ { "$ref": "#/$defs/OperationalPointSncfExtension" - }, - { - "type": "null" } ], "default": null @@ -1007,12 +992,9 @@ "OperationalPointPartExtensions": { "properties": { "sncf": { - "anyOf": [ + "allOf": [ { "$ref": "#/$defs/OperationalPointPartSncfExtension" - }, - { - "type": "null" } ], "default": null @@ -1303,12 +1285,9 @@ "SignalExtensions": { "properties": { "sncf": { - "anyOf": [ + "allOf": [ { "$ref": "#/$defs/SignalSncfExtension" - }, - { - "type": "null" } ], "default": null @@ -1463,12 +1442,9 @@ "SpeedSectionExtensions": { "properties": { "psl_sncf": { - "anyOf": [ + "allOf": [ { "$ref": "#/$defs/SpeedSectionPslSncfExtension" - }, - { - "type": "null" } ], "default": null @@ -1564,12 +1540,9 @@ "SwitchExtensions": { "properties": { "sncf": { - "anyOf": [ + "allOf": [ { "$ref": "#/$defs/SwitchSncfExtension" - }, - { - "type": "null" } ], "default": null @@ -1755,23 +1728,17 @@ "TrackSectionExtensions": { "properties": { "sncf": { - "anyOf": [ + "allOf": [ { "$ref": "#/$defs/TrackSectionSncfExtension" - }, - { - "type": "null" } ], "default": null }, "source": { - "anyOf": [ + "allOf": [ { "$ref": "#/$defs/TrackSectionSourceExtension" - }, - { - "type": "null" } ], "default": null diff --git a/python/osrd_schemas/.python-version b/python/osrd_schemas/.python-version deleted file mode 100644 index bd28b9c5c27..00000000000 --- a/python/osrd_schemas/.python-version +++ /dev/null @@ -1 +0,0 @@ -3.9 diff --git a/python/osrd_schemas/osrd_schemas/infra.py b/python/osrd_schemas/osrd_schemas/infra.py index 2989d6d9561..1622a1c3256 100755 --- a/python/osrd_schemas/osrd_schemas/infra.py +++ b/python/osrd_schemas/osrd_schemas/infra.py @@ -638,7 +638,7 @@ def register_extension(extension): ) extensions_field.annotation.model_fields[name] = FieldInfo( - annotation=Optional[extension], + annotation=extension, default=None, ) return extension diff --git a/python/osrd_schemas/poetry.lock b/python/osrd_schemas/poetry.lock index b62c2758f2f..6ac21221983 100644 --- a/python/osrd_schemas/poetry.lock +++ b/python/osrd_schemas/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.0 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.0.1 and should not be changed by hand. [[package]] name = "annotated-types" @@ -6,6 +6,7 @@ version = "0.6.0" description = "Reusable constraint types to use with typing.Annotated" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "annotated_types-0.6.0-py3-none-any.whl", hash = "sha256:0641064de18ba7a25dee8f96403ebc39113d0cb953a01429249d5c7564666a43"}, {file = "annotated_types-0.6.0.tar.gz", hash = "sha256:563339e807e53ffd9c267e99fc6d9ea23eb8443c08f112651963e24e22f84a5d"}, @@ -17,6 +18,7 @@ version = "1.0.2" description = "Pydantic data models for the GeoJSON spec." optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "geojson_pydantic-1.0.2-py3-none-any.whl", hash = "sha256:d7a7f8ff4ca27298f62d1af182f69ec85f9990b9db80fa7e0161be1de2a9ae0f"}, {file = "geojson_pydantic-1.0.2.tar.gz", hash = "sha256:3179d665ad8763670681b73aded2228df20a1164951e9d7075be8f370eb681f4"}, @@ -34,8 +36,10 @@ test = ["pytest", "pytest-cov", "shapely"] name = "nodeenv" version = "1.9.1" description = "Node.js virtual environment builder" -optional = false +optional = true python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +groups = ["main"] +markers = "extra == \"dev\"" files = [ {file = "nodeenv-1.9.1-py2.py3-none-any.whl", hash = "sha256:ba11c9782d29c27c70ffbdda2d7415098754709be8a7056d79a737cd901155c9"}, {file = "nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f"}, @@ -47,6 +51,7 @@ version = "2.6.3" description = "Data validation using Python type hints" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "pydantic-2.6.3-py3-none-any.whl", hash = "sha256:72c6034df47f46ccdf81869fddb81aade68056003900a8724a4f160700016a2a"}, {file = "pydantic-2.6.3.tar.gz", hash = "sha256:e07805c4c7f5c6826e33a1d4c9d47950d7eaf34868e2690f8594d2e30241f11f"}, @@ -66,6 +71,7 @@ version = "2.16.3" description = "" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "pydantic_core-2.16.3-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:75b81e678d1c1ede0785c7f46690621e4c6e63ccd9192af1f0bd9d504bbb6bf4"}, {file = "pydantic_core-2.16.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9c865a7ee6f93783bd5d781af5a4c43dadc37053a5b42f7d18dc019f8c9d2bd1"}, @@ -155,8 +161,10 @@ typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" name = "pyright" version = "1.1.393" description = "Command line wrapper for pyright" -optional = false +optional = true python-versions = ">=3.7" +groups = ["main"] +markers = "extra == \"dev\"" files = [ {file = "pyright-1.1.393-py3-none-any.whl", hash = "sha256:8320629bb7a44ca90944ba599390162bf59307f3d9fb6e27da3b7011b8c17ae5"}, {file = "pyright-1.1.393.tar.gz", hash = "sha256:aeeb7ff4e0364775ef416a80111613f91a05c8e01e58ecfefc370ca0db7aed9c"}, @@ -175,8 +183,10 @@ nodejs = ["nodejs-wheel-binaries"] name = "ruff" version = "0.9.5" description = "An extremely fast Python linter and code formatter, written in Rust." -optional = false +optional = true python-versions = ">=3.7" +groups = ["main"] +markers = "extra == \"dev\"" files = [ {file = "ruff-0.9.5-py3-none-linux_armv6l.whl", hash = "sha256:d466d2abc05f39018d53f681fa1c0ffe9570e6d73cde1b65d23bb557c846f442"}, {file = "ruff-0.9.5-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:38840dbcef63948657fa7605ca363194d2fe8c26ce8f9ae12eee7f098c85ac8a"}, @@ -204,12 +214,16 @@ version = "4.10.0" description = "Backported and Experimental Type Hints for Python 3.8+" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "typing_extensions-4.10.0-py3-none-any.whl", hash = "sha256:69b1a937c3a517342112fb4c6df7e72fc39a38e7891a5730ed4985b5214b5475"}, {file = "typing_extensions-4.10.0.tar.gz", hash = "sha256:b0abd7c89e8fb96f98db18d86106ff1d90ab692004eb746cf6eda2682f91b3cb"}, ] +[extras] +dev = ["pyright", "ruff"] + [metadata] -lock-version = "2.0" -python-versions = ">=3.9,<3.12" -content-hash = "1ad47dd722ea609beec4b81356e2cddedd0016fa872ced1e6359d232933e8ef8" +lock-version = "2.1" +python-versions = ">= 3.11" +content-hash = "dfc2e0df47630c6c72739910a1ead7cf9f4768091a2e5d800b3e7e7dd10949f2" diff --git a/python/osrd_schemas/pyproject.toml b/python/osrd_schemas/pyproject.toml index 3fa9757931b..e0be8ae76d3 100644 --- a/python/osrd_schemas/pyproject.toml +++ b/python/osrd_schemas/pyproject.toml @@ -1,22 +1,11 @@ [project] name = "osrd_schemas" version = "0.8.16" - -[tool.poetry] -name = "osrd_schemas" -version = "0.8.16" description = "" -authors = ["OSRD "] - -[tool.poetry.dependencies] -geojson-pydantic = "^1.0.0" -pydantic = "^2.1.1" -python = ">=3.9,<3.12" +authors = [{ name = "OSRD Contributors", email = "contact@osrd.fr" }] +requires-python = ">= 3.11" -[tool.poetry.group.dev.dependencies] -ruff = "0.9.5" -pyright = "1.1.393" +dependencies = ["geojson-pydantic ~= 1.0.0", "pydantic ~= 2.6"] -[build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" +[project.optional-dependencies] +dev = ["pyright ~= 1.1.393", "ruff ~= 0.9.5"]