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

Support Python 3.13 on Windows#1955

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

Draft
EliahKagan wants to merge4 commits intogitpython-developers:main
base:main
Choose a base branch
Loading
fromEliahKagan:py313

Conversation

EliahKagan
Copy link
Member

@EliahKaganEliahKagan commentedAug 18, 2024
edited
Loading

Tasks for full Python 3.13 support (the "Audit all ..." tasks can arguably be deferred if necessary):

  • All platforms: Upgrade Sphinx packages to not useimghdr (#1954)
  • Windows: Figure out whatindex.remove('/only/looks/absolute') should do on Windows
  • Windows: Audit all other uses ofos.path.isabs in GitPython
  • Windows: Audit all choices GitPython makes based on whether paths are absolute or relative
  • All platforms: Add Python 3.13setup.py classifier (though it's not needed for installation)

Python 3.13 has been out for a few months now (and even has a patch release, 3.13.1), but I have not yet gotten to finishing this. I believe GitPython alreadymostly works on Python 3.13, including the recently released current version of GitPython as well as other recent-past versions. But there was a change to the behavior ofos.path.isabs on Windows in Python 3.13 that affects some functionality. The problem affects only Windows; GitPython should already completely work with Python 3.13 on other operating systems, though of course it is possible that other version-specific bugs are not yet discovered.

Unlike on Unix-like systems, most paths on Windows that begin with a directory separator are actually relative paths, because a path that begins with a single\ or/--rather than, for example,\\?\,\\.\, or\\hostname\--is relative to the root of thecurrent drive (unless it begins with\??\ and is used in a context where that syntax is accepted). But ordinary drive-relative\ paths are reported as absolute inos.path.isabs prior to Python 3.13, even thoughpathlib.Path functions do not misreport them in this way.

This rightly causes one test to fail. In addition, this points to a likely area of confusion when handling paths in Windows, and the code covered by the failing test, as well as other code that checks throughos.path funcitons orpathlib.Path methods if paths are absolute or relative on Windows should be examined.

I believe it is to avoid breaking code that relies on the old behavior that earlier versions of Python have not been updated to fixos.path.isabs for these kinds of paths. But any code that relies on that is likely to be doing the wrong thing. More broadly, any code that assume a path is absolute if and only if it begins with a directory separator is likely to be doing the wrong thing on Windows, even if it does not make use of library functions that encapsulate this assumption.

The original pull request description follows, including some elaboration related to the tasks.

Python 3.13 is currently a release candidate (3.13.0rc1). Initially all this draft PR does is enable it for CI.

This is not ready to merge. There are two failures on CI:

On Windows, a test fails due to thechange in 3.13 toos.path.isabs. I hope to fix that here, but I definitely have no objection if someone else wishes to fix it (which can supersede or, if desired, build on whatever ends up here). I'll also try to expand on that and related issues, here or elsewhere. It is not obvious what the best fix is. This is because the confusion that led to the old behavior ofos.path.isabs (and the skew between its behavior and that ofPath.is_absolute), as well as possibly other conceptually related issues, seem also to affect GitPython, including the code that leads to the current 3.13 test failure.

On all platforms, generating documentation fails (though the CI results don't show it for Windows because the unit test step fails first). This happens because 3.13removes a number of deprecated modules, and one of them isimghdr, which the old version of Sphinx we've been using attempts to import.This is fixed in#1954, and I plan to rebase this PR if that is merged.


In addition, though possibly not in this PR, because we currently list every version we support in the metadata defined insetup.py, once there is good reason to believe that GitPython works properly on 3.13, it should be added. (This is purely informational, and unrelated to the version range used to determine whether and what versions of GitPython are installable for what versions of Python.)

That could be done either in this PR or subsequent to it, depending on whether the changes here are sufficient to provide that confidence. But I do not take it to be a goal of this PR to do that; once CI is passing without suppressing anything, I think this would be ready. Then we would have CI in place that would help with further changes aimed at improving 3.13 support or fixing 3.13-nonspecific problems discovered while investigating 3.13-specific matters.

edgarrmondragon reacted with thumbs up emoji
@EliahKaganEliahKaganforce-pushed thepy313 branch 2 times, most recently from96ceb75 tobae27f4CompareAugust 18, 2024 20:03
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull requestJan 2, 2025
This is analogous to the 3.7-related CI change in gitdb that waspart ofgitpython-developers/gitdb#114, asto part ofgitpython-developers/smmap#58.Since some tests are not yet passing on 3.13, this does not add3.13 to CI, nor to the documentation of supported versions in`setup.py`. Note that the list there is not enforced; GitPython canalready be installed on Python 3.13 and probably *mostly* works.(Seegitpython-developers#1955for details on other changes that should be made to fully supportrunning GitPython on Python 3.13.)
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull requestJan 2, 2025
Sincegitpython-developers#1987, test jobs from `pythonpackage.yml` appear in anunintuitive order, and some show an extra bool matrix variable intheir names while others don't (this corresponds to `experimental`,which was always set to some value, but was set in different ways).This fixes that by:- Listing all tested versions, rather than introducing some in an  `include` key. (The `include:`-introduced jobs didn't distinguish  between originally-present matrix variables and those that are  introduced based on the values of the original ones.)- Replacing `os` with `os-type`, which has only the first part of  the value for `runs-on:` (e.g., `ubuntu`), and adding `os-ver`  to each matrix job, defaulting it to `latest`, but using `22.04`  for Python 3.7 on Ubuntu.This should also naturally extend to adding 3.13, with or withoutsetting `continue-on-error` to temporarily work around the problemsobseved ingitpython-developers#1955, but nothing 3.13-related is done in this commit.
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull requestJan 2, 2025
As this is being integrated, Python 3.13 is no longer a releasecandidate, but this marks it experimental since that might also beused temporarily to prevent some of the failures mentioned ingitpython-developers#1955from failing the workflow.But right now this allows the workflow to fail.
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull requestJan 2, 2025
Sincegitpython-developers#1987, test jobs from `pythonpackage.yml` appear in anunintuitive order, and some show an extra bool matrix variable intheir names while others don't (this corresponds to `experimental`,which was always set to some value, but was set in different ways).This fixes that by:- Listing all tested versions, rather than introducing some in an  `include` key. (The `include:`-introduced jobs didn't distinguish  between originally-present matrix variables and those that are  introduced based on the values of the original ones.)- Replacing `os` with `os-type`, which has only the first part of  the value for `runs-on:` (e.g., `ubuntu`), and adding `os-ver`  to each matrix job, defaulting it to `latest`, but using `22.04`  for Python 3.7 on Ubuntu.This should also naturally extend to adding 3.13, with or withoutsetting `continue-on-error` to temporarily work around the problemsobseved ingitpython-developers#1955, but nothing 3.13-related is done in this commit.
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull requestJan 2, 2025
As this is being integrated, Python 3.13 is no longer a releasecandidate, but this marks it experimental since that might also beused temporarily to prevent some of the failures mentioned ingitpython-developers#1955from failing the workflow.But right now this allows the workflow to fail.
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull requestJan 2, 2025
It is specifically that combination that breaks some things. Theunderlying cause is a change in `isabs` to correctly report thatpaths on Windows that start with `\` that is not part of aconstruction such as `\\?\` are not absolute paths. (Seegitpython-developers#1955 andlinks therein.) The change to `isabs` starts in 3.13, and it isonly applicable to Windows, so only that combination is affected.
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull requestJan 4, 2025
Sincegitpython-developers#1987, test jobs from `pythonpackage.yml` appear in anunintuitive order, and some show an extra bool matrix variable intheir names while others don't (this corresponds to `experimental`,which was always set to some value, but was set in different ways).This fixes that by:- Listing all tested versions, rather than introducing some in an  `include` key. (The `include:`-introduced jobs didn't distinguish  between originally-present matrix variables and those that are  introduced based on the values of the original ones.)- Replacing `os` with `os-type`, which has only the first part of  the value for `runs-on:` (e.g., `ubuntu`), and adding `os-ver`  to each matrix job, defaulting it to `latest`, but using `22.04`  for Python 3.7 on Ubuntu.This should also naturally extend to adding 3.13, with or withoutsetting `continue-on-error` to temporarily work around the problemsobseved ingitpython-developers#1955, but nothing 3.13-related is done in this commit.
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull requestJan 4, 2025
As this is being integrated, Python 3.13 is no longer a releasecandidate, but this marks it experimental since that might also beused temporarily to prevent some of the failures mentioned ingitpython-developers#1955from failing the workflow.But right now this allows the workflow to fail.
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull requestJan 4, 2025
It is specifically that combination that breaks some things. Theunderlying cause is a change in `isabs` to correctly report thatpaths on Windows that start with `\` that is not part of aconstruction such as `\\?\` are not absolute paths. (Seegitpython-developers#1955 andlinks therein.) The change to `isabs` starts in 3.13, and it isonly applicable to Windows, so only that combination is affected.
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull requestJan 5, 2025
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull requestMar 7, 2025
As this is being integrated, Python 3.13 is no longer a releasecandidate, but this marks it experimental since that might also beused temporarily to prevent some of the failures mentioned ingitpython-developers#1955from failing the workflow.But right now this allows the workflow to fail.
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull requestMar 7, 2025
It is specifically that combination that breaks some things. Theunderlying cause is a change in `isabs` to correctly report thatpaths on Windows that start with `\` that is not part of aconstruction such as `\\?\` are not absolute paths. (Seegitpython-developers#1955 andlinks therein.) The change to `isabs` starts in 3.13, and it isonly applicable to Windows, so only that combination is affected.
@EliahKaganEliahKaganforce-pushed thepy313 branch 2 times, most recently fromdf91dfd to65ff35fCompareMarch 7, 2025 02:28
As this is being integrated, Python 3.13 is no longer a releasecandidate, but this marks it experimental since that might also beused temporarily to prevent some of the failures mentioned ingitpython-developers#1955from failing the workflow.But right now this allows the workflow to fail.
It is specifically that combination that breaks some things. Theunderlying cause is a change in `isabs` to correctly report thatpaths on Windows that start with `\` that is not part of aconstruction such as `\\?\` are not absolute paths. (Seegitpython-developers#1955 andlinks therein.) The change to `isabs` starts in 3.13, and it isonly applicable to Windows, so only that combination is affected.
The experiment 3.13 Windows job recently started getting `runs-on`set to `windows-` rather than `windows-latest` (causing it to blockindefinitely waiting on a self-hosted runner with `windows-` as alabel). I don't know why this happens, since it looks like it didnot happen before rebasing from65ff35f to6060afd, but it happenswhen force-pushing back to that OID from before the rebase. Thisusually indicates a change in the runner software (or some otherpart of the GHA infrastructure), but it could be that it happenedbefore and went unnoticed (then looked like a failure but wasactually a cancellation?).
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull requestMar 7, 2025
For now, this omits macOS and Windows from the 3.13t ("threaded")tests.The plan ingitpython-developers#2005 is to start without them, and no OS-specificproblems have been identified so far. In particular, in theprevious commit that adds 3.13t without excluding any operatingsystems, all tests in the macOS job passed as expected, and theWindows job had the same failure with the same message as ingitpython-developers#1955,with no XFAIL changed to XPASS (which, if present, would suggestGC differences meriting further exploration of 3.13t on Windows).
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull requestMar 7, 2025
For now, this omits macOS and Windows from the 3.13t ("threaded")tests.The plan ingitpython-developers#2005 is to start without them, and no OS-specificproblems have been identified so far. In particular, in theprevious commit that adds 3.13t without excluding any operatingsystems, all tests in the macOS job passed as expected, and theWindows job had the same failure with the same message as ingitpython-developers#1955,with no XFAIL changed to XPASS (which, if present, would suggestGC differences meriting further exploration of 3.13t on Windows).
Byron pushed a commit to EliahKagan/GitPython that referenced this pull requestMar 12, 2025
For now, this omits macOS and Windows from the 3.13t ("threaded")tests.The plan ingitpython-developers#2005 is to start without them, and no OS-specificproblems have been identified so far. In particular, in theprevious commit that adds 3.13t without excluding any operatingsystems, all tests in the macOS job passed as expected, and theWindows job had the same failure with the same message as ingitpython-developers#1955,with no XFAIL changed to XPASS (which, if present, would suggestGC differences meriting further exploration of 3.13t on Windows).
@EliahKaganEliahKagan changed the titleSupport Python 3.13Support Python 3.13 on WindowsApr 20, 2025
@EliahKagan
Copy link
MemberAuthor

I still hope to complete this properly, but in the meantime I've renamed this PR to reflect that GitPython is already believed to work on Python 3.13 other than on Windows (where it probably works mostly but not entirely), so that users on Unix-like systems are not misled into thinking they can't upgrade.

Byron reacted with thumbs up emoji

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