Support modern Python (3.12/3.13): replace pkg_resources and distutils - #276
Merged
Conversation
- pkg_resources -> importlib.metadata (version lookup) and packaging.version (parse/Version). Python 3.12 venvs no longer bundle setuptools, and setuptools >=81 removed pkg_resources entirely, so shellfoundry crashed at bootstrap on any modern environment. - distutils.version.StrictVersion -> packaging.version.Version (distutils removed in 3.12; only worked via the setuptools shim). - requirements: add packaging, drop the setuptools>=3.12 marker (no longer needed once pkg_resources is gone). - setup.py: python_requires>=3.8, refresh classifiers to 3.9-3.13. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- version.txt 1.2.29 (satisfies check-version; release vehicle for the modern-Python fixes) - CI: package-tox-py-37-39 -> package-tox-py-39; ubuntu-latest runners can no longer install Python 3.7, and this branch sets python_requires>=3.8 anyway. tox envlist follows. - black on bootstrap.py (this branch) and shell_package_installer.py (pre-existing from #275; pre-commit runs --all-files so CI was red on master too) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
shellfoundry crashes at bootstrap (
ModuleNotFoundError: No module named 'pkg_resources') on:setuptools; python_version >= '3.12'requirement marker never reaches pip because releases are sdist-only.pkg_resourceswas removed from setuptools entirely, so even 3.9–3.11 environments break after a routine setuptools upgrade.distutils.version.StrictVersion(removed from stdlib in 3.12) was one setuptools-shim away from being a second crash.Changes
pkg_resources.get_distribution(...).version→importlib.metadata.version(...)(stdlib since 3.8)pkg_resources.parse_version/ vendoredVersion→packaging.version(new explicitpackagingdependency)distutils.version.StrictVersion→packaging.version.Version+packaging, drop the now-unneeded conditional setuptools markerpython_requires>=3.8, classifiers refreshed to 3.9–3.13 (2.7 was already impossible —cloudshell-rest-api~=9.0requires ≥3.7)Verification
shellfoundry version, all touched modules import,shellfoundry new --template gen2/resourceruns up to the CloudShell-server connection step. Note: full 3.13 support also needs Fix Python 3.13 support: import BinaryIO from typing (typing.io removed) cloudshell-rest-api#32 (typing.ioremoved in 3.13).shellfoundry versionworks — no regression.masterwith Python 3.9) and unrelated to this change.Follow-ups (out of scope here)
test_requirements.txtneeds modernization: the pinnedpyfakefsdoesn't import on 3.12+ (pathlib._Flavour), andhttprettyis dead on 3.12+ (ssl.wrap_socket) — 3 test modules can't even collect.pyproject.toml) so metadata reliably reaches pip.🤖 Generated with Claude Code