Skip to content

fix: add py.typed marker for PEP 561 support - #16

Merged
Koukyosyumei merged 3 commits into
h5i-dev:mainfrom
knight22-21:typing/add-py-typed-marker
Aug 5, 2026
Merged

Koukyosyumei merged 3 commits into
h5i-dev:mainfrom
knight22-21:typing/add-py-typed-marker

Conversation

@knight22-21

@knight22-21 knight22-21 commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Title

Add py.typed marker so downstream type checkers see SDK annotations

Summary

The SDK is fully type-annotated, but without a PEP 561 py.typed marker, type checkers such as mypy and pyright treat h5i.orchestra as an untyped package. As a result, downstream projects lose signature validation and typed editor completions despite the annotations already present in the SDK.

This PR adds the required py.typed marker, ensures it is included in the built wheel, and extends package CI to verify that installed consumers can resolve the distributed type information.

Related Issue

Fixes #13

Changes

  • Add src/h5i/py.typed (PEP 561 typed-package marker)
  • Update package CI to verify h5i/py.typed is included in the built wheel:
    unzip -l dist/*.whl | grep -F 'h5i/py.typed'
  • Add a mypy smoke test against the installed wheel:
    python -m mypy -c "from h5i.orchestra import Conductor; reveal_type(Conductor)"
  • Add mypy>=1.8 to project.optional-dependencies.dev

Test Plan

  • python -m build produces a wheel containing h5i/py.typed
  • Installed the wheel and ran the mypy smoke check; Conductor reveals its full constructor signature
  • CI package job passes (wheel verification + mypy smoke test)
  • Existing unit and lint jobs remain unaffected

- Sort __all__ lists alphabetically (RUF022)
- Convert Union to | syntax for type annotations (UP007)
- Change ValueError to TypeError for type validation (TRY004)
- Use Self for __aenter__ return type (PYI034)
- Add noqa comments for intentional blind exception catches (BLE001, S110)
- Add explicit check=False to subprocess.run calls (PLW1510)
- Prefix unused variables with underscore (RUF059)
- Wrap implicit string concatenations in parentheses (ISC004)
- Add unused imports to __all__ (F401)
- Remove unused imports (F401)
- Auto-fix import sorting and formatting
@knight22-21

Copy link
Copy Markdown
Contributor Author

Want me to resolve these ruff errors as well? @Koukyosyumei

@Koukyosyumei

Copy link
Copy Markdown
Contributor

@knight22-21 yes, it would be really great!! Thank you so much!

@knight22-21

Copy link
Copy Markdown
Contributor Author

You can check it now, I have completed the necessary changes. @Koukyosyumei

- Add UTF-8 encoding to Path.read_text() calls in test_examples.py to fix UnicodeDecodeError on Windows
- Use concrete class name Conductor instead of Self for __aenter__ return type (Python 3.10 compatibility)
- Add noqa: PYI034 comment to suppress Ruff warning for intentional deviation
- Keep zero runtime dependencies for Python 3.10+ compatibility
@Koukyosyumei

Copy link
Copy Markdown
Contributor

LGTM!

@Koukyosyumei
Koukyosyumei merged commit 0b909a8 into h5i-dev:main Aug 5, 2026
7 checks passed
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.

typing: ship a py.typed marker so downstream mypy/pyright actually see our type hints (PEP 561)

2 participants