Add PEP 561 type stubs and expand README - #17
Merged
Merged
Conversation
Ship `__init__.pyi` covering every public type and function with property signatures, exception notes, and `Sequence[Feature] | str | None` unions that match the runtime accepted shapes. Add an empty `py.typed` marker so type checkers pick up the stubs from an installed wheel — maturin already includes both files from `python-source` without further config. Suppress pyright on the five negative-type test lines that intentionally pass wrong types to verify TypeError. Rewrite the README around installation, the two-tier API (high-level `shape()` and the `Font` / `Buffer` / `GlyphBuffer` object API), variable fonts, buffer recycling, and the error taxonomy.
…Buffer behavior. Added example for `run_from_args(argv)` to demonstrate full CLI parity with `hb-shape`. Updated description of `GlyphBuffer.clear()` to specify its consumption behavior and error handling.
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.
This pull request introduces comprehensive improvements and clarifications to the Python API and documentation for the
pyharfrustpackage. The main changes include the addition of a detailed installation and usage guide in theREADME.md, the introduction of a complete type stub file (__init__.pyi) for type checking and editor support, and minor test adjustments to suppress type checker warnings.Documentation and API improvements:
README.md, covering building from source, high-level and object-oriented shaping APIs, configuration types, variable fonts, buffer recycling, and error handling.python/pyharfrust/__init__.pyi, describing all public classes, methods, properties, and exceptions, enabling type checkers and editors to offer full API support.