Skip to content

add type annotations #138

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

Closed
wants to merge 8 commits into from

Conversation

graingert
Copy link
Contributor

No description provided.

@graingert graingert force-pushed the add-type-annotations branch 3 times, most recently from 79982ea to 1d02267 Compare April 16, 2021 12:20
@graingert graingert force-pushed the add-type-annotations branch from 5bfed60 to fb16674 Compare April 16, 2021 20:21
@graingert graingert force-pushed the add-type-annotations branch from c9da8cb to 70a3077 Compare April 16, 2021 20:29
@graingert
Copy link
Contributor Author

@Kriechi ok finally this is passing, and ready for review :D !

self._maximum_streams + 1
)
"Refusing to insert %d streams into priority tree at once"
% (self._maximum_streams + 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to switch over to the new F-strings / PEP 498 to improve readability and code flow.
Would you mind including this throughout the project?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll apply pyupgrade --py36-plus, and black, etc in the next PR, I'll copy in the pre-commit config from twisted

@@ -17,8 +17,11 @@ deps =
pytest-cov>=2.10,<3
pytest-xdist>=2.1,<3
hypothesis>=6.9,<6.10
extras =
mypy: mypy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reason for extras here? Let's make it and explicit dependency!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or alternatively, move mypy testing into a dedicated env, as we have done for wsproto https://github.com/python-hyper/wsproto/blob/55bf7a4ee1e85e3ebc93f04708327b0d0f193925/tox.ini#L40-L46

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's convenient to use extras when developing outside of tox, I'm planning on moving the test deps to extras too

@@ -1,3 +1,43 @@
[metadata]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this doesn't look that bad (actually quite nice), I would prefer to keep the projects within the python-hyper org as similar as possible, especially for all HTTP/2 projects: h2, hpack, hyperframe, and now priority.

Do you have strong arguments or feels for stripping setup.py and moving it to setup.cfg? And what about pyproject.toml, I'd rather not open this topic and stay with the "traditional" way for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setuptools strongly recommends using the declarative metadata for configuration. I'll obviously move everything over to PEP 621 metadata once ready

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also easier to move to PEP 621 metadata once everything is in a declarative format, as you can use setuptools' parse_configuration() and toml.dumps

@@ -5,5 +5,5 @@ graft visualizer
graft examples
prune docs/build
recursive-include *.py
include README.rst LICENSE CONTRIBUTORS.rst HISTORY.rst tox.ini Makefile
include README.rst LICENSE CONTRIBUTORS.rst HISTORY.rst tox.ini Makefile src/priority/py.typed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't py.typed already be covered by the graft priority statement above?
But I actually suspect that this should be graft src/priority instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, but this is how I've seen it done elsewhere

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still trying to fully understand all the moving parts, but from https://packaging.python.org/guides/using-manifest-in/ I would argue that this is not necessary, because we already have py.typed in the package_data.

@graingert
Copy link
Contributor Author

Can you remove continuous-integration/travis as a required build?

@Kriechi
Copy link
Member

Kriechi commented Apr 17, 2021

A right, the branch requirement! Done.

Kriechi added a commit to Kriechi/priority that referenced this pull request Jun 19, 2021
Kriechi added a commit to Kriechi/priority that referenced this pull request Jun 19, 2021
@Kriechi Kriechi mentioned this pull request Jun 19, 2021
Kriechi added a commit to Kriechi/priority that referenced this pull request Jun 21, 2021
Kriechi added a commit to Kriechi/priority that referenced this pull request Jun 21, 2021
@Kriechi Kriechi closed this in #145 Jun 21, 2021
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.

2 participants