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 warning in Pyright ("Repo" not exported from module "git") · Issue #1656 · gitpython-developers/GitPython

Fix warning in Pyright ("Repo" not exported from module "git") #1656

New issue
Copy link
New issue
Copy link
Closed
Closed
Fix warning in Pyright ("Repo" not exported from module "git")#1656
Copy link
Labels
acknowledgedhelp wanted

Description

@DeflateAwning
DeflateAwning
opened on Sep 12, 2023
Issue body actions

In Pyright, the following line of code causes the following error:

import git
gitRepo = git.Repo(__file__)

Error:
image

Activity

  1. EliahKagan commented on Sep 12, 2023

    @EliahKagan
    EliahKagan
    on Sep 12, 2023
    Member
    More actions

    I think this happens because git.__all__ is built dynamically:

    GitPython/git/__init__.py

    Line 64 in c8e303f

    __all__ = [name for name, obj in locals().items() if not (name.startswith("_") or inspect.ismodule(obj))]

    Although "Repo" is in it, it's not given literally, and with pyright being a static analyzer, it cannot figure that out.

    There are some other places where * imports are used that I expect might produce a similar effect, albeit for attributes that might be absent rather than attributes that might be considered private.

  2. Byron
    added
    acknowledged
    help wanted
    on Sep 12, 2023
  3. Byron commented on Sep 12, 2023

    @Byron
    Byron
    on Sep 12, 2023
    Member
    More actions

    Thanks for posting, and thanks for the analysis @EliahKagan!

    Spelling out __all__ should be easy enough and since GitPython is very stable, I don't think maintaining it would be a problem anymore. Since GitPython started to support type annotation, I think it's worth it to try make it even more useful, to get more mileage out of it.

    Reacted by Eliah Kagan and Philipp Temminghoff
  4. DeflateAwning commented on Oct 17, 2023

    @DeflateAwning
    DeflateAwning
    on Oct 17, 2023
    ContributorAuthor
    More actions

    This issue is resolved with #1659

  5. DeflateAwning
    closed this as completedon Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acknowledgedhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      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.