Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python 3.12 to the CI matrix #2148

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

webknjaz
Copy link
Member

Contributor checklist
  • Included tests for the changes.
  • PR title is short, clear, and ready to be included in the user-facing changelog.
Maintainer checklist
  • Verified one of these labels is present: backwards incompatible, feature, enhancement, deprecation, bug, dependency, docs or skip-changelog as they determine changelog listing.
  • Assign the PR to an existing or new milestone for the target version (following Semantic Versioning).

@webknjaz webknjaz added maintenance Related to maintenance processes feature Request for a new feature ci Related to continuous integration tasks labels Dec 16, 2024
@webknjaz webknjaz enabled auto-merge December 16, 2024 04:58
@hugovk
Copy link
Member

hugovk commented Dec 16, 2024

@WhyNotHugo
Copy link
Member

Failure for piplowest is due to it referencing pkgutil.ImpImporter, which is gone is Python 3.12.

I think that we'll need to bump the minimal support version of pip.

@WhyNotHugo
Copy link
Member

I think that failure with pipsupported might be due to to this change in pip:

freeze no longer excludes the setuptools, distribute, and wheel from the output when running on Python 3.12 or later, where they are not included in a virtual environment by default. Use --exclude if you wish to exclude any of these packages. (#4256)

@WhyNotHugo
Copy link
Member

WhyNotHugo commented Dec 16, 2024

References to pkgutil.ImpImporter were made conditional in pypa/pip@f1a7a6f, which was first included in 23.1.2, tagged 2023-04-26.

I wonder if we need to update the minimal supported pip, or if we can claim "For Python 3.12, the minimal pip is 23.1.2", while remaining compatible with older versions in Python < 3.12.

@WhyNotHugo
Copy link
Member

See also: #2104

@macro1
Copy link
Contributor

macro1 commented Dec 16, 2024

pip itself only supports the most recent version. is there a reason to be careful to maximize backward compatibility?

@webknjaz
Copy link
Member Author

pip itself only supports the most recent version. is there a reason to be careful to maximize backward compatibility?

I think historically, pip-tools would support the previous pip version and the current one. But now with so low activity we're not catching up with the changes on time. The README even used to have a compatibility table.

#926 / #1950

I didn't really want this PR to become a discussion of the support drops. Only wanted to add modern Python to the matrix. Obviously, it needs some tweaks, likely incorporating the ideas from #2105.

@macro1
Copy link
Contributor

macro1 commented Dec 16, 2024

I didn't really want this PR to become a discussion of the support drops.

that's fine. we can discuss it elsewhere as well. really i meant to voice my support for dropping support for older versions over adding complexity to the pipeline

@webknjaz
Copy link
Member Author

I think that for as long as a good range of Pythons is supported, it's okay to depend on newer Pip versions. But I don't have stats on why people would want to use older versions of it, honestly. This would require somebody to lead a discussion and make sure different user groups are reached, aware and heard.

webknjaz added a commit to webknjaz/pip-tools that referenced this pull request Dec 16, 2024
@webknjaz
Copy link
Member Author

References to pkgutil.ImpImporter were made conditional in pypa/pip@f1a7a6f, which was first included in 23.1.2, tagged 2023-04-26.

I wonder if we need to update the minimal supported pip, or if we can claim "For Python 3.12, the minimal pip is 23.1.2", while remaining compatible with older versions in Python < 3.12.

Post tox invocation, this is reproducible via

$ .tox/py312-piplowest/bin/python -I -m pip install               
ERROR: Exception:
Traceback (most recent call last):
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/cli/base_command.py", line 167, in exc_logging_wrapper
    status = run_func(*args)
             ^^^^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
    return func(self, options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/commands/install.py", line 315, in run
    session = self.get_default_session(options)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/cli/req_command.py", line 98, in get_default_session
    self._session = self.enter_context(self._build_session(options))
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/cli/req_command.py", line 125, in _build_session
    session = PipSession(
              ^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/network/session.py", line 343, in __init__
    self.headers["User-Agent"] = user_agent()
                                 ^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/network/session.py", line 175, in user_agent
    setuptools_dist = get_default_environment().get_distribution("setuptools")
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 180, in get_distribution
    return next(matches, None)
           ^^^^^^^^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 177, in <genexpr>
    for distribution in self.iter_all_distributions()
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/metadata/base.py", line 594, in iter_all_distributions
    for dist in self._iter_distributions():
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 168, in _iter_distributions
    for dist in finder.find_eggs(location):
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 136, in find_eggs
    yield from self._find_eggs_in_dir(location)
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 103, in _find_eggs_in_dir
    from pip._vendor.pkg_resources import find_distributions
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2164, in <module>
    register_finder(pkgutil.ImpImporter, find_on_path)
                    ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/__main__.py", line 31, in <module>
    sys.exit(_main())
             ^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/cli/main.py", line 70, in main
    return command.main(cmd_args)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/cli/base_command.py", line 101, in main
    return self._main(args)
           ^^^^^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/cli/base_command.py", line 223, in _main
    self.handle_pip_version_check(options)
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/cli/req_command.py", line 179, in handle_pip_version_check
    session = self._build_session(
              ^^^^^^^^^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/cli/req_command.py", line 125, in _build_session
    session = PipSession(
              ^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/network/session.py", line 343, in __init__
    self.headers["User-Agent"] = user_agent()
                                 ^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/network/session.py", line 175, in user_agent
    setuptools_dist = get_default_environment().get_distribution("setuptools")
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 180, in get_distribution
    return next(matches, None)
           ^^^^^^^^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 177, in <genexpr>
    for distribution in self.iter_all_distributions()
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/metadata/base.py", line 594, in iter_all_distributions
    for dist in self._iter_distributions():
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 168, in _iter_distributions
    for dist in finder.find_eggs(location):
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 136, in find_eggs
    yield from self._find_eggs_in_dir(location)
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 103, in _find_eggs_in_dir
    from pip._vendor.pkg_resources import find_distributions
  File "~/src/github/jazzband/pip-tools/.tox/py312-piplowest/lib/python3.12/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2164, in <module>
    register_finder(pkgutil.ImpImporter, find_on_path)
                    ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?

webknjaz added a commit to webknjaz/pip-tools that referenced this pull request Dec 17, 2024
@webknjaz webknjaz force-pushed the maintenance/cpython-3.12 branch from 737a65c to adc094a Compare December 17, 2024 00:14
@webknjaz
Copy link
Member Author

@WhyNotHugo I applied the suggested update.

@webknjaz webknjaz force-pushed the maintenance/cpython-3.12 branch from adc094a to 088299b Compare December 17, 2024 00:15
Copy link
Member

@WhyNotHugo WhyNotHugo left a comment

Choose a reason for hiding this comment

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

LGTM. Just one questions for my own curiosity.

@@ -38,7 +38,8 @@ dependencies = [
# direct dependencies
"build >= 1.0.0",
"click >= 8",
"pip >= 22.2",
"pip >= 23.1; python_version >= '3.12'",
"pip >= 22.2; python_version < '3.12'",
Copy link
Member

Choose a reason for hiding this comment

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

Is the conditional required here? Without it, would the rule supersede the previous, or both apply?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that not all pip versions would merge these properly otherwise. But I haven't checked in a while. FWIW, this is the typical idiom people tend to follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Related to continuous integration tasks feature Request for a new feature maintenance Related to maintenance processes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants