Skip to content

Commit

Permalink
PEP 561 compatibility: Expose type information (#116)
Browse files Browse the repository at this point in the history
* Add PEP-561 support

* Fix mypy with up-to-date marshmallow

* Update changelog
  • Loading branch information
hukkinj1 authored and sloria committed Dec 7, 2019
1 parent 67a9433 commit 95cb064
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
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

0 comments on commit 95cb064

Please sign in to comment.