pybind / pybind/pybind11-stubgen

Ignore private attributes

Open
#81 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
361
Forks
75
PR merge metrics
No merged PRs in 30d

Description

Attributes with a single leading underscore are considered private, not type info should be generated (by default).

Also see https://mypy.readthedocs.io/en/stable/stubgen.html#cmdoption-stubgen-include-private

The following fragment in AttributeStubsGenerator.to_lines seems to do the job:

def to_lines(self):  # type: () -> List[str]
    if re.match(r"^_[^_](.*[^_])?$", self.name):
        pass
    ...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at AttributeStubsGenerator.to_lines, the entry point named in the issue, and inspect how attribute names are converted to stub lines. Verify that single-leading-underscore attributes are omitted by default while the documented include-private behavior remains available. Done means generated stubs no longer include private attributes unless explicitly requested.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.