Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Express conditionalsetuptools requirement statically#2043

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

EliahKagan
Copy link
Member

@EliahKaganEliahKagan commentedJun 7, 2025
edited
Loading

Inpip commands that conditionally install/upgrade or disregardsetuptools, this uses the static but version-discriminating specificationsetuptools; python_version<"3.12", rather than conditionally including or omitting asetuptools argument as was done before.

This covers the two scenarios where this applies, in separate commits:

  • 31e1c03: TheVirtualEnvironment test helper class (where this functionality is relevant in howtest_installation usesVirtualEnvironment).
  • 727f4e9: The steps for upgrading PyPA packages in CI workflows.

The `VirtualEnvironment` test helper is used in multiple places,but it is only told to install/upgrade `pip` when used from`test_installation`. It implements the functionality it wouldideally obtain by `upgrade_deps`, since the `upgrade_deps`parameter is only avaiilable in `venv` when using Python 3.9 andlater.When `pip` is installed, `upgrade_deps` would install `setuptools`when using Python 3.11 or lower, but not when using Python 3.12 orhigher. `VirtualEnvironment` does the same. (The reason for this isnot just to avoid needlessly departing from what `upgrade_deps`would do. Rather, it should not generally be necessary to have`setuptools` installed for package management since Python 3.12,and if it were necessary then this would a bug we would want todetect while running tests.)Previously this conditional specification of `setuptools` was doneby building different lists of package arguments to pass to `pip`,by checking `sys.version_info` to decide whether to append thestring `setuptools`.This commit changes how it is done, to use a static list of packagearguments instead. (The Python intepreter path continues to beobtained dynamically, but all its positional arguments, includingthose specifying packages, are now string literals.) Theconditional `setuptools` requirement is now expressed staticallyusing notation recognized by `pip`, as the string`setuptools; python_version<"3.12"`.
`setuptools` may potentially be needed for installation to workfully as desired prior to Python 3.12, so in those versions it isinstalled automatically in any virtual environment that is createdwith `pip` available. This is a behavior of the `venv` module thatis not specific to CI.However, on CI we upgrade packages that are preinstalled in thevirtual environment, or that we may otherwise wish to be present.This took the form of unconditionally installing/upgrading the`pip` and `wheel` packages, but conditionally upgrading the`setuptools` package only if we find that it is already installed.This commit changes the behavior to statically specify the samelist of package specifications to `pip` in all environments and inall versions of Python, but to use the static notation recognizedby `pip` to indicate that `setuptools` is to be instaled/upgradedonly if the Python version is strictly less than Python 3.12.This seems to be more readable. It also avoids using unquoted shellparameter expansion in a way that is potentially confusing (forexample, if we were running our CI script steps through ShellCheck,then it would automatically balk at that construction). It is alsomore consistent with how `test_installation` sets up itsenvironment (especially since31e1c03, but actually even beforethat, because it was still conditioning `setuptools` on the Pythonversion rather than whether it was already installed). Finally,this behavior is what the preexisting comment already described.This also adjusts the shell quoting style slightly in other relatedcommands (in the same workflows) that pass package specificationsto `pip`, for consistency.(For now, `".[test]"` rather than `.[test]` remains written in thereadme because it works in `cmd.exe` as well as other shells, butit may be changed there in the future too.)
@EliahKaganEliahKagan changed the titleExpress conditionalsetuptools staticallyExpress conditionalsetuptools requirement staticallyJun 7, 2025
@EliahKaganEliahKagan marked this pull request as ready for reviewJune 7, 2025 20:03
@EliahKaganEliahKagan merged commit82aaa13 intogitpython-developers:mainJun 7, 2025
27 checks passed
@EliahKaganEliahKagan deleted the static-package-selection branchJune 7, 2025 20:04
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull requestJun 14, 2025
- In the Cygwin CI workflow, move `runs-on` below `strategy`, for  greater consistency with other workflows.- In the Cygwin CI jobs, use `pwsh` rather than `bash` for the  `git config` command run outside of Cygwin, since `pwsh` is the  default shell for such commands, it's the shell the Cygwin setup  action uses, and it avoids creating the wrong impression that  `bash` is needed.- Use "virtual environment" instead of "virtualenv" in some step  names to avoid possible confusion with the `virtualenv` pacakge.- Remove comments in the PyPA package upgrade steps, which are  more self-documenting since727f4e9 (gitpython-developers#2043).
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@EliahKagan

[8]ページ先頭

©2009-2025 Movatter.jp