René's URL Explorer Experiment


Title: Upgrade sphinx to ~7.1.2 by EliahKagan · Pull Request #1954 · gitpython-developers/GitPython · GitHub

Open Graph Title: Upgrade sphinx to ~7.1.2 by EliahKagan · Pull Request #1954 · gitpython-developers/GitPython

X Title: Upgrade sphinx to ~7.1.2 by EliahKagan · Pull Request #1954 · gitpython-developers/GitPython

Description: This upgrades Sphinx from 4.3.2 to 7.1.2. The old pinned version and its explicitly constrained dependencies are retained for now for Python 3.7 so that documentation can be built even with 3.7. (This could maybe be removed soon as a preliminary step toward eventually dropping 3.7 support.) For Python 3.8 and higher, version 7.1.2 is used, allowing later patch versions but constrained to remain 7.1.*. This is so the same versions are likely to be selected on all Python version from 3.8 and higher, to minimize small differences in generated documentation that different versions could give, and also to simplify debugging. The reason to upgrade Sphinx now is to support Python 3.13, which shall be (and, in the pre-releases available, is) incompatible with versions of Sphinx below 6.2. This is because those earlier Sphinx versions use the deprecated imghdr module, which 3.13 removes: https://docs.python.org/3.13/whatsnew/3.13.html#whatsnew313-pep594 python/cpython#104818 On old versions of Sphinx, that gives the error: Extension error: Could not import extension sphinx.builders.epub3 (exception: No module named 'imghdr') Using Sphinx 6.2 is sufficient to avoid this, but there do not seem to be any disadvantages for GitPython to remain below 7.1.2. The reason we did not upgrade Sphinx before is that, last time we considered doing so, we ran into a problem of new warnings (that we treat as errors). This is detailed in the "Can we upgrade Sphinx?" section of #1802, especially the "What Sphinx 5 is talking about" subsection. The problem is warnings about Actor when it comes in through type annotations: WARNING: more than one target found for cross-reference 'Actor': git.objects.util.Actor, git.util.Actor So this includes other changes to fix that problem as well. The solution used here is to import Actor even when TYPE_CHECKING is false, and write it unquoted in annotations, as Actor rather than "Actor". This allows Sphinx to discern where it should consider it to be located, for the purpose of linking to its documentation. This does not incur overhead, because: The affected modules already have imports from git.util, so also importing Actor from git.util does not cause any modules to be imported that were not imported otherwise, nor even to be imported at a different time. Even if that that had not been the case, most modules in GitPython including git.util have members imported them into the top-level git module in git.__init__ when git is imported (and thus when any Python submodule of git is imported). The only disadvantage is the presence of the additional name in those modules at runtime, which a user might inadvertently use and thus write brittle code that could break if it is later removed. But: The affected modules define __all__ and do not include "Actor" in __all__, so it is non-public. There are many places in GitPython (and most Python libraries) where the onus is already on the author of code that uses the library to avoid doing this. The reasons for the approach taken here, rather than any of several others, were: I did not write out the annotations as git.util.Actor to resolve the ambiguity because annotations should, and for some uses must, also be interpretable as expressions. But while from git.util import Actor works and makes Actor available, git.util.Actor cannot be used as an expression even after import git.util. This is because, even after such an import, git.util actually refers to git.index.util. This is as detailed in the warnings issued when it is accessed, originally from an overly broad * import but retained because removing it could be a breaking change. See git/__init__.py for details. The reason I did not write out the annotations as git.objects.util.Actor to resolve the ambiguity is that not all occurrences where Sphinx needed to be told which module to document it as being from were within the git.objects Python submodule. Two of the warnings were in git/objects/tag.py, where annotating it that way would not be confusing. But the other two were in git/index/base.py. Although removing Actor from git.objects.util.__all__ would resolve the ambiguity, this should not be done, because: This would be a breaking change. It seems to be there deliberately, since git.objects.util contains other members that relate to it directly. The reasons I did not take this opportunity to move the contents of git/util.py to a new file in that directory and make git/util.py re-export the contents, even though this would allow a solution analogous to (1) but for the new module to be used, while also simplifying importing elsewhere, were: That seems like a change that should be done separately, based either on the primary benefit to users or on a greater need for it. If and when that is done, it may make sense to change the interface as well. For example, git/util.py has a number of members that it makes available for use throughout GitPython but that are deliberately omitted from __all__ and are meant as non-public outside the project. One approach would be to make a module with a leading _ for these "internal" members, and another public ones with everything else. But that also cannot be decided based on the considerations that motivate the changes here. The treatment of HIDE_WINDOWS_KNOWN_ERRORS, which is public in git/util.py and which currently does have an effect, will need to be considered. Although it cannot be re-bound by assigning to git.util.HIDE_WINDOWS_KNOWN_ERRORS because the git.util subexpression would evaluate to git.index.util, there may be code that re-binds it in another way, such as by accessing the module through sys.modules. Unlike functions and classes that should not be monkey-patched from code outside GitPython's test suite anyway, this attribute may reasonably be assigned to, so it matters what module it is actually in, unless the action of assigning to it elsewhere is customized dynamically to carry over to the "real" place. An alternative solution that may be reasonable in the near future is to modify reference.rst so duplicate documentation is no longer emitted for functions and classes that are defined in one place but imported and "re-exported" elsewhere. I suspect this may solve the problem, allowing the Actor imports to go back under if TYPE_CHECKING: and to annotate with "Actor" again while still running make -C doc html with no warnings. However, this would entail design decisions about how to still document those members. They should probably have links to where they are fully documented. So an entry for Actor in the section of reference.rst for git.objects.util would still exist, but be very short and refer to the full autodoc item for Actor the section for git.util. Since a :class: reference to git.objects.util.Actor should still go to the stub that links to git.util.Actor, it is not obvious that solving the duplication in documentation generated for reference.rst ought to be done in a way that would address the ambiguity Sphinx warns about, even if it can be done in such a way. Therefore, that should also be a separate consideration and, if warranted, a separate change. This builds successfully: Locally in Ubuntu 22.04 LTS and Windows 10, tested with Python 3.12.5 and Python 3.13.0rc1. On CI in this PR, on all three platforms and all Python versions already under test. Note that the older version of Sphinx and its dependencies continues to be used on Python 3.7. I advocate that support for building GitPython's documentation on Python 3.7 be dropped very soon to simplify the situation, but I have not included that in this PR. On separate experimental CI on Python 3.13.0rc1 on Ubuntu and macOS. On Windows there is a test failure unrelated to these changes that occurs before the documentation step would run. Because I did heavy local testing of 3.13.0rc1, I have not set the unit test step to continue-on-error to observe the documentation step, though that could be done if necessary. Here's a CI run including 3.13.0rc1 without upgrading Sphinx, and here's a CI run with including 3.13.0rc1 as well as the changes from this PR. On Read the Docs, in the preview build. Using a newer version of Sphinx changes the appearance subtly, but in my opinion it is an improvement. Here is the RTD preview build and here is the content there. Notice how in the API reference each section name on the left side is now expandable, and the items inside it are then expandable, and so forth. This adds another way of finding what one is looking for. I didn't deliberately change anything here to achieve that; it comes along with the version upgrade.

Open Graph Description: This upgrades Sphinx from 4.3.2 to 7.1.2. The old pinned version and its explicitly constrained dependencies are retained for now for Python 3.7 so that documentation can be built even with 3.7. (T...

X Description: This upgrades Sphinx from 4.3.2 to 7.1.2. The old pinned version and its explicitly constrained dependencies are retained for now for Python 3.7 so that documentation can be built even with 3.7. (T...

Opengraph URL: https://github.com/gitpython-developers/GitPython/pull/1954

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:6ca4da4e-e775-24fe-e229-af0c53d5064f
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idCE70:22706F:1199F28:184354E:6968AFEF
html-safe-nonce74015cd59ff3bc588f763cbb317fa8f20e225233e871d2d3e30f4dfdc33a716c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTcwOjIyNzA2RjoxMTk5RjI4OjE4NDM1NEU6Njk2OEFGRUYiLCJ2aXNpdG9yX2lkIjoiNzQxNDA2MzI3NTAxMjgyOTE2NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaca0f00ccd004f78f85c6b8e13e2a48ea8231926bd786f7d239621f64241712c99
hovercard-subject-tagpull_request:2024261761
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/gitpython-developers/GitPython/pull/1954/files
twitter:imagehttps://avatars.githubusercontent.com/u/1771172?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1771172?s=400&v=4
og:image:altThis upgrades Sphinx from 4.3.2 to 7.1.2. The old pinned version and its explicitly constrained dependencies are retained for now for Python 3.7 so that documentation can be built even with 3.7. (T...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonefdc7c66bd36a6c12eb8e771e806db863266e573fc299e77f27505a768d4f8a98
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git
octolytics-dimension-user_id503709
octolytics-dimension-user_logingitpython-developers
octolytics-dimension-repository_id1126087
octolytics-dimension-repository_nwogitpython-developers/GitPython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1126087
octolytics-dimension-repository_network_root_nwogitpython-developers/GitPython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release3223a6503d318917691422cdadfbe16cd8fb21e5
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/gitpython-developers/GitPython/pull/1954/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgitpython-developers%2FGitPython%2Fpull%2F1954%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgitpython-developers%2FGitPython%2Fpull%2F1954%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=gitpython-developers%2FGitPython
Reloadhttps://github.com/gitpython-developers/GitPython/pull/1954/files
Reloadhttps://github.com/gitpython-developers/GitPython/pull/1954/files
Reloadhttps://github.com/gitpython-developers/GitPython/pull/1954/files
gitpython-developers https://github.com/gitpython-developers
GitPythonhttps://github.com/gitpython-developers/GitPython
Please reload this pagehttps://github.com/gitpython-developers/GitPython/pull/1954/files
Notifications https://github.com/login?return_to=%2Fgitpython-developers%2FGitPython
Fork 964 https://github.com/login?return_to=%2Fgitpython-developers%2FGitPython
Star 5k https://github.com/login?return_to=%2Fgitpython-developers%2FGitPython
Code https://github.com/gitpython-developers/GitPython
Issues 169 https://github.com/gitpython-developers/GitPython/issues
Pull requests 8 https://github.com/gitpython-developers/GitPython/pulls
Discussions https://github.com/gitpython-developers/GitPython/discussions
Actions https://github.com/gitpython-developers/GitPython/actions
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/gitpython-developers/GitPython/security
Please reload this pagehttps://github.com/gitpython-developers/GitPython/pull/1954/files
Insights https://github.com/gitpython-developers/GitPython/pulse
Code https://github.com/gitpython-developers/GitPython
Issues https://github.com/gitpython-developers/GitPython/issues
Pull requests https://github.com/gitpython-developers/GitPython/pulls
Discussions https://github.com/gitpython-developers/GitPython/discussions
Actions https://github.com/gitpython-developers/GitPython/actions
Security https://github.com/gitpython-developers/GitPython/security
Insights https://github.com/gitpython-developers/GitPython/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fgitpython-developers%2FGitPython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fgitpython-developers%2FGitPython%2Fissues%2Fnew%2Fchoose
Byronhttps://github.com/Byron
gitpython-developers:mainhttps://github.com/gitpython-developers/GitPython/tree/main
EliahKagan:py313-dochttps://github.com/EliahKagan/GitPython/tree/py313-doc
Conversation 4 https://github.com/gitpython-developers/GitPython/pull/1954
Commits 1 https://github.com/gitpython-developers/GitPython/pull/1954/commits
Checks 0 https://github.com/gitpython-developers/GitPython/pull/1954/checks
Files changed https://github.com/gitpython-developers/GitPython/pull/1954/files
Please reload this pagehttps://github.com/gitpython-developers/GitPython/pull/1954/files
Upgrade sphinx to ~7.1.2 https://github.com/gitpython-developers/GitPython/pull/1954/files#top
Show all changes 1 commit https://github.com/gitpython-developers/GitPython/pull/1954/files
16fc99f Upgrade sphinx to ~7.1.2 EliahKagan Aug 17, 2024 https://github.com/gitpython-developers/GitPython/pull/1954/commits/16fc99fee45412c3dae44bdd7f59d921a11c00b3
Clear filters https://github.com/gitpython-developers/GitPython/pull/1954/files
Please reload this pagehttps://github.com/gitpython-developers/GitPython/pull/1954/files
Please reload this pagehttps://github.com/gitpython-developers/GitPython/pull/1954/files
requirements.txt https://github.com/gitpython-developers/GitPython/pull/1954/files#diff-246970f36ae7ff82cc458ecc03e34c76cd67f7b50a0e4899b12c31c283b26fcf
base.py https://github.com/gitpython-developers/GitPython/pull/1954/files#diff-56d167dc0ca4d51682e56b5e602c096f3f264fd1ebb61cc03bbb6c409c866eeb
tag.py https://github.com/gitpython-developers/GitPython/pull/1954/files#diff-2526bf3fc6f6f4689c5b99b122e3954143bbf5997e3b81a6e7a0a7409fb61ac1
doc/requirements.txthttps://github.com/gitpython-developers/GitPython/pull/1954/files#diff-246970f36ae7ff82cc458ecc03e34c76cd67f7b50a0e4899b12c31c283b26fcf
View file https://github.com/EliahKagan/GitPython/blob/16fc99fee45412c3dae44bdd7f59d921a11c00b3/doc/requirements.txt
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/gitpython-developers/GitPython/pull/1954/{{ revealButtonHref }}
git/index/base.pyhttps://github.com/gitpython-developers/GitPython/pull/1954/files#diff-56d167dc0ca4d51682e56b5e602c096f3f264fd1ebb61cc03bbb6c409c866eeb
View file https://github.com/EliahKagan/GitPython/blob/16fc99fee45412c3dae44bdd7f59d921a11c00b3/git/index/base.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/gitpython-developers/GitPython/pull/1954/{{ revealButtonHref }}
https://github.com/gitpython-developers/GitPython/pull/1954/files#diff-56d167dc0ca4d51682e56b5e602c096f3f264fd1ebb61cc03bbb6c409c866eeb
https://github.com/gitpython-developers/GitPython/pull/1954/files#diff-56d167dc0ca4d51682e56b5e602c096f3f264fd1ebb61cc03bbb6c409c866eeb
https://github.com/gitpython-developers/GitPython/pull/1954/files#diff-56d167dc0ca4d51682e56b5e602c096f3f264fd1ebb61cc03bbb6c409c866eeb
https://github.com/gitpython-developers/GitPython/pull/1954/files#diff-56d167dc0ca4d51682e56b5e602c096f3f264fd1ebb61cc03bbb6c409c866eeb
https://github.com/gitpython-developers/GitPython/pull/1954/files#diff-56d167dc0ca4d51682e56b5e602c096f3f264fd1ebb61cc03bbb6c409c866eeb
https://github.com/gitpython-developers/GitPython/pull/1954/files#diff-56d167dc0ca4d51682e56b5e602c096f3f264fd1ebb61cc03bbb6c409c866eeb
git/objects/tag.pyhttps://github.com/gitpython-developers/GitPython/pull/1954/files#diff-2526bf3fc6f6f4689c5b99b122e3954143bbf5997e3b81a6e7a0a7409fb61ac1
View file https://github.com/EliahKagan/GitPython/blob/16fc99fee45412c3dae44bdd7f59d921a11c00b3/git/objects/tag.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/gitpython-developers/GitPython/pull/1954/{{ revealButtonHref }}
https://github.com/gitpython-developers/GitPython/pull/1954/files#diff-2526bf3fc6f6f4689c5b99b122e3954143bbf5997e3b81a6e7a0a7409fb61ac1
https://github.com/gitpython-developers/GitPython/pull/1954/files#diff-2526bf3fc6f6f4689c5b99b122e3954143bbf5997e3b81a6e7a0a7409fb61ac1
https://github.com/gitpython-developers/GitPython/pull/1954/files#diff-2526bf3fc6f6f4689c5b99b122e3954143bbf5997e3b81a6e7a0a7409fb61ac1
https://github.com/gitpython-developers/GitPython/pull/1954/files#diff-2526bf3fc6f6f4689c5b99b122e3954143bbf5997e3b81a6e7a0a7409fb61ac1
https://github.com/gitpython-developers/GitPython/pull/1954/files#diff-2526bf3fc6f6f4689c5b99b122e3954143bbf5997e3b81a6e7a0a7409fb61ac1
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.