Title: Top-level refresh function not listed in __all__ · Issue #1875 · gitpython-developers/GitPython · GitHub
Open Graph Title: Top-level refresh function not listed in __all__ · Issue #1875 · gitpython-developers/GitPython
X Title: Top-level refresh function not listed in __all__ · Issue #1875 · gitpython-developers/GitPython
Description: Since #1659, git.__all__ is written literally, rather than being dynamically constructed based on what has been defined at the time it is bound. However, the fix was based on what __all__ had been being populated with at the time, and th...
Open Graph Description: Since #1659, git.__all__ is written literally, rather than being dynamically constructed based on what has been defined at the time it is bound. However, the fix was based on what __all__ had been ...
X Description: Since #1659, git.__all__ is written literally, rather than being dynamically constructed based on what has been defined at the time it is bound. However, the fix was based on what __all__ had been ...
Opengraph URL: https://github.com/gitpython-developers/GitPython/issues/1875
X: @github
Domain: togithub.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Top-level refresh function not listed in __all__","articleBody":"Since #1659, `git.__all__` is written literally, rather than being dynamically constructed based on what has been defined at the time it is bound. However, the fix was based on what `__all__` had been being populated with at the time, and therefore inherited two weaknesses:\r\n\r\n- Lots of imports that don't make sense to use from the `git` module (because they are from the standard library) are included. This is a fairly minor issue, but I suggest marking them as deprecated. Probably `DeprecationWarning` should not be raised when accessing them, though, because although people should not use wildcard imports in general, such warnings when using them in a REPL could obscure more important deprecation warnings.\r\n- **`git.refresh` isn't public**, at least not by the convention that when `__all__` exists everything excluded from it is non-public. This is mitigated by the references in the documentation that say to use it and to prefer it to the `Git.refresh` method, and by its inclusion in the autodoc-generated API reference page, but it would still be best for it to be listed in `git.__all__`. The reason it isn't is that, back when `__all__` had been constructed dynamically, this was *above the `def` for `refresh`*.\r\n\r\nI've included a fix for this in #1859, since I was adding to `__all__` for #1874 already. Because PEP-8 recommends `__all__` come before most code in a module, and the reason that couldn't be done before was that it was being built dynamically and so had to be defined below everything that was to be included in it, I went ahead and did that too. As with #1874, in view of the grown scope of #1859, it seemed clearer to have an issue for this that #1859 lists as fixing, rather than jam it into comments there.\r\n\r\n---\r\n\r\nThe other aspect of the situation with `git.__all__` following #1659 is the question of whether its content really has been stable. After all, it was constructed from wildcard imports from modules whose contents sometimes changed and not all of which had `__all__` attributes, and so potentially could have changed heavily across releases. If it had, then it might be acceptable to remove things that are only there for compatibility (because: compatibility with what?) and also would be necessary to add at least a commented warning when making other substantial changes, to avoid obscuring the issue.\r\n\r\nFortunately, that is not the case. It has been remarkably stable. I wrote [a script to check](https://github.com/EliahKagan/deltall) and [the results can be checked here](https://gist.github.com/EliahKagan/12c137a437069fae267facb1e4132180). (I actually did this around the time of #1659, but there was nothing to raise an alarm about, and the matter didn't come up again until now.)","author":{"url":"https://github.com/EliahKagan","@type":"Person","name":"EliahKagan"},"datePublished":"2024-03-14T08:21:54.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1875/GitPython/issues/1875"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3caa2bcb-fa13-c2c5-1f1d-1e1684282e3f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A5A6:31C581:BA98C4:FEB879:6969361B |
| html-safe-nonce | e53c7422e99d6ef7bac157e1e783d371d88911270135c42a3d3b18b9297cc459 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNUE2OjMxQzU4MTpCQTk4QzQ6RkVCODc5OjY5NjkzNjFCIiwidmlzaXRvcl9pZCI6IjY3NTYwMTQzMjc1MjIyMTEzNTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 60280f598281a03392032cce7f5496ec59108fee7f46638e7ce1d1bb61deb1b4 |
| hovercard-subject-tag | issue:2185728438 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/gitpython-developers/GitPython/1875/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1f47bd163a15bfc0362f88677d156793b76306ba6bb9e1e9097dc93c4161f7f8/gitpython-developers/GitPython/issues/1875 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1f47bd163a15bfc0362f88677d156793b76306ba6bb9e1e9097dc93c4161f7f8/gitpython-developers/GitPython/issues/1875 |
| og:image:alt | Since #1659, git.__all__ is written literally, rather than being dynamically constructed based on what has been defined at the time it is bound. However, the fix was based on what __all__ had been ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | EliahKagan |
| hostname | github.com |
| expected-hostname | github.com |
| None | 54182691a21263b584d2e600b758e081b0ff1d10ffc0d2eefa51cf754b43b51d |
| turbo-cache-control | no-preview |
| go-import | github.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git |
| octolytics-dimension-user_id | 503709 |
| octolytics-dimension-user_login | gitpython-developers |
| octolytics-dimension-repository_id | 1126087 |
| octolytics-dimension-repository_nwo | gitpython-developers/GitPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1126087 |
| octolytics-dimension-repository_network_root_nwo | gitpython-developers/GitPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d69ac0477df0f87da03b8b06cebd187012d7a930 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width