optimize typing#37
Open
district10 wants to merge 4 commits into
Open
Conversation
Covers GeoJSON/Geobuf/GeobufIndex APIs with emphasis on non-obvious patterns such as the __call__() conversion convention, the properties()() double-call idiom, mutable vs copy numpy views, and the two-step GeobufIndex workflow for large-file random access. Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com>
`from ._core import *` does not make submodules visible to Pyright/Pylance, so `from pybind11_geobuf import geojson` had no completions while `from pybind11_geobuf._core import geojson` worked fine. Using `import X as X` signals an intentional public re-export per PEP 484, making both import paths equivalent for type checkers. Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com>
Use `import X as X` for every name in _core.__all__ so Pyright/Pylance recognises them as intentional public re-exports from pybind11_geobuf, not just transient wildcard imports. Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com>
The X as X re-export pattern is required by type checkers (PEP 484) but triggers pylint/ruff PLC0414 (useless-import-alias) in .py files. Moving it to __init__.pyi keeps the runtime code clean and avoids lint errors since stub files are not linted. Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.