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

fix: py.typed #347

Closed
wants to merge 1 commit into from
Closed

fix: py.typed #347

wants to merge 1 commit into from

Conversation

henryiii
Copy link

@henryiii henryiii commented Jan 6, 2021

This package is missing a py.typed file, so downstream projects will not
show up in mypy or other type checkers, even though it has nice .pyi
files. This adds a the token file, which will cause mypy to pick it up
and use it. See PEP 0561.

It was also missing the .pyi files from the wheel (noticeable when running
pip install build && python -m build), added include_package_data to
fix that.

Edit: Actually I ran pipx install build && pyproject-build, but that's the same thing.

Closes #318

This package is missing a py.typed file, so downstream projects will not
show up in mypy or other type checkers, even though it has nice .pyi
files. This adds a the token file, which will cause mypy to pick it up
and use it. See [PEP 0561](https://www.python.org/dev/peps/pep-0561/\).

It was also missing the .pyi files from the wheel (noticed when running
`pip install build && python -m build`), added `include_package_data` to
fix that.
@henryiii
Copy link
Author

henryiii commented Jan 6, 2021

This was attempted before in #318, apparently, but the py.typed fix is missing from that, which is quite important.

@codecov-io
Copy link

codecov-io commented Jan 6, 2021

Codecov Report

Merging #347 (0fa383f) into master (3f637db) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #347   +/-   ##
=======================================
  Coverage   89.74%   89.74%           
=======================================
  Files           5        5           
  Lines        1063     1063           
=======================================
  Hits          954      954           
  Misses        109      109           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3f637db...0fa383f. Read the comment docs.

@kevinjacobs-progenity
Copy link

Some of the type stubs look wrong too. e.g.

def load(f: Union[str, list, IO[str]],
         _dict: Type[MutableMapping[str, Any]] = ...,
         decoder: TomlDecoder = ...) \
         -> MutableMapping[str, Any]: ...

should be

def load(
    f: Union[str, list, IO[str]],
   _dict: Optional[Type[MutableMapping[str, Any]]] = None,
    decoder: Optional[TomlDecoder] = None,
) -> MutableMapping[str, Any]: ...

I'm happy to work on this. Any objects to pushing my updates to this PR or should I open a new one?

@henryiii
Copy link
Author

henryiii commented Jun 1, 2021

I'm perfectly happy to have pushes (sorry I missed this before!). One of the reasons this may have worked in the past is that typeshed had toml in it (I believe), but that's going away in the future (0.900), so having these would be especially useful soon!

@wimax-grapl
Copy link

I too have come across this, would be really nice to get it in (and get out of Typeshed!)

@henryiii
Copy link
Author

Tomli and tomllib (in Python 3.11) have replaces this. So closing.

@henryiii henryiii closed this Apr 15, 2022
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.

4 participants