GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix dynamically-set __all__ variable by DeflateAwning · Pull Request #1659 · gitpython-developers/GitPython

Conversation

@DeflateAwning

@DeflateAwning DeflateAwning commented Sep 12, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Fixes issue #1656 by statically setting the __all__ variable.
Note that this could probably be done more preciely. The list was generated using the dynamic generation code currently there, printed, and then inserted back in.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@DeflateAwning
Fix dynamically-set __all__ variable
c862845
Byron
Byron requested changes Sep 13, 2023
View reviewed changes

@Byron Byron left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

It looks like the list is not complete though, is this intentional?

Out[19]:
['Actor',
 'AmbiguousObjectName',
 'BadName',
 'BadObject',
 'BadObjectType',
 'BaseIndexEntry',
 'Blob',
 'BlobFilter',
 'BlockingLockFile',
 'CacheError',
 'CheckoutError',
 'CommandError',
 'Commit',
 'Diff',
 'DiffIndex',
 'Diffable',
 'FetchInfo',
 'Git',
 'GitCmdObjectDB',
 'GitCommandError',
 'GitCommandNotFound',
 'GitConfigParser',
 'GitDB',
 'GitError',
 'HEAD',
 'Head',
 'HookExecutionError',
 'IndexEntry',
 'IndexFile',
 'IndexObject',
 'InvalidDBRoot',
 'InvalidGitRepositoryError',
 'List',
 'LockFile',
 'NULL_TREE',
 'NoSuchPathError',
 'ODBError',
 'Object',
 'Optional',
 'ParseError',
 'PathLike',
 'PushInfo',
 'RefLog',
 'RefLogEntry',
 'Reference',
 'Remote',
 'RemoteProgress',
 'RemoteReference',
 'Repo',
 'RepositoryDirtyError',
 'RootModule',
 'RootUpdateProgress',
 'Sequence',
 'StageType',
 'Stats',
 'Submodule',
 'SymbolicReference',
 'TYPE_CHECKING',
 'Tag',
 'TagObject',
 'TagReference',
 'Tree',
 'TreeModifier',
 'Tuple',
 'Union',
 'UnmergedEntriesError',
 'UnsafeOptionError',
 'UnsafeProtocolError',
 'UnsupportedOperation',
 'UpdateProgress',
 'WorkTreeRepositoryUnsupported',
 'remove_password_if_present',
 'rmtree',
 'safe_decode',
 'to_hex_sha']

In [20]: len(git.__all__)
Out[20]: 75

In [21]: len(all)
Out[21]: 67

Could you also sort the list please? This makes it easier to maintain I think. Thank you.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@DeflateAwning

DeflateAwning commented Sep 14, 2023

Copy link
Copy Markdown
Contributor Author

I simply ran the existing code that was there, and then hard-coded it, removing entries that Pyright said were invalid.

Is this new list the complete list that should be used?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Byron

Byron commented Sep 14, 2023

Copy link
Copy Markdown
Member

[..] removing entries that Pyright said were invalid.

I think this explains the mismatch - I created this list based on what's actually there, without looking at a linter. My take on this is that it should be a complete substitution, and no entry can be missing, in order to remain compatible.

Is this new list the complete list that should be used?

Yes, I think so. It would be interesting to know what Pyright is complaining about, but would hope that can be fixed without altering the contents of __all__.

Thanks for bearing with me on this one.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@EliahKagan EliahKagan mentioned this pull request Sep 21, 2023
Remove @NoEffect annotations #1677
Merged
@EliahKagan EliahKagan mentioned this pull request Oct 3, 2023
Clarify Git.execute and Popen arguments #1688
Merged
@DeflateAwning
Clean up __all__ in main, and explicit imports in exc
8edc53b
- explicit imports in exc added to avoid linting errors in __init__
@DeflateAwning

DeflateAwning commented Oct 6, 2023

Copy link
Copy Markdown
Contributor Author

Implemented these changed, please merge :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@DeflateAwning

DeflateAwning commented Oct 6, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

To fully fix the type hinting issues in all files I've modified here, merge this PR on gitdb, and bump the submodule version

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@DeflateAwning
Add @UnusedImport to recent changes
9ac6bb0
@Byron

Byron commented Oct 7, 2023

Copy link
Copy Markdown
Member

It seems the NOQA part doesn't kick in for some reason - maybe this can also be validated locally by use of a venv or tox.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

DeflateAwning added 5 commits October 10, 2023 15:03
@DeflateAwning
Fix unused import linting
ebd9ce5
@DeflateAwning
Typo
b1478bb
@DeflateAwning
Merge branch 'main' into main
fbac514
@DeflateAwning
black lint
a4eb2b3
@DeflateAwning
Merge branch 'main' of https://github.com/DeflateAwning/GitPython
87cc325
@DeflateAwning

DeflateAwning commented Oct 10, 2023

Copy link
Copy Markdown
Contributor Author

Should finally be good now! You'll probably want to squash and merge though, as I had a time stuggling with the linter (some new things were learned though)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Byron

Byron commented Oct 11, 2023

Copy link
Copy Markdown
Member

Thanks a lot, it seems correct now.

For future reference, please prefer to rebase instead of merging. Unfortunately my tooling isn't quite up to the task to visualize complex commit graphs nicely (or I don't know how to use them).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Byron
Byron merged commit 87cc325 into gitpython-developers:main Oct 11, 2023
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Oct 11, 2023
@EliahKagan
Fix small gitpython-developers#1662 regression due to gitpython-devel…
0f50717
…opers#1659

When gitpython-developers#1659 was updated to pick up linting configuration changes, it
inadvertently undid one of the URL changes made in gitpython-developers#1662, putting
the URL in the git.exe module back to the one that redirects to a
different BSD license from the one this project uses.

Since only that one module was affected, the fix is simple. This
only changes the URL back; it doesn't undo any other gitpython-developers#1659 changes.
@EliahKagan EliahKagan mentioned this pull request Oct 11, 2023
Fix small #1662 regression due to #1659 #1701
Merged
@DeflateAwning

DeflateAwning commented Oct 11, 2023

Copy link
Copy Markdown
Contributor Author

I'll have to figure that out in GitHub Desktop

Byron reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Oct 11, 2023
@EliahKagan
Fix small gitpython-developers#1662 regression due to gitpython-devel…
cc848d2
…opers#1659

When gitpython-developers#1659 was updated to pick up linting configuration changes, it
inadvertently undid one of the URL changes made in gitpython-developers#1662, putting
the URL in the git.exc module back to the one that redirects to a
different BSD license from the one this project uses.

Since only that one module was affected, the fix is simple. This
only changes the URL back; it doesn't undo any other gitpython-developers#1659 changes.
Byron added a commit that referenced this pull request Oct 12, 2023
@Byron
Merge pull request #1701 from EliahKagan/license-ambiguity-regression
1e7d885
Fix small #1662 regression due to #1659
This was referenced Oct 12, 2023
Update CI, in line with gitdb gitpython-developers/smmap#53
Merged
Have Dependabot offer submodule updates #1702
Merged
@DeflateAwning

DeflateAwning commented Oct 17, 2023

Copy link
Copy Markdown
Contributor Author

Can you do a release with these changes soon?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@DeflateAwning DeflateAwning mentioned this pull request Oct 17, 2023
Fix warning in Pyright ("Repo" not exported from module "git") #1656
Closed
@Byron

Byron commented Oct 17, 2023

Copy link
Copy Markdown
Member

And here it is: https://github.com/gitpython-developers/GitPython/releases/tag/3.1.38 .

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@DeflateAwning

DeflateAwning commented Oct 17, 2023

Copy link
Copy Markdown
Contributor Author

Thank you!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Oct 18, 2023
Have init script clone submodules unconditionally #1715
Merged
3.1.38 meant to fix #1656 but there is no supporting gitdb release #1716
Closed
We appear to import the submodule version of gitdb (but never do) #1717
Closed
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Oct 20, 2023
@EliahKagan
Add __all__ in git.exc, adjust __init__.py imports
7545b80
The git.exc module imports exceptions from gitdb.exc to republish
them, as well as defining its own (also for use from outside). But
because it did not define __all__, the intent for the exceptions it
imported was unclear, since names that are introduced by imports
and not present in __all__ are not generally considered public,
even when __all__ is absent and a "*" import would reimport them.

This rectifies that by adding __all__ and listing both imported and
newly introduced exceptions explicitly in it. Although this
strictly expands which names are public under typical conventions,
it strictly contracts which names are imported by a "*" import,
because the presence of __all__ suppresses names not listed in it
from being imported that way. However, because under typical
conventions those other names are not considered public, and they
were not even weakly documented as public, this should be okay.

(Even though this is not a breaking change, in that code it would
break would already technically be broken... if it turns out that
it is common to wrongly rely on the availabiliy of those names,
then this may need to be revisited and slightly modified.)

This brings the readily identified public interface of git.exc in
line with what is weakly implied (and intended) by its docstring.

This also modifies __init__.py accordingly: The top-level git
module has for some time used a "*" import on git.exc, causing
the extra names originally meant as implementation details to be
included. Because its own __all__ was dynamically generated until
c862845, gitpython-developers#1659 also added 8edc53b to retain the formerly present
names in __all__. So the change here imports those names from the
modules that deliberately provide them, to preserve compatibility.
This was referenced Oct 20, 2023
The public interface of git.exc is ambiguous #1718
Closed
Add __all__ in git.exc #1719
Merged
renovate Bot referenced this pull request in allenporter/flux-local Oct 20, 2023
@renovate
Update dependency GitPython to v3.1.40 (#361)
23eac62
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [GitPython](https://togithub.com/gitpython-developers/GitPython) |
`==3.1.37` -> `==3.1.40` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/GitPython/3.1.40?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/GitPython/3.1.40?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/GitPython/3.1.37/3.1.40?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/GitPython/3.1.37/3.1.40?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>gitpython-developers/GitPython (GitPython)</summary>

###
[`v3.1.40`](https://togithub.com/gitpython-developers/GitPython/compare/3.1.38...3.1.40)

[Compare
Source](https://togithub.com/gitpython-developers/GitPython/compare/3.1.38...3.1.40)

###
[`v3.1.38`](https://togithub.com/gitpython-developers/GitPython/releases/tag/3.1.38)

[Compare
Source](https://togithub.com/gitpython-developers/GitPython/compare/3.1.37...3.1.38)

#### What's Changed

- Add missing assert keywords by
[@&#8203;EliahKagan](https://togithub.com/EliahKagan) in
[https://github.com/gitpython-developers/GitPython/pull/1678](https://togithub.com/gitpython-developers/GitPython/pull/1678)
- Make clear every test's status in every CI run by
[@&#8203;EliahKagan](https://togithub.com/EliahKagan) in
[https://github.com/gitpython-developers/GitPython/pull/1679](https://togithub.com/gitpython-developers/GitPython/pull/1679)
- Fix new link to license in readme by
[@&#8203;EliahKagan](https://togithub.com/EliahKagan) in
[https://github.com/gitpython-developers/GitPython/pull/1680](https://togithub.com/gitpython-developers/GitPython/pull/1680)
- Drop unneeded flake8 suppressions by
[@&#8203;EliahKagan](https://togithub.com/EliahKagan) in
[https://github.com/gitpython-developers/GitPython/pull/1681](https://togithub.com/gitpython-developers/GitPython/pull/1681)
- Update instructions and test helpers for git-daemon by
[@&#8203;EliahKagan](https://togithub.com/EliahKagan) in
[https://github.com/gitpython-developers/GitPython/pull/1684](https://togithub.com/gitpython-developers/GitPython/pull/1684)
- Fix Git.execute shell use and reporting bugs by
[@&#8203;EliahKagan](https://togithub.com/EliahKagan) in
[https://github.com/gitpython-developers/GitPython/pull/1687](https://togithub.com/gitpython-developers/GitPython/pull/1687)
- No longer allow CI to select a prerelease for 3.12 by
[@&#8203;EliahKagan](https://togithub.com/EliahKagan) in
[https://github.com/gitpython-developers/GitPython/pull/1689](https://togithub.com/gitpython-developers/GitPython/pull/1689)
- Clarify Git.execute and Popen arguments by
[@&#8203;EliahKagan](https://togithub.com/EliahKagan) in
[https://github.com/gitpython-developers/GitPython/pull/1688](https://togithub.com/gitpython-developers/GitPython/pull/1688)
- Ask git where its daemon is and use that by
[@&#8203;EliahKagan](https://togithub.com/EliahKagan) in
[https://github.com/gitpython-developers/GitPython/pull/1697](https://togithub.com/gitpython-developers/GitPython/pull/1697)
- Fix bugs affecting exception wrapping in rmtree callback by
[@&#8203;EliahKagan](https://togithub.com/EliahKagan) in
[https://github.com/gitpython-developers/GitPython/pull/1700](https://togithub.com/gitpython-developers/GitPython/pull/1700)
- Fix dynamically-set **all** variable by
[@&#8203;DeflateAwning](https://togithub.com/DeflateAwning) in
[https://github.com/gitpython-developers/GitPython/pull/1659](https://togithub.com/gitpython-developers/GitPython/pull/1659)
- Fix small
[#&#8203;1662](https://togithub.com/gitpython-developers/GitPython/issues/1662)
regression due to
[#&#8203;1659](https://togithub.com/gitpython-developers/GitPython/issues/1659)
by [@&#8203;EliahKagan](https://togithub.com/EliahKagan) in
[https://github.com/gitpython-developers/GitPython/pull/1701](https://togithub.com/gitpython-developers/GitPython/pull/1701)
- Drop obsolete info on yanking from security policy by
[@&#8203;EliahKagan](https://togithub.com/EliahKagan) in
[https://github.com/gitpython-developers/GitPython/pull/1703](https://togithub.com/gitpython-developers/GitPython/pull/1703)
- Have Dependabot offer submodule updates by
[@&#8203;EliahKagan](https://togithub.com/EliahKagan) in
[https://github.com/gitpython-developers/GitPython/pull/1702](https://togithub.com/gitpython-developers/GitPython/pull/1702)
- Bump git/ext/gitdb from `49c3178` to `8ec2390` by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/gitpython-developers/GitPython/pull/1704](https://togithub.com/gitpython-developers/GitPython/pull/1704)
- Bump git/ext/gitdb from `8ec2390` to `6a22706` by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/gitpython-developers/GitPython/pull/1705](https://togithub.com/gitpython-developers/GitPython/pull/1705)
- Update readme for milestone-less releasing by
[@&#8203;EliahKagan](https://togithub.com/EliahKagan) in
[https://github.com/gitpython-developers/GitPython/pull/1707](https://togithub.com/gitpython-developers/GitPython/pull/1707)
- Run Cygwin CI workflow commands in login shells by
[@&#8203;EliahKagan](https://togithub.com/EliahKagan) in
[https://github.com/gitpython-developers/GitPython/pull/1709](https://togithub.com/gitpython-developers/GitPython/pull/1709)

#### New Contributors

- [@&#8203;DeflateAwning](https://togithub.com/DeflateAwning) made their
first contribution in
[https://github.com/gitpython-developers/GitPython/pull/1659](https://togithub.com/gitpython-developers/GitPython/pull/1659)

**Full Changelog**:
gitpython-developers/GitPython@3.1.37...3.1.38

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/allenporter/flux-local).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xOS4yIiwidXBkYXRlZEluVmVyIjoiMzcuMTkuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@EliahKagan EliahKagan mentioned this pull request Jan 19, 2024
Override bash executable, defaulting to Git for Windows git bash over WSL bash #1791
Closed
@EliahKagan EliahKagan mentioned this pull request Feb 20, 2024
Overbroad xfail marks will eventually make CI fail #1728
Closed
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Feb 24, 2024
@EliahKagan
Add refresh to top-level __all__
7c69fae
This makes the git.refresh function unambiguously public.

git.refresh was already public in the sense that it was explicitly
documented as appropriate to call from code outside GitPython.
However, it had not been included in git.__all__.

Because __all__ existed but omitted "refresh", git.refresh had
appeared non-public to automated tools.

This also does some cleanup:

- It removes a comment that showed how git.__all__ had been defined
  dynamically before gitpython-developers#1659, since with the addition of "refresh",
  git.__all__ no longer contains exactly the same elements as that
  technique produced (as it examined the module's contents prior to
  running the def statement that bound the name "refresh").

- With that comment removed, it is no longer necessary to define
  __all__ below the imports to show what the dynamic techinque had
  operated on. So this moves it up above them in accordance with
  PEP-8.
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Feb 24, 2024
@EliahKagan
Deprecate public access to typing imports in git
bd0ffe6
This adds comments to entries in git.__all__ for each of the
entries that come from the standard library typing module, noting
them as deprecated.

These imports were included in __all__ inadvertently due to the
way __all__ was dynamically constructed, and placed in __all__
explicitly when __all__ became static in gitpython-developers#1659. They are there for
backward compatibility, in case some code relies on them being
there. But a module is unlikely to rely intentionally on the git
module providing them, since they are not conceptually related to
GitPython.

`from git import *` should not typically be used, since wildcard
imports are not generally recommended, as discussed in PEP-8. But
if someone does choose to use it, they would probably benefit less
from DeprecationWarning being issued for each of those names than
they would usually benefit from DeprecationWarning. This could lead
to developers deciding not to enable DeprecationWarning when it may
otherwise be useful. For this reason, no attempt is currently made
to issue DeprecationWarning when those names are accessed as
attributes of the git module.
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Mar 5, 2024
@EliahKagan
Add refresh to top-level __all__
de10791
This makes the git.refresh function unambiguously public.

git.refresh was already public in the sense that it was explicitly
documented as appropriate to call from code outside GitPython.
However, it had not been included in git.__all__.

Because __all__ existed but omitted "refresh", git.refresh had
appeared non-public to automated tools.

This also does some cleanup:

- It removes a comment that showed how git.__all__ had been defined
  dynamically before gitpython-developers#1659, since with the addition of "refresh",
  git.__all__ no longer contains exactly the same elements as that
  technique produced (as it examined the module's contents prior to
  running the def statement that bound the name "refresh").

- With that comment removed, it is no longer necessary to define
  __all__ below the imports to show what the dynamic techinque had
  operated on. So this moves it up above them in accordance with
  PEP-8.
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Mar 5, 2024
@EliahKagan
Deprecate public access to typing imports in git
903f328
This adds comments to entries in git.__all__ for each of the
entries that come from the standard library typing module, noting
them as deprecated.

These imports were included in __all__ inadvertently due to the
way __all__ was dynamically constructed, and placed in __all__
explicitly when __all__ became static in gitpython-developers#1659. They are there for
backward compatibility, in case some code relies on them being
there. But a module is unlikely to rely intentionally on the git
module providing them, since they are not conceptually related to
GitPython.

`from git import *` should not typically be used, since wildcard
imports are not generally recommended, as discussed in PEP-8. But
if someone does choose to use it, they would probably benefit less
from DeprecationWarning being issued for each of those names than
they would usually benefit from DeprecationWarning. This could lead
to developers deciding not to enable DeprecationWarning when it may
otherwise be useful. For this reason, no attempt is currently made
to issue DeprecationWarning when those names are accessed as
attributes of the git module.
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Mar 9, 2024
@EliahKagan
Add refresh to top-level __all__
e49327d
This makes the git.refresh function unambiguously public.

git.refresh was already public in the sense that it was explicitly
documented as appropriate to call from code outside GitPython.
However, it had not been included in git.__all__.

Because __all__ existed but omitted "refresh", git.refresh had
appeared non-public to automated tools.

This also does some cleanup:

- It removes a comment that showed how git.__all__ had been defined
  dynamically before gitpython-developers#1659, since with the addition of "refresh",
  git.__all__ no longer contains exactly the same elements as that
  technique produced (as it examined the module's contents prior to
  running the def statement that bound the name "refresh").

- With that comment removed, it is no longer necessary to define
  __all__ below the imports to show what the dynamic techinque had
  operated on. So this moves it up above them in accordance with
  PEP-8.
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Mar 9, 2024
@EliahKagan
Deprecate public access to typing imports in git
c8ad3a3
This adds comments to entries in git.__all__ for each of the
entries that come from the standard library typing module, noting
them as deprecated.

These imports were included in __all__ inadvertently due to the
way __all__ was dynamically constructed, and placed in __all__
explicitly when __all__ became static in gitpython-developers#1659. They are there for
backward compatibility, in case some code relies on them being
there. But a module is unlikely to rely intentionally on the git
module providing them, since they are not conceptually related to
GitPython.

`from git import *` should not typically be used, since wildcard
imports are not generally recommended, as discussed in PEP-8. But
if someone does choose to use it, they would probably benefit less
from DeprecationWarning being issued for each of those names than
they would usually benefit from DeprecationWarning. This could lead
to developers deciding not to enable DeprecationWarning when it may
otherwise be useful. For this reason, no attempt is currently made
to issue DeprecationWarning when those names are accessed as
attributes of the git module.
This was referenced Mar 11, 2024
Improve static typing and docstrings related to git object types #1859
Merged
Top-level refresh function not listed in __all__ #1875
Closed
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Mar 18, 2024
@EliahKagan
Fix git.objects.__all__ and make submodules explicit
f89d065
The submodules being made explicit here are of course Python
submodules, not git submodules.

The git.objects.submodule Python submodule (which is *about* git
submodules) is made explicit here (as are the names imported from
that Python submodule's own Python submodules) along with the other
Python submodules of git.objects.

Unlike some other submodules, but like the top-level git module
until gitpython-developers#1659, git.objects already defined __all__ but it was
dynamically constructed. As with git.__all__ previously (as noted
in gitpython-developers#1859), I have used https://github.com/EliahKagan/deltall here
to check that it is safe, sufficient, and probably necessary to
replace this dynamically constructed __all__ with a literal list of
strings in which all of the original elements are included. See:
https://gist.github.com/EliahKagan/e627603717ca5f9cafaf8de9d9f27ad7

Running the modattrs.py script, and diffing against the output from
before the current import refactoring began, reveals two changes to
module contents as a result of the change here:

- git.objects no longer contains `inspect`, which it imported just
  to build the dynamically constructed __all__. Because this was
  not itself included in that __all__ or otherwise made public or
  used out of git.objects, that is okay. This is exactly analogous
  to the situation in 8197e90, which removed it from the top-level
  git module after gitpython-developers#1659.

- The top-level git module now has has new attributes blob, commit,
  submodule, and tree, aliasing the corresponding modules. This
  has happened as a result of them being put in git.objects.__all__
  along with various names imported from them. (As noted in some
  prior commits, there are tradeoffs associated with doing this,
  and it may be that such elements of __all__ should be removed,
  here and elsewhere.)
@EliahKagan EliahKagan mentioned this pull request Mar 19, 2024
Replace all wildcard imports with explicit imports #1880
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Byron Byron Byron requested changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@DeflateAwning @Byron
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.