Skip to content

Align Python support metadata and runtime with Python 3.10+ - #439

Merged
ekalinin merged 3 commits into
ekalinin:masterfrom
jihtsan:codex/436-python-support
Oct 25, 2026
Merged

ekalinin merged 3 commits into
ekalinin:masterfrom
jihtsan:codex/436-python-support

Conversation

@jihtsan

@jihtsan jihtsan commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Package metadata still declares Python 2.7 support and builds a py2.py3 universal wheel, while the code and CI have moved to Python 3. Choose Python 3.10 as the minimum to match the existing CI/tox floor, set Requires-Python >=3.10, and list CPython 3.10–3.14 classifiers. Drop the untested PyPy classifier and remove the universal-wheel flag so the build produces a py3 wheel.

Remove the Python 2 import/quote fallbacks, iteritems wrapper, is_PY3 and no-op to_utf8 conversions from nodeenv.py; keep urllib.request imported as urllib2. Update the README, unreleased changelog and legacy developer test targets/requirements. Strengthen the environment-path test with a non-ASCII text path. The separate Python 2.7 interpreter requirement for building Node.js before 13 remains intact; the README specifies that it must be available as a python2 command. The legacy test4 target selects generic python3, and the tests now import shlex.quote and unittest.mock directly.

Validation on macOS arm64:

  • Python 3.10.21: python -m pytest -m 'not integration' tests -q — 397 passed, 11 skipped, 5 integration cases deselected, 2 existing expected failures.
  • Python 3.13.12: same command — 398 passed, 10 skipped, 5 deselected, 2 existing expected failures.
  • flake8 --extend-ignore=E127 nodeenv.py tests setup.py, git diff --check, and make -n test4 passed.
  • Built sdist and wheel with the repository's setuptools backend. Unchanged base produces nodeenv-1.11.0-py2.py3-none-any.whl; the patch produces nodeenv-1.11.0-py3-none-any.whl with Requires-Python: >=3.10 and updated classifiers.
  • Target-version resolver dry runs accept the old wheel for Python 3.9 and reject the patched wheel. This is metadata/resolver evidence, not a Python 3.9 runtime test.
  • Installed the actual patched wheel in a fresh Python 3.10 environment; nodeenv --version and nodeenv --node=system in a Unicode path passed, and that environment runs the real system Node v24.20.0.

The revised head repeated the Python 3.10/3.13 suites and full flake8 successfully, rebuilt the sdist/wheel, and verified that its metadata advertises CPython without PyPy. make -n test4 passed; an actual make test4 run in a disposable checkout passed with SETUP overridden to install the newly built local wheel without network. The default pip-upgrade/setup.py-install recipe was not run.

Python 3.11/3.12/3.14, PyPy, Linux/Windows and real Node download/compilation were not run locally. Historical Debian packaging was not modernized or exercised. Hosted CI remains separate from these local checks. No claim is made that those untested environments passed.

Closes #436. AI assistance: OpenAI Codex inspected the Issue, source and contribution rules, implemented the change, ran these checks and performed independent Standards/Spec reviews.

@ekalinin ekalinin left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this covers everything listed in #436. A few small things before merge.

  • setup.py:62 still lists Programming Language :: Python :: Implementation :: PyPy, but no CI job or tox env runs PyPy, and the description says it wasn't run locally either. Since #436 is about the metadata matching what is tested, please drop it.

  • The new README line (README.rst:118) says Python 2.7 is needed, but build_node_from_src looks for a python2 command (shutil.which('python2')). A Python 2.7 installed with make altinstall has only python2.7, and --source for node 12 then fails with no python2 command (required for building node.js ...) was found (#435). Something like this would match the code:

    * Python 2.7 as a ``python2`` command when building Node.js versions older
      than 13 from source; this is separate from the Python 3.10+ interpreter
      that runs nodeenv.
  • test4 in the Makefile now pins python3.10 (lines 80 and 82), so it fails on any machine without that exact interpreter, and the line has to change with every bump of the minimum version. #43 isn't about a Python version (it's -p --node=system inside a virtualenv), so --python=python3 tests the same thing.

  • With mock; python_version < '3.3' gone from requirements-dev.txt, the Python 2 fallbacks in the tests can go too:

    • tests/nodeenv_test.py:1-8: the two from __future__ imports and the pipes.quote branch become from shlex import quote as _quote (pipes was removed in Python 3.13, and the import sys there duplicates the one at line 18);
    • the try: from unittest import mock / except ImportError: import mock blocks in tests/nodeenv_test.py:25-28, tests/test_install_activate.py:5-8 and tests/test_activate_shells.py:13-16 become from unittest import mock.

@ekalinin
ekalinin merged commit 05e06b8 into ekalinin:master Oct 25, 2026
26 checks passed
@ekalinin

Copy link
Copy Markdown
Owner

Thanks!

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.

setup.py still declares Python 2.7 support

2 participants