From a8cd7de732c077d91441d92732800773a8eefdf7 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Tue, 6 Jan 2026 14:26:26 -0800 Subject: [PATCH] Remove forced conversion of annotations to strings `from __future__ import annotations` is being deprecated in Python. Remove it from the FastAPI Safir app template and the SQuaRE PyPI project template. --- .../fastapi_safir_app/example-uws/src/exampleuws/config.py | 2 -- .../fastapi_safir_app/example-uws/src/exampleuws/domain.py | 2 -- .../example-uws/src/exampleuws/workers/exampleuws.py | 2 -- .../fastapi_safir_app/example-uws/src/exampleuws/workers/uws.py | 2 -- .../fastapi_safir_app/example-uws/tests/conftest.py | 2 -- .../example-uws/tests/handlers/external_test.py | 2 -- .../example-uws/tests/handlers/internal_test.py | 2 -- .../fastapi_safir_app/example/src/example/config.py | 2 -- project_templates/fastapi_safir_app/example/tests/conftest.py | 2 -- .../fastapi_safir_app/example/tests/handlers/external_test.py | 2 -- .../fastapi_safir_app/example/tests/handlers/internal_test.py | 2 -- .../src/{{cookiecutter.module_name}}/config.py | 2 -- .../src/{{cookiecutter.module_name}}/domain.py | 2 -- .../src/{{cookiecutter.module_name}}/workers/uws.py | 2 -- .../workers/{{cookiecutter.module_name}}.py | 2 -- .../fastapi_safir_app/{{cookiecutter.name}}/tests/conftest.py | 2 -- .../{{cookiecutter.name}}/tests/handlers/external_test.py | 2 -- .../{{cookiecutter.name}}/tests/handlers/internal_test.py | 2 -- .../square_pypi_package/example/tests/version_test.py | 2 -- .../{{cookiecutter.name}}/tests/version_test.py | 2 -- project_templates/technote_md/testn-000/technote.toml | 2 +- project_templates/technote_rst/testn-000/technote.toml | 2 +- 22 files changed, 2 insertions(+), 42 deletions(-) diff --git a/project_templates/fastapi_safir_app/example-uws/src/exampleuws/config.py b/project_templates/fastapi_safir_app/example-uws/src/exampleuws/config.py index 258ea29a..cf1f051b 100644 --- a/project_templates/fastapi_safir_app/example-uws/src/exampleuws/config.py +++ b/project_templates/fastapi_safir_app/example-uws/src/exampleuws/config.py @@ -1,7 +1,5 @@ """Configuration definition.""" -from __future__ import annotations - from pydantic import Field, SecretStr from pydantic_settings import SettingsConfigDict from safir.logging import LogLevel, Profile diff --git a/project_templates/fastapi_safir_app/example-uws/src/exampleuws/domain.py b/project_templates/fastapi_safir_app/example-uws/src/exampleuws/domain.py index c128ed3d..c83598d0 100644 --- a/project_templates/fastapi_safir_app/example-uws/src/exampleuws/domain.py +++ b/project_templates/fastapi_safir_app/example-uws/src/exampleuws/domain.py @@ -1,7 +1,5 @@ """Domain models for example-uws.""" -from __future__ import annotations - from pydantic import BaseModel __all__ = ["WorkerExampleuwsModel"] diff --git a/project_templates/fastapi_safir_app/example-uws/src/exampleuws/workers/exampleuws.py b/project_templates/fastapi_safir_app/example-uws/src/exampleuws/workers/exampleuws.py index 02a36753..20b200d9 100644 --- a/project_templates/fastapi_safir_app/example-uws/src/exampleuws/workers/exampleuws.py +++ b/project_templates/fastapi_safir_app/example-uws/src/exampleuws/workers/exampleuws.py @@ -4,8 +4,6 @@ the arq worker definition. Only this module is allowed to use stack packages. """ -from __future__ import annotations - import os from datetime import timedelta diff --git a/project_templates/fastapi_safir_app/example-uws/src/exampleuws/workers/uws.py b/project_templates/fastapi_safir_app/example-uws/src/exampleuws/workers/uws.py index 3552be45..ae91a092 100644 --- a/project_templates/fastapi_safir_app/example-uws/src/exampleuws/workers/uws.py +++ b/project_templates/fastapi_safir_app/example-uws/src/exampleuws/workers/uws.py @@ -1,7 +1,5 @@ """Worker for UWS database updates.""" -from __future__ import annotations - import structlog from safir.logging import configure_logging diff --git a/project_templates/fastapi_safir_app/example-uws/tests/conftest.py b/project_templates/fastapi_safir_app/example-uws/tests/conftest.py index 5da161b6..6a194f2a 100644 --- a/project_templates/fastapi_safir_app/example-uws/tests/conftest.py +++ b/project_templates/fastapi_safir_app/example-uws/tests/conftest.py @@ -1,7 +1,5 @@ """Test fixtures for example-uws tests.""" -from __future__ import annotations - from collections.abc import AsyncGenerator, Iterator from datetime import timedelta diff --git a/project_templates/fastapi_safir_app/example-uws/tests/handlers/external_test.py b/project_templates/fastapi_safir_app/example-uws/tests/handlers/external_test.py index af1b2d26..c4f49b44 100644 --- a/project_templates/fastapi_safir_app/example-uws/tests/handlers/external_test.py +++ b/project_templates/fastapi_safir_app/example-uws/tests/handlers/external_test.py @@ -1,7 +1,5 @@ """Tests for the exampleuws.handlers.external module and routes.""" -from __future__ import annotations - import pytest from httpx import AsyncClient diff --git a/project_templates/fastapi_safir_app/example-uws/tests/handlers/internal_test.py b/project_templates/fastapi_safir_app/example-uws/tests/handlers/internal_test.py index 85bfd89d..d50e7bbe 100644 --- a/project_templates/fastapi_safir_app/example-uws/tests/handlers/internal_test.py +++ b/project_templates/fastapi_safir_app/example-uws/tests/handlers/internal_test.py @@ -1,7 +1,5 @@ """Tests for the exampleuws.handlers.internal module and routes.""" -from __future__ import annotations - import pytest from httpx import AsyncClient diff --git a/project_templates/fastapi_safir_app/example/src/example/config.py b/project_templates/fastapi_safir_app/example/src/example/config.py index 95a6b803..f201adab 100644 --- a/project_templates/fastapi_safir_app/example/src/example/config.py +++ b/project_templates/fastapi_safir_app/example/src/example/config.py @@ -1,7 +1,5 @@ """Configuration definition.""" -from __future__ import annotations - from pydantic import Field, SecretStr from pydantic_settings import BaseSettings, SettingsConfigDict from safir.logging import LogLevel, Profile diff --git a/project_templates/fastapi_safir_app/example/tests/conftest.py b/project_templates/fastapi_safir_app/example/tests/conftest.py index 149304cf..412b21da 100644 --- a/project_templates/fastapi_safir_app/example/tests/conftest.py +++ b/project_templates/fastapi_safir_app/example/tests/conftest.py @@ -1,7 +1,5 @@ """Test fixtures for example tests.""" -from __future__ import annotations - from collections.abc import AsyncGenerator import pytest_asyncio diff --git a/project_templates/fastapi_safir_app/example/tests/handlers/external_test.py b/project_templates/fastapi_safir_app/example/tests/handlers/external_test.py index 10e90eeb..f53cd4f2 100644 --- a/project_templates/fastapi_safir_app/example/tests/handlers/external_test.py +++ b/project_templates/fastapi_safir_app/example/tests/handlers/external_test.py @@ -1,7 +1,5 @@ """Tests for the example.handlers.external module and routes.""" -from __future__ import annotations - import pytest from httpx import AsyncClient diff --git a/project_templates/fastapi_safir_app/example/tests/handlers/internal_test.py b/project_templates/fastapi_safir_app/example/tests/handlers/internal_test.py index d71f67b6..19205536 100644 --- a/project_templates/fastapi_safir_app/example/tests/handlers/internal_test.py +++ b/project_templates/fastapi_safir_app/example/tests/handlers/internal_test.py @@ -1,7 +1,5 @@ """Tests for the example.handlers.internal module and routes.""" -from __future__ import annotations - import pytest from httpx import AsyncClient diff --git a/project_templates/fastapi_safir_app/{{cookiecutter.name}}/src/{{cookiecutter.module_name}}/config.py b/project_templates/fastapi_safir_app/{{cookiecutter.name}}/src/{{cookiecutter.module_name}}/config.py index 67d2ff22..6f31eff5 100644 --- a/project_templates/fastapi_safir_app/{{cookiecutter.name}}/src/{{cookiecutter.module_name}}/config.py +++ b/project_templates/fastapi_safir_app/{{cookiecutter.name}}/src/{{cookiecutter.module_name}}/config.py @@ -1,7 +1,5 @@ """Configuration definition.""" -from __future__ import annotations - from pydantic import Field, SecretStr from pydantic_settings import {% if cookiecutter.flavor != "UWS" %}BaseSettings, {% endif %}SettingsConfigDict from safir.logging import LogLevel, Profile diff --git a/project_templates/fastapi_safir_app/{{cookiecutter.name}}/src/{{cookiecutter.module_name}}/domain.py b/project_templates/fastapi_safir_app/{{cookiecutter.name}}/src/{{cookiecutter.module_name}}/domain.py index f1af6868..406a96c4 100644 --- a/project_templates/fastapi_safir_app/{{cookiecutter.name}}/src/{{cookiecutter.module_name}}/domain.py +++ b/project_templates/fastapi_safir_app/{{cookiecutter.name}}/src/{{cookiecutter.module_name}}/domain.py @@ -1,8 +1,6 @@ {%- if cookiecutter.flavor == "UWS" -%} """Domain models for {{ cookiecutter.name }}.""" -from __future__ import annotations - from pydantic import BaseModel __all__ = ["Worker{{ cookiecutter.module_name | capitalize }}Model"] diff --git a/project_templates/fastapi_safir_app/{{cookiecutter.name}}/src/{{cookiecutter.module_name}}/workers/uws.py b/project_templates/fastapi_safir_app/{{cookiecutter.name}}/src/{{cookiecutter.module_name}}/workers/uws.py index d709b9f1..519dcf70 100644 --- a/project_templates/fastapi_safir_app/{{cookiecutter.name}}/src/{{cookiecutter.module_name}}/workers/uws.py +++ b/project_templates/fastapi_safir_app/{{cookiecutter.name}}/src/{{cookiecutter.module_name}}/workers/uws.py @@ -1,8 +1,6 @@ {%- if cookiecutter.flavor == "UWS" -%} """Worker for UWS database updates.""" -from __future__ import annotations - import structlog from safir.logging import configure_logging diff --git a/project_templates/fastapi_safir_app/{{cookiecutter.name}}/src/{{cookiecutter.module_name}}/workers/{{cookiecutter.module_name}}.py b/project_templates/fastapi_safir_app/{{cookiecutter.name}}/src/{{cookiecutter.module_name}}/workers/{{cookiecutter.module_name}}.py index f07def56..e45371ec 100644 --- a/project_templates/fastapi_safir_app/{{cookiecutter.name}}/src/{{cookiecutter.module_name}}/workers/{{cookiecutter.module_name}}.py +++ b/project_templates/fastapi_safir_app/{{cookiecutter.name}}/src/{{cookiecutter.module_name}}/workers/{{cookiecutter.module_name}}.py @@ -5,8 +5,6 @@ the arq worker definition. Only this module is allowed to use stack packages. """ -from __future__ import annotations - import os from datetime import timedelta diff --git a/project_templates/fastapi_safir_app/{{cookiecutter.name}}/tests/conftest.py b/project_templates/fastapi_safir_app/{{cookiecutter.name}}/tests/conftest.py index 8610f68e..7e6066b3 100644 --- a/project_templates/fastapi_safir_app/{{cookiecutter.name}}/tests/conftest.py +++ b/project_templates/fastapi_safir_app/{{cookiecutter.name}}/tests/conftest.py @@ -1,7 +1,5 @@ """Test fixtures for {{ cookiecutter.name }} tests.""" -from __future__ import annotations - from collections.abc import AsyncGenerator{% if cookiecutter.flavor == "UWS" %}, Iterator from datetime import timedelta {%- endif %} diff --git a/project_templates/fastapi_safir_app/{{cookiecutter.name}}/tests/handlers/external_test.py b/project_templates/fastapi_safir_app/{{cookiecutter.name}}/tests/handlers/external_test.py index ec6bf901..5066c6d1 100644 --- a/project_templates/fastapi_safir_app/{{cookiecutter.name}}/tests/handlers/external_test.py +++ b/project_templates/fastapi_safir_app/{{cookiecutter.name}}/tests/handlers/external_test.py @@ -1,7 +1,5 @@ """Tests for the {{ cookiecutter.module_name }}.handlers.external module and routes.""" -from __future__ import annotations - import pytest from httpx import AsyncClient diff --git a/project_templates/fastapi_safir_app/{{cookiecutter.name}}/tests/handlers/internal_test.py b/project_templates/fastapi_safir_app/{{cookiecutter.name}}/tests/handlers/internal_test.py index cf7ff18c..1a82dcf4 100644 --- a/project_templates/fastapi_safir_app/{{cookiecutter.name}}/tests/handlers/internal_test.py +++ b/project_templates/fastapi_safir_app/{{cookiecutter.name}}/tests/handlers/internal_test.py @@ -1,7 +1,5 @@ """Tests for the {{ cookiecutter.module_name }}.handlers.internal module and routes.""" -from __future__ import annotations - import pytest from httpx import AsyncClient diff --git a/project_templates/square_pypi_package/example/tests/version_test.py b/project_templates/square_pypi_package/example/tests/version_test.py index 3da5ccda..b089b7ee 100644 --- a/project_templates/square_pypi_package/example/tests/version_test.py +++ b/project_templates/square_pypi_package/example/tests/version_test.py @@ -1,7 +1,5 @@ """Test the packaging.""" -from __future__ import annotations - from example import __version__ diff --git a/project_templates/square_pypi_package/{{cookiecutter.name}}/tests/version_test.py b/project_templates/square_pypi_package/{{cookiecutter.name}}/tests/version_test.py index 7709f9fb..a734594e 100644 --- a/project_templates/square_pypi_package/{{cookiecutter.name}}/tests/version_test.py +++ b/project_templates/square_pypi_package/{{cookiecutter.name}}/tests/version_test.py @@ -1,7 +1,5 @@ """Test the packaging.""" -from __future__ import annotations - from {{cookiecutter.module_name}} import __version__ diff --git a/project_templates/technote_md/testn-000/technote.toml b/project_templates/technote_md/testn-000/technote.toml index 3ba6252c..8b5737c0 100644 --- a/project_templates/technote_md/testn-000/technote.toml +++ b/project_templates/technote_md/testn-000/technote.toml @@ -4,7 +4,7 @@ series_id = "TESTN" canonical_url = "https://testn-000.lsst.io" github_url = "https://github.com/lsst/testn-000" github_default_branch = "main" -date_created = 2026-01-05T23:56:12Z +date_created = 2026-01-06T22:26:18Z organization.name = "NSF-DOE Vera C. Rubin Observatory" organization.ror = "https://ror.org/048g3cy84" license.id = "CC-BY-4.0" diff --git a/project_templates/technote_rst/testn-000/technote.toml b/project_templates/technote_rst/testn-000/technote.toml index e7ff4756..a46a329b 100644 --- a/project_templates/technote_rst/testn-000/technote.toml +++ b/project_templates/technote_rst/testn-000/technote.toml @@ -4,7 +4,7 @@ series_id = "TESTN" canonical_url = "https://testn-000.lsst.io" github_url = "https://github.com/lsst/testn-000" github_default_branch = "main" -date_created = 2026-01-05T23:56:12Z +date_created = 2026-01-06T22:26:18Z organization.name = "NSF-DOE Vera C. Rubin Observatory" organization.ror = "https://ror.org/048g3cy84" license.id = "CC-BY-4.0"