Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a py.typed for type checkers #35

Closed
wants to merge 2,569 commits into from
Closed

Added a py.typed for type checkers #35

wants to merge 2,569 commits into from

Conversation

thomasaarholt
Copy link
Owner

Description of the change

In order for type checkers like pyright to "turn on" type checking for an installed package, that package must either provide a type stub (a .pyi "dummy" python file that only includes type signatures) or it must include an empty py.typed file in the package directory. See PEP561 for reference.

My change adds the py.typed file and also ensures that it is installed via setuptools.

Now, installing it in a venv as pip install <path-to-hyperspy>, I go from this error message and no hints:
image

to this successful type hinting:
Screenshot 2024-10-07 at 19 31 08

Progress of the PR

  • Change implemented (can be split into several points),
  • update docstring (if appropriate),
  • update user guide (if appropriate),
  • add an changelog entry in the upcoming_changes folder (see upcoming_changes/README.rst),
  • Check formatting changelog entry in the readthedocs doc build of this PR (link in github checks)
  • add tests,
  • ready for review.

ericpre and others added 30 commits May 8, 2024 09:00
Fix `hs.plot.plot_roi_map` when using `CircleROI` and improvements
Co-authored-by: Jonas Lähnemann <[email protected]>
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2.0.4 to 2.0.5.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](softprops/action-gh-release@9d7c94c...69320db)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.2 → v0.4.4](astral-sh/ruff-pre-commit@v0.4.2...v0.4.4)
…onfig

[pre-commit.ci] pre-commit autoupdate
…ons/RELEASE_next_patch/softprops/action-gh-release-2.0.5

Bump softprops/action-gh-release from 2.0.4 to 2.0.5
Co-authored-by: Eric Prestat <[email protected]>
Co-authored-by: Eric Prestat <[email protected]>
ericpre and others added 28 commits September 18, 2024 16:58
… backend - various issues fixed in matplotlib 3.9
Add parameters to specify matplotlib axes in `hs.plot.plot_*`
This tells type checkers like pyright that this project includes type
hints and does not require a type stub for type elucidation
@thomasaarholt
Copy link
Owner Author

Well, something went wrong with the commits here due to a rebase. Closing.

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.

7 participants