-
-
Notifications
You must be signed in to change notification settings - Fork 919
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
Support Python 3.13 #1955
Draft
EliahKagan
wants to merge
2
commits into
gitpython-developers:main
Choose a base branch
from
EliahKagan:py313
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Support Python 3.13 #1955
+6
−1
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EliahKagan
force-pushed
the
py313
branch
2 times, most recently
from
August 18, 2024 20:03
96ceb75
to
bae27f4
Compare
EliahKagan
added a commit
to EliahKagan/GitPython
that referenced
this pull request
Jan 2, 2025
This is analogous to the 3.7-related CI change in gitdb that was part of gitpython-developers/gitdb#114, as to part of gitpython-developers/smmap#58. Since some tests are not yet passing on 3.13, this does not add 3.13 to CI, nor to the documentation of supported versions in `setup.py`. Note that the list there is not enforced; GitPython can already be installed on Python 3.13 and probably *mostly* works. (See gitpython-developers#1955 for details on other changes that should be made to fully support running GitPython on Python 3.13.)
EliahKagan
added a commit
to EliahKagan/GitPython
that referenced
this pull request
Jan 2, 2025
Since gitpython-developers#1987, test jobs from `pythonpackage.yml` appear in an unintuitive order, and some show an extra bool matrix variable in their 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 without setting `continue-on-error` to temporarily work around the problems obseved in gitpython-developers#1955, but nothing 3.13-related is done in this commit.
EliahKagan
added a commit
to EliahKagan/GitPython
that referenced
this pull request
Jan 2, 2025
As this is being integrated, Python 3.13 is no longer a release candidate, but this marks it experimental since that might also be used temporarily to prevent some of the failures mentioned in gitpython-developers#1955 from failing the workflow. But right now this allows the workflow to fail.
EliahKagan
added a commit
to EliahKagan/GitPython
that referenced
this pull request
Jan 2, 2025
Since gitpython-developers#1987, test jobs from `pythonpackage.yml` appear in an unintuitive order, and some show an extra bool matrix variable in their 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 without setting `continue-on-error` to temporarily work around the problems obseved in gitpython-developers#1955, but nothing 3.13-related is done in this commit.
EliahKagan
added a commit
to EliahKagan/GitPython
that referenced
this pull request
Jan 2, 2025
As this is being integrated, Python 3.13 is no longer a release candidate, but this marks it experimental since that might also be used temporarily to prevent some of the failures mentioned in gitpython-developers#1955 from failing the workflow. But right now this allows the workflow to fail.
EliahKagan
added a commit
to EliahKagan/GitPython
that referenced
this pull request
Jan 2, 2025
It is specifically that combination that breaks some things. The underlying cause is a change in `isabs` to correctly report that paths on Windows that start with `\` that is not part of a construction such as `\\?\` are not absolute paths. (See gitpython-developers#1955 and links therein.) The change to `isabs` starts in 3.13, and it is only applicable to Windows, so only that combination is affected.
This was referenced Jan 2, 2025
EliahKagan
added a commit
to EliahKagan/GitPython
that referenced
this pull request
Jan 4, 2025
Since gitpython-developers#1987, test jobs from `pythonpackage.yml` appear in an unintuitive order, and some show an extra bool matrix variable in their 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 without setting `continue-on-error` to temporarily work around the problems obseved in gitpython-developers#1955, but nothing 3.13-related is done in this commit.
As this is being integrated, Python 3.13 is no longer a release candidate, but this marks it experimental since that might also be used temporarily to prevent some of the failures mentioned in gitpython-developers#1955 from failing the workflow. But right now this allows the workflow to fail.
It is specifically that combination that breaks some things. The underlying cause is a change in `isabs` to correctly report that paths on Windows that start with `\` that is not part of a construction such as `\\?\` are not absolute paths. (See gitpython-developers#1955 and links therein.) The change to `isabs` starts in 3.13, and it is only applicable to Windows, so only that combination is affected.
EliahKagan
added a commit
to EliahKagan/GitPython
that referenced
this pull request
Jan 5, 2025
But not Windows yet (gitpython-developers#1955).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tasks for full Python 3.13 support (the "Audit all ..." tasks can arguably be deferred if necessary):
imghdr
(#1954)index.remove('/only/looks/absolute')
should do on Windowsos.path.isabs
in GitPythonsetup.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 already mostly 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 of
os.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 the current 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 through
os.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 fix
os.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.