From 5f7f353968f24fb02e4a87506c68264ffa717177 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 4 Nov 2024 11:55:49 -0500 Subject: [PATCH 1/2] Drop 3.8 support (remove typing_extensions from depends) --- .github/workflows/lint.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/test-dandi-cli.yml | 7 +++---- .github/workflows/test-nonetwork.yml | 2 +- .github/workflows/test-schema.yml | 2 +- .github/workflows/test.yml | 2 +- .github/workflows/typing.yml | 2 +- dandischema/models.py | 16 ++++++++++++---- dandischema/types.py | 3 +-- setup.cfg | 4 +--- 10 files changed, 23 insertions(+), 19 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a0179600..1e0fc22a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: '3.9' - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6032e178..0a382606 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,7 +58,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: 3.9 - name: Install dandischema run: python -m pip install . diff --git a/.github/workflows/test-dandi-cli.yml b/.github/workflows/test-dandi-cli.yml index 98cfc82f..4605cd95 100644 --- a/.github/workflows/test-dandi-cli.yml +++ b/.github/workflows/test-dandi-cli.yml @@ -24,11 +24,10 @@ jobs: - macos-latest python: # Use the only Python which is ATM also used by dandi-api - # - 3.7 - # - 3.8 # - 3.9 # - '3.10' - '3.11' + # - '3.12' version: - master - release @@ -36,11 +35,11 @@ jobs: - normal include: - os: ubuntu-latest - python: 3.8 + python: 3.9 mode: dandi-devel version: master - os: ubuntu-latest - python: 3.8 + python: 3.9 mode: dandi-devel version: release exclude: diff --git a/.github/workflows/test-nonetwork.yml b/.github/workflows/test-nonetwork.yml index 9c50916d..9abc4b18 100644 --- a/.github/workflows/test-nonetwork.yml +++ b/.github/workflows/test-nonetwork.yml @@ -19,7 +19,7 @@ jobs: - ubuntu-latest - macos-12 python: - - 3.8 + - 3.9 - 3.9 - '3.10' - '3.11' diff --git a/.github/workflows/test-schema.yml b/.github/workflows/test-schema.yml index ff36f397..c4c1c688 100644 --- a/.github/workflows/test-schema.yml +++ b/.github/workflows/test-schema.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: '3.9' - name: Install dandischema run: python -m pip install . diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fcc744f4..90493f2e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,7 @@ jobs: - ubuntu-latest - macos-12 python: - - 3.8 + - 3.9 - 3.9 - '3.10' - '3.11' diff --git a/.github/workflows/typing.yml b/.github/workflows/typing.yml index c01c56cb..dd8a09e5 100644 --- a/.github/workflows/typing.yml +++ b/.github/workflows/typing.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: '3.9' - name: Install dependencies run: | diff --git a/dandischema/models.py b/dandischema/models.py index 20af6198..57aa7628 100644 --- a/dandischema/models.py +++ b/dandischema/models.py @@ -4,7 +4,18 @@ from enum import Enum import os import re -from typing import Any, Dict, List, Literal, Optional, Sequence, Type, TypeVar, Union +from typing import ( + Annotated, + Any, + Dict, + List, + Literal, + Optional, + Sequence, + Type, + TypeVar, + Union, +) from warnings import warn from pydantic import ( @@ -23,9 +34,6 @@ ) from pydantic.json_schema import JsonSchemaValue from pydantic_core import CoreSchema -from typing_extensions import ( - Annotated, # TODO: import from `typing` when Python 3.8 support is dropped -) from zarr_checksum.checksum import InvalidZarrChecksum, ZarrDirectoryDigest from .consts import DANDI_SCHEMA_VERSION diff --git a/dandischema/types.py b/dandischema/types.py index 1f2eb488..555793e3 100644 --- a/dandischema/types.py +++ b/dandischema/types.py @@ -1,12 +1,11 @@ # This file is for defining types that extend existing types through the use of # `typing.Annotated`. -from typing import Type +from typing import Annotated, Type from pydantic import ByteSize, GetCoreSchemaHandler, GetJsonSchemaHandler from pydantic.json_schema import JsonSchemaValue from pydantic_core import CoreSchema, core_schema -from typing_extensions import Annotated class _ByteSizeJsonSchemaAnnotation: diff --git a/setup.cfg b/setup.cfg index 9ccdf350..dcaab7bf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -12,7 +12,6 @@ classifiers = License :: OSI Approved :: Apache Software License Operating System :: OS Independent Programming Language :: Python - Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 @@ -27,12 +26,11 @@ project_urls = Source Code = https://github.com/dandi/dandischema [options] -python_requires = >=3.8 +python_requires = >=3.9 install_requires = jsonschema[format] pydantic[email] ~= 2.4 requests - typing_extensions; python_version < "3.9" zarr_checksum zip_safe = False packages = find_namespace: From eaa32d2f285371984d3e44b32f46ce12b1659b78 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 4 Nov 2024 15:44:58 -0500 Subject: [PATCH 2/2] BF: removing duplicated 3.9 and jumping to macos-latest before we went for -12 since needed 3.8. Let's see if would work for 3.9 --- .github/workflows/test-nonetwork.yml | 3 +-- .github/workflows/test.yml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-nonetwork.yml b/.github/workflows/test-nonetwork.yml index 9abc4b18..2f2302b4 100644 --- a/.github/workflows/test-nonetwork.yml +++ b/.github/workflows/test-nonetwork.yml @@ -17,9 +17,8 @@ jobs: os: - windows-2019 - ubuntu-latest - - macos-12 + - macos-latest python: - - 3.9 - 3.9 - '3.10' - '3.11' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 90493f2e..cdf236a0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,9 +18,8 @@ jobs: os: - windows-2019 - ubuntu-latest - - macos-12 + - macos-latest python: - - 3.9 - 3.9 - '3.10' - '3.11'