- Notifications
You must be signed in to change notification settings - Fork 11
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
add type annotations #138
Changes from all commits
4011c84
fb16674
6370d2f
5ee7f67
70a3077
833d92c
2ec6c2b
8203665
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,43 @@ | ||
[metadata] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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' | ||
name = priority | ||
version = attr: priority.__version__ | ||
description = A pure-Python implementation of the HTTP/2 priority tree | ||
long_description = file: README.rst, HISTORY.rst | ||
long_description_content_type = text/x-rst | ||
author = Cory Benfield | ||
author_email = cory@lukasa.co.uk | ||
url = https://github.com/python-hyper/priority/ | ||
project_urls = | ||
Documentation=https://python-hyper.org/projects/priority/ | ||
Source=https://github.com/python-hyper/priority/ | ||
Tracker=https://github.com/python-hyper/priority/issues | ||
Changelog=https://github.com/python-hyper/priority/blob/master/HISTORY.rst | ||
license = MIT License | ||
classifiers = | ||
Development Status :: 5 - Production/Stable | ||
Intended Audience :: Developers | ||
License :: OSI Approved :: MIT License | ||
Programming Language :: Python | ||
Programming Language :: Python :: 3 | ||
Programming Language :: Python :: 3.6 | ||
Programming Language :: Python :: 3.7 | ||
Programming Language :: Python :: 3.8 | ||
Programming Language :: Python :: 3.9 | ||
Programming Language :: Python :: Implementation :: CPython | ||
Programming Language :: Python :: Implementation :: PyPy | ||
| ||
[options] | ||
packages = find: | ||
package_dir = =src | ||
python_requires = >=3.6.1 | ||
include_package_data = True | ||
| ||
[options.packages.find] | ||
where = src | ||
| ||
[options.extras_require] | ||
mypy = mypy>=0.812 | ||
| ||
[tool:pytest] | ||
testpaths = test | ||
| ||
| @@ -18,3 +58,13 @@ exclude_lines = | |
source = | ||
src | ||
.tox/*/site-packages | ||
| ||
| ||
[mypy] | ||
strict=true | ||
warn_unused_configs=true | ||
show_error_codes=true | ||
| ||
[mypy-test_priority] | ||
allow_untyped_defs=true | ||
check_untyped_defs=false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,3 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
import os | ||
import re | ||
from setuptools import setup # type: ignore[import] | ||
| ||
from setuptools import setup, find_packages | ||
| ||
| ||
PROJECT_ROOT = os.path.dirname(__file__) | ||
| ||
with open(os.path.join(PROJECT_ROOT, 'README.rst')) as file_: | ||
long_description = file_.read() | ||
long_description +='\n\n' | ||
with open(os.path.join(PROJECT_ROOT, 'HISTORY.rst')) as file_: | ||
long_description += file_.read() | ||
| ||
# Get the version | ||
version_regex = r'__version__ = ["\']([^"\']*)["\']' | ||
with open(os.path.join(PROJECT_ROOT, 'src/priority/__init__.py')) as file_: | ||
text = file_.read() | ||
match = re.search(version_regex, text) | ||
| ||
if match: | ||
version = match.group(1) | ||
else: | ||
raise RuntimeError("No version number found!") | ||
| ||
setup( | ||
name='priority', | ||
version=version, | ||
description='A pure-Python implementation of the HTTP/2 priority tree', | ||
long_description=long_description, | ||
long_description_content_type='text/x-rst', | ||
author='Cory Benfield', | ||
author_email='cory@lukasa.co.uk', | ||
url='https://github.com/python-hyper/priority/', | ||
project_urls={ | ||
'Documentation': 'https://python-hyper.org/projects/priority/', | ||
'Source': 'https://github.com/python-hyper/priority/', | ||
'Tracker': 'https://github.com/python-hyper/priority/issues', | ||
'Changelog': 'https://github.com/python-hyper/priority/blob/master/HISTORY.rst', | ||
}, | ||
packages=find_packages(where='src'), | ||
package_data={'': ['LICENSE', 'README.rst', 'CONTRIBUTORS.rst', 'HISTORY.rst']}, | ||
package_dir={'': 'src'}, | ||
python_requires='>=3.6.1', | ||
include_package_data=True, | ||
license='MIT License', | ||
classifiers=[ | ||
'Development Status :: 5 - Production/Stable', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: MIT License', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Programming Language :: Python :: Implementation :: CPython', | ||
'Programming Language :: Python :: Implementation :: PyPy', | ||
], | ||
) | ||
setup() |
There was a problem hiding this comment.
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 thegraft priority
statement above?But I actually suspect that this should be
graft src/priority
instead?There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 thepackage_data
.