Skip to content

chore: migrate to pyproject.toml; drop Python 3.8/3.9 support - #99

Merged
tseporamaisa merged 1 commit into
mainfrom
chore/dat-155-156-pyproject-and-dockerfile-hardening
Aug 24, 2026
Merged

chore: migrate to pyproject.toml; drop Python 3.8/3.9 support#99
tseporamaisa merged 1 commit into
mainfrom
chore/dat-155-156-pyproject-and-dockerfile-hardening

Conversation

@tseporamaisa

Copy link
Copy Markdown
Contributor

Summary

  • DAT-155: migrate setup.py to PEP 621 pyproject.toml, setup.py reduced to a minimal stub. license = "ISC" (matches the actual LICENSE file text and classifier, not the free-text "ISCL" setup.py used).
  • Bumped to Python 3.13. Real CI matrix was 3.8/3.9 (GitHub Actions, tox.ini, classifiers all agreed). This package is installed into the sagemaker/Dockerfile of ~8 repos across the fleet at a range of Python versions (3.9-3.11 currently) — not a breaking change for them (pip just keeps older consumers on the last compatible ml2p release), but flagged given the unusually wide blast radius; confirmed going straight to 3.13 to match the rest of this migration. setuptools>=83.0.0.
  • Migrated tests/cli_commands/test_utils.py's pkg_resources.resource_filename usage to importlib.resources (deprecated, slated for removal from setuptools).
  • Minor version bump (0.6.0 → 0.7.0) + HISTORY.rst entry, per this org's convention for a Python-support change.
  • No Dockerfile/PyPI-credential concerns — pure library, no Docker build of its own, published via GitHub Actions to public PyPI (unaffected).

Three real, pre-existing test bugs found and fixed — surfaced only by running on 3.13 against fresh (unpinned) dependency versions, none are new 3.13 incompatibilities in ml2p's own code:

  • fake_datetime.now() only accepted **kwargs, but newer botocore calls datetime.now(datetime.timezone.utc) positionally — now accepts (and ignores, to stay deterministic for other callers) a tz param.
  • assert_traceback() did an exact regex match that doesn't tolerate the PEP 657 fine-grained error location markers Python 3.11+ adds — now strips those lines first.
  • test_create_and_list asserted an exact CreationTime/LastModifiedTime that actually comes from moto's own internal clock (unreachable by the fake_utcnow fixture, which can't patch moto's already-imported datetime reference) — a newer moto returns a tz-aware local-offset value instead of the old naive one. Now only asserts the fields are present.

Test plan

  • Local Python 3.13.5 venv: 210/210 tests pass (1 skipped)
  • black/isort/flake8 clean
  • Both ml2p and ml2p-docker console scripts work

- Migrate setup.py to PEP 621 pyproject.toml; setup.py reduced to a
  minimal stub. license = "ISC" (matches the actual LICENSE file text
  and classifier, not the "ISCL" free-text setup.py used).
- Bumped to Python 3.13. Real CI matrix was py3.8/3.9 (GitHub Actions,
  tox.ini, classifiers all agreed). This package is installed into the
  sagemaker/Dockerfile of ~8 repos across the fleet at a range of
  Python versions (3.9-3.11 currently) - not a breaking change for
  them (pip just keeps older consumers on the last compatible ml2p
  release), but flagged given the unusually wide blast radius; user
  confirmed going straight to 3.13 to match the rest of this
  migration. setuptools>=83.0.0.
- Migrated tests/cli_commands/test_utils.py's pkg_resources.resource_filename
  usage to importlib.resources (pkg_resources is deprecated and
  slated for removal from setuptools).
- Minor version bump (0.6.0 -> 0.7.0) and HISTORY.rst entry, per this
  org's convention for a Python-version-support change (see
  afterbyrne/game-of-clones precedent).

No Dockerfile/PyPI-credential concerns - this is a pure library with
no Docker build of its own, published via GitHub Actions to public
PyPI (ml2p-pypi.yml, unaffected by this change).

Found and fixed three real, pre-existing test bugs surfaced only by
running on Python 3.13 against fresh (unpinned) dependency versions -
none are new Python-3.13 incompatibilities in ml2p's own code:
- tests/fixtures.py's fake_datetime.now() only accepted **kwargs, but
  newer botocore calls datetime.now(datetime.timezone.utc)
  positionally - accepted (and ignored, to keep existing callers
  deterministic) a tz parameter instead.
- tests/test_docker.py's assert_traceback() did an exact regex match
  against traceback text, which doesn't tolerate the PEP 657
  fine-grained error location markers Python 3.11+ adds - now strips
  those lines before matching.
- tests/cli_commands/test_endpoint.py::test_create_and_list asserted
  an exact CreationTime/LastModifiedTime that actually comes from
  moto's own internal clock (not the fake_utcnow fixture, which can't
  reach moto's already-imported datetime reference) - a newer moto
  version returns a timezone-aware local-offset value instead of the
  old naive one. Now only asserts the fields are present, not their
  exact value.

Validated: local Python 3.13.5 venv - 210/210 tests pass (1 skipped),
black/isort/flake8 clean, both ml2p and ml2p-docker console scripts
work.
@tseporamaisa
tseporamaisa force-pushed the chore/dat-155-156-pyproject-and-dockerfile-hardening branch from ed7c8fa to 1fc17a5 Compare August 24, 2026 09:36
@tseporamaisa
tseporamaisa merged commit 9ee95ff into main Aug 24, 2026
1 check passed
@tseporamaisa
tseporamaisa deleted the chore/dat-155-156-pyproject-and-dockerfile-hardening branch August 24, 2026 10:20
@KyleHarrison

Copy link
Copy Markdown
Contributor

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants