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

PEP 561 compatibility: Expose type information #116

Merged
merged 3 commits into from
Dec 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
## (unreleased)

- Improve typings and run mypy with dependencies type annotations ([#115](https://github.com/sloria/environs/pull/115)).
Thanks [hukkinj1](https://github.com/hukkinj1).
- Distribute types per PEP 561 ([#116](https://github.com/sloria/environs/pull/116)).

Thanks [hukkinj1](https://github.com/hukkinj1) for the PRs..

## 7.0.0 (2019-12-02)

Expand Down
5 changes: 1 addition & 4 deletions environs.py → environs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,7 @@ def _deserialize(self, value, *args, **kwargs) -> Path:


class LogLevelField(ma.fields.Int):
# Type ignore, because the return type annotation of the super
# class is a private TypeVar incompatible with int. The annotation
# in super should probably be Any.
def _format_num(self, value) -> int: # type: ignore
def _format_num(self, value) -> int:
try:
return super()._format_num(value)
except (TypeError, ValueError) as error:
Expand Down
1 change: 1 addition & 0 deletions environs/py.typed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Marker file for PEP 561.
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ def read(fname):

setup(
name="environs",
py_modules=["environs"],
version=find_version("environs.py"),
packages=["environs"],
package_data={"environs": ["py.typed"]},
version=find_version("environs/__init__.py"),
description="simplified environment variable parsing",
long_description=read("README.md"),
long_description_content_type="text/markdown",
Expand All @@ -57,6 +58,7 @@ def read(fname):
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Typing :: Typed",
],
project_urls={
"Issues": "https://github.com/sloria/environs/issues",
Expand Down