Skip to content

Add PEP 561 type stubs and expand README - #17

Merged
hasanzakeri merged 2 commits into
mainfrom
feat/phase6-stubs
Apr 30, 2026
Merged

hasanzakeri merged 2 commits into
mainfrom
feat/phase6-stubs

Conversation

@hasanzakeri

Copy link
Copy Markdown
Owner

This pull request introduces comprehensive improvements and clarifications to the Python API and documentation for the pyharfrust package. The main changes include the addition of a detailed installation and usage guide in the README.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:

  • Added a detailed installation, quick start, and advanced usage guide to README.md, covering building from source, high-level and object-oriented shaping APIs, configuration types, variable fonts, buffer recycling, and error handling.
  • Added a complete PEP 561 type stub file python/pyharfrust/__init__.pyi, describing all public classes, methods, properties, and exceptions, enabling type checkers and editors to offer full API support.

  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.
@hasanzakeri
hasanzakeri merged commit 839279d into main Apr 30, 2026
2 checks passed
@hasanzakeri
hasanzakeri deleted the feat/phase6-stubs branch April 30, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant