From 8133df220641864a3cc085d631ece336c0db66f9 Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Tue, 26 Nov 2024 11:44:39 -0500 Subject: [PATCH 1/5] Bump min Python to 3.11 per SPEC 0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5a80d32a..09c61d50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "roman_datamodels" description = "data models supporting calibration of the Nancy Grace Roman Space Telescope" readme = "README.md" -requires-python = ">=3.10" +requires-python = ">=3.11" authors = [{ name = "STScI", email = "help@stsci.edu" }] classifiers = [ "Intended Audience :: Science/Research", From 8b728f2ae3ed42348c79a628b35cfce5af25838e Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Tue, 26 Nov 2024 11:45:53 -0500 Subject: [PATCH 2/5] Update CI --- .github/workflows/ci.yml | 5 ++--- .github/workflows/ci_cron.yml | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e0de5af..74d5ba18 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,15 +20,14 @@ jobs: uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@d68193b68216da64eafaa618f53c59f5d271c56e # v1.14.0 with: envs: | - - linux: py310-oldestdeps-cov + - linux: py311-oldestdeps-cov coverage: codecov - - linux: py310 - linux: py311-cov coverage: codecov - linux: py312-withromancal-cov coverage: codecov - linux: py313 - - macos: py311 + - macos: py312 test_upstream: uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@d68193b68216da64eafaa618f53c59f5d271c56e # v1.14.0 with: diff --git a/.github/workflows/ci_cron.yml b/.github/workflows/ci_cron.yml index 83722064..589b64c1 100644 --- a/.github/workflows/ci_cron.yml +++ b/.github/workflows/ci_cron.yml @@ -20,5 +20,5 @@ jobs: if: (github.repository == 'spacetelescope/roman_datamodels' && (github.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'Weekly CI'))) with: envs: | - - macos: py310 - - linux: py312-devdeps + - macos: py311 + - linux: py313-devdeps From 59cc18645d0f9783f192996a93dec4ad4ce5e535 Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Tue, 26 Nov 2024 11:47:39 -0500 Subject: [PATCH 3/5] Update changes --- changes/432.misc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/432.misc.rst diff --git a/changes/432.misc.rst b/changes/432.misc.rst new file mode 100644 index 00000000..f8d88ca1 --- /dev/null +++ b/changes/432.misc.rst @@ -0,0 +1 @@ +Bump min Python version to 3.11 per SPEC 0. From 2af68c2740f679aecb50fac491f8107557b76623 Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Tue, 26 Nov 2024 16:18:47 -0500 Subject: [PATCH 4/5] Minor clenup to pyproject.toml (the aws optional dep made no sense) --- pyproject.toml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 09c61d50..6311d2a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,9 @@ name = "roman_datamodels" description = "data models supporting calibration of the Nancy Grace Roman Space Telescope" readme = "README.md" requires-python = ">=3.11" -authors = [{ name = "STScI", email = "help@stsci.edu" }] +authors = [ + { name = "STScI", email = "help@stsci.edu" }, +] classifiers = [ "Intended Audience :: Science/Research", "Topic :: Scientific/Engineering :: Astronomy", @@ -32,7 +34,6 @@ test = [ "pytest-doctestplus >=1.2.1", "pytest-env >= 0.8", ] -aws = ["stsci-aws-utils >= 0.1.2"] docs = [ "sphinx", "sphinx-automodapi", @@ -49,7 +50,10 @@ repository = "https://github.com/spacetelescope/roman_datamodels" roman_datamodels = "roman_datamodels.stnode._integration:get_extensions" [build-system] -requires = ["setuptools >=61", "setuptools_scm[toml] >=3.4", "wheel"] +requires = [ + "setuptools >=61", + "setuptools_scm[toml] >=3.4", +] build-backend = "setuptools.build_meta" [tool.setuptools_scm] From 4f970ebde713f53e6fc8d1d6294bc1a4ac95e027 Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Wed, 27 Nov 2024 13:37:07 -0500 Subject: [PATCH 5/5] Run pyupgrade to remove <3.11 stuff --- docs/conf.py | 7 +------ pyproject.toml | 1 - src/roman_datamodels/dqflags.py | 16 ++++------------ tests/test_dqflags.py | 11 ++--------- 4 files changed, 7 insertions(+), 28 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 1b5b7852..408791d9 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -14,17 +14,12 @@ import importlib import os import sys +import tomllib from distutils.version import LooseVersion from pathlib import Path import sphinx -if sys.version_info < (3, 11): - import tomli as tomllib -else: - import tomllib - - # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. diff --git a/pyproject.toml b/pyproject.toml index 6311d2a0..c184fbd9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,6 @@ docs = [ "sphinx-automodapi", "sphinx-rtd-theme", "sphinx-astropy", - "tomli; python_version <\"3.11\"", ] [project.urls] diff --git a/src/roman_datamodels/dqflags.py b/src/roman_datamodels/dqflags.py index 061031ad..205d4841 100644 --- a/src/roman_datamodels/dqflags.py +++ b/src/roman_datamodels/dqflags.py @@ -19,24 +19,16 @@ the formula `2**bit_number` where `bit_number` is the 0-index bit of interest. """ -import sys -from enum import unique - # Something with pickling of multiclassed enums was changed in 3.11 + allowing # us to directly us `np.uint32` as the enum object rather than a python `int`. -if sys.version_info < (3, 11): - from enum import IntEnum -else: - from enum import Enum - - import numpy as np +from enum import Enum, unique - class IntEnum(np.uint32, Enum): ... +import numpy as np # fmt: off @unique -class pixel(IntEnum): +class pixel(np.uint32, Enum): """Pixel-specific data quality flags""" GOOD = 0 # No bits set, all is good @@ -74,7 +66,7 @@ class pixel(IntEnum): @unique -class group(IntEnum): +class group(np.uint32, Enum): """Group-specific data quality flags Once groups are combined, these flags are equivalent to the pixel-specific flags. """ diff --git a/tests/test_dqflags.py b/tests/test_dqflags.py index 02bab7eb..27694a0a 100644 --- a/tests/test_dqflags.py +++ b/tests/test_dqflags.py @@ -1,4 +1,3 @@ -import sys from math import log10 import numpy as np @@ -32,10 +31,7 @@ def test_pixel_flags(flag): assert isinstance(flag, dqflags.pixel) # Test that the pixel flags are ints - if sys.version_info < (3, 11): - assert isinstance(flag, int) - else: - assert isinstance(flag, np.uint32) + assert isinstance(flag, np.uint32) # Test that the pixel flags are dict accessible assert dqflags.pixel[flag.name] is flag @@ -83,10 +79,7 @@ def test_group_flags(flag): assert isinstance(flag, dqflags.group) # Test that the group flags are ints - if sys.version_info < (3, 11): - assert isinstance(flag, int) - else: - assert isinstance(flag, np.uint32) + assert isinstance(flag, np.uint32) # Test that the group flags are dict accessible assert dqflags.group[flag.name] is flag