Skip to content
Closed
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -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.

global-exclude *.pyc *.pyo *.swo *.swp *.map *.yml *.DS_Store
9 changes: 7 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@
import sys
import re

from typing import List

sys.path.insert(0, os.path.abspath('../..'))

PROJECT_ROOT = os.path.dirname(__file__)
# Get the version
version_regex = r'__version__ = ["\']([^"\']*)["\']'
with open(os.path.join(PROJECT_ROOT, '../../', 'src/priority/__init__.py')) as file_:
with open(
os.path.join(PROJECT_ROOT, '../../', 'src/priority/__init__.py')
) as file_:
text = file_.read()
match = re.search(version_regex, text)
assert match
version = match.group(1)


Expand Down Expand Up @@ -51,7 +56,7 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []
exclude_patterns: List[str] = []

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'http://docs.python.org/': None}
Expand Down
50 changes: 50 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -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

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

Expand All @@ -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
63 changes: 2 additions & 61 deletions setup.py
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()
13 changes: 10 additions & 3 deletions src/priority/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
priority: HTTP/2 priority implementation for Python
"""
from .priority import ( # noqa
Stream, PriorityTree, DeadlockError, PriorityLoop, PriorityError,
DuplicateStreamError, MissingStreamError, TooManyStreamsError,
BadWeightError, PseudoStreamError
Stream,
PriorityTree,
DeadlockError,
PriorityLoop,
PriorityError,
DuplicateStreamError,
MissingStreamError,
TooManyStreamsError,
BadWeightError,
PseudoStreamError,
)


Expand Down
Loading