chore: migrate to pyproject.toml; drop Python 3.8/3.9 support - #99
Merged
tseporamaisa merged 1 commit intoAug 24, 2026
Merged
Conversation
- 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
force-pushed
the
chore/dat-155-156-pyproject-and-dockerfile-hardening
branch
from
August 24, 2026 09:36
ed7c8fa to
1fc17a5
Compare
tseporamaisa
deleted the
chore/dat-155-156-pyproject-and-dockerfile-hardening
branch
August 24, 2026 10:20
Contributor
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
setup.pyto PEP 621pyproject.toml,setup.pyreduced to a minimal stub.license = "ISC"(matches the actual LICENSE file text and classifier, not the free-text"ISCL"setup.py used).sagemaker/Dockerfileof ~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.tests/cli_commands/test_utils.py'spkg_resources.resource_filenameusage toimportlib.resources(deprecated, slated for removal from setuptools).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 callsdatetime.now(datetime.timezone.utc)positionally — now accepts (and ignores, to stay deterministic for other callers) atzparam.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_listasserted an exactCreationTime/LastModifiedTimethat actually comes from moto's own internal clock (unreachable by thefake_utcnowfixture, which can't patch moto's already-importeddatetimereference) — 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
black/isort/flake8cleanml2pandml2p-dockerconsole scripts work