Work around Cygwin CI failure #2004, except for `test_installation` by EliahKagan · Pull Request #2007 · gitpython-developers/GitPython
Repository navigation
Work around Cygwin CI failure #2004, except for test_installation - #2007
Merged
Byron merged 6 commits into gitpython-developers:main from EliahKagan:cygwin-py39-venv Feb 25, 2025
Merged
Work around Cygwin CI failure #2004, except for test_installation #2007
Byron merged 6 commits into
gitpython-developers:main from
EliahKagan:cygwin-py39-venv
Conversation
EliahKagan commented Feb 25, 2025 · edited Loading
Copy link Copy Markdown
Member
I don't have a complete fix for #2004 yet, but since it's confirmed to fail on the main branch of this upstream repository (mentioned in #1988 (comment) , though not due to #1988 ), I figured my partial fix might be worth putting into place. With these changes, the problem in the Cygwin test job turns from being unable to run any tests to being able to run all the tests but with one new failure compared to the way it was before #2004 (i.e. with one non-xfail failure).
This uses the official pip bootstrap script https://bootstrap.pypa.io/get-pip.py to install pip in the virtual environment. This allows the actual installation of GitPython and its dependencies, including all test dependencies, to complete without problems. Aside from tests that are expected to fail and are already marked xfail, all tests pass except for test_installation, which fails for the same reason. It presumably would also pass if the bootstrap script were used there too, but I believe the current intent of that test is to verify that installation succeeds when done in an ordinary way.
I am likewise reluctant to mark test_installation as xfail on Cygwin, unless that turns out to be truly necessary, because none of this happens on my local Cygwin environment on a Windows 10 development machine. It seems like it is triggered by some combination of changing packages and something wrong or otherwise specific about the Cygwin workflow.
This PR includes some changes to the workflow that are not actually necessary for the workaround it confers. The changes that are needed are:
- Refraining from having
venvautomatically attempt to installpip. - Installing
pipin the virtual environment explicitly using the bootstrap script. - Installing the
wgetCygwin package to download the bootstrap script without extra complexity or risking encoding/line-ending mismatches.
All the rest is to make the workflow run a little faster, and maybe be slightly more robust in ways that are not relevant to #2004 and not very important. The most significant of them is switching back to the Cygwin installation action we had previously been using, which is less configurable (it does not support installing Cygwin packages at specific versions, which we had needed to do at one time), but which is faster because it does not first have to install Chocolatey to use it as an intermediary for installing Cygwin.
I kept those changes here because I think it's easier to iterate on this if it is left in. But if you'd like I'd be pleased to undo the nonessential changes, which can always be brought back later and separately. I have tested in 7fd5f15 to make sure that this really works, so undoing those changes could be as simple as adding that one commit.
EliahKagan added 6 commits February 21, 2025 05:17
Run python3.9 explicitly on Cygwin CI
9e22a4a
In case somehow another one leaked in.
Switch back to cygwin/cygwin-install-action
f401b10
Since we don't need pinning, and this avoids installing and using the chocolatey package manager, which we're not using for anything else.
Install pip in venv in separate step
4605dd6
Install Cygwin package for wheel
a5fee41
Use the pip bootstrap script instead
a2b73ca
Install wget for Cygwin job to use to get pip bootstrap script
d597fc9
EliahKagan
mentioned this pull request
Feb 25, 2025
Cygwin job is broken on "Set up virtualenv" step
#2004
Closed
Byron commented Feb 25, 2025
Copy link Copy Markdown
Member
|
Thanks so much for your help with this! Despite the test failure, I think this already is a great improvement to what was there before so I'd merge it on that merit alone. |
fe7533e
into
gitpython-developers : main
Feb 25, 2025
EliahKagan commented Feb 25, 2025
Copy link Copy Markdown
Member
Author
My thinking is that it could be marked conditionally xfail when the platform is Cygwin and the |
Revisit installing pip in venv in separate step
e007714
The previous commit pinned the python39-pip package, but it may still be upgraded when installed automatically in the `python -m venv` step, since that step runs something like `python3.9 -Im ensurepip --upgrade --default-pip`. This replays 4605dd6 to install pip in a separate step. This differs from the solution in gitpython-developers#2007 in that this does not use the bootstrap script.EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Mar 6, 2025
Mark test_installation xfail on Cygwin CI
2ae697d
Together with gitpython-developers#2007, this works around gitpython-developers#2004, allowing all tests to pass on Cygwin CI. In gitpython-developers#2007, installation of the environment in which tests run was fixed by downloading and running the `get-pip.py` bootstrap script. If we were to modify our helper that sets up the (separate) virtual environment in `test_installation` so that it does the same thing (or conditionally does so on CI, since the problem does not seem to happen in local installations), that would likely "fix" this more thoroughly, allowing the test to pass. But part of the goal of the installation test is to test that installation works in a typical environment on the platform it runs on. So it is not obivous that making it pass in that way would be an improvement compared to marking it `xfail` with the exception type that occurs due to gitpython-developers#2004. So this just does that, for now.EliahKagan mentioned this pull request Mar 6, 2025 Mark
test_installation xfail on Cygwin CI
#2009
Merged
EliahKagan commented Mar 6, 2025 · edited Loading
Copy link Copy Markdown
Member
Author
|
I tried a few more things, but I did not find a good fix or better workaround, so I've opened #2009 to mark that one test conditionally |
Use *-wheel packages as a better fix for gitpython-developers#2004
f2b3dd1
This installs the `python-pip-wheel`, `python-setuptools-wheel`, and `python-wheel-wheel` packages on Cygwini CI, which provide `.whl` files for `pip`, `setuptools`, and `wheel`. By making those wheels available, this fixes gitpython-developers#2004 better than the previous workaround, allowing `ensurepip` to run without the error: Traceback (most recent call last): File "/usr/lib/python3.9/runpy.py", line 188, in _run_module_as_main mod_name, mod_spec, code = _get_module_details(mod_name, _Error) File "/usr/lib/python3.9/runpy.py", line 147, in _get_module_details return _get_module_details(pkg_main_name, error) File "/usr/lib/python3.9/runpy.py", line 111, in _get_module_details __import__(pkg_name) File "/usr/lib/python3.9/ensurepip/__init__.py", line [30](https://github.com/EliahKagan/GitPython/actions/runs/13454947366/job/37596811693#step:10:31), in <module> _SETUPTOOLS_VERSION = _get_most_recent_wheel_version("setuptools") File "/usr/lib/python3.9/ensurepip/__init__.py", line 27, in _get_most_recent_wheel_version return str(max(_wheels[pkg], key=distutils.version.LooseVersion)) ValueError: max() arg is an empty sequence This change takes the place of the main changes in gitpython-developers#2007 and gitpython-developers#2009. In particular, it should allow `test_installation` to pass again. This also delists non-wheel Cygwin packages such as `python39-pip`, which are not needed (or at least no longer needed).EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Jun 14, 2025
Use *-wheel packages as a better fix for gitpython-developers#2004
8e24edf
This installs the `python-pip-wheel`, `python-setuptools-wheel`, and `python-wheel-wheel` packages on Cygwini CI, which provide `.whl` files for `pip`, `setuptools`, and `wheel`. By making those wheels available, this fixes gitpython-developers#2004 better than the previous workaround, allowing `ensurepip` to run without the error: Traceback (most recent call last): File "/usr/lib/python3.9/runpy.py", line 188, in _run_module_as_main mod_name, mod_spec, code = _get_module_details(mod_name, _Error) File "/usr/lib/python3.9/runpy.py", line 147, in _get_module_details return _get_module_details(pkg_main_name, error) File "/usr/lib/python3.9/runpy.py", line 111, in _get_module_details __import__(pkg_name) File "/usr/lib/python3.9/ensurepip/__init__.py", line [30](https://github.com/EliahKagan/GitPython/actions/runs/13454947366/job/37596811693#step:10:31), in <module> _SETUPTOOLS_VERSION = _get_most_recent_wheel_version("setuptools") File "/usr/lib/python3.9/ensurepip/__init__.py", line 27, in _get_most_recent_wheel_version return str(max(_wheels[pkg], key=distutils.version.LooseVersion)) ValueError: max() arg is an empty sequence This change takes the place of the main changes in gitpython-developers#2007 and gitpython-developers#2009. In particular, it should allow `test_installation` to pass again. This also delists non-wheel Cygwin packages such as `python39-pip`, which are not needed (or at least no longer needed). (The python-{pip,setuptools,wheel}-wheel packages are, as their names suggest, intentionally not specific to Python 3.9. However, this technique will not necessarily carry over to Python 3.12, depending on what versions are supplied and other factors. This may be relevant when another attempt like gitpython-developers#1988 is made to test/support Python 3.12 on Cygwin. At least for now, though, this seems worthwhile for fixing the Cygwin 3.9 environment, making it more similar to working local Cygwin environments and letting the workflow be more usable as guidance to how to set up a local Cygwin environment for GitPython development, and letting the installation test pass automatically.)EliahKagan mentioned this pull request Jun 14, 2025 Fix Cygwin installation on CI for
pip
#2053
Merged
Sign up for free
to join this conversation on GitHub .
Already have an account?
Sign in to comment