From 07723dc38d95404090856f695097f815f9c0625e Mon Sep 17 00:00:00 2001 From: pgjones Date: Sat, 15 Feb 2020 14:20:05 +0000 Subject: [PATCH] Move code to a src directory This is gaining traction in the community as well as avoiding some potential testing pitfalls, see https://hynek.me/articles/testing-packaging/ --- MANIFEST.in | 2 +- setup.py | 6 +++--- {wsproto => src/wsproto}/__init__.py | 0 {wsproto => src/wsproto}/connection.py | 0 {wsproto => src/wsproto}/events.py | 0 {wsproto => src/wsproto}/extensions.py | 0 {wsproto => src/wsproto}/frame_protocol.py | 0 {wsproto => src/wsproto}/handshake.py | 0 {wsproto => src/wsproto}/py.typed | 0 {wsproto => src/wsproto}/typing.py | 0 {wsproto => src/wsproto}/utilities.py | 0 tox.ini | 6 +++--- 12 files changed, 7 insertions(+), 7 deletions(-) rename {wsproto => src/wsproto}/__init__.py (100%) rename {wsproto => src/wsproto}/connection.py (100%) rename {wsproto => src/wsproto}/events.py (100%) rename {wsproto => src/wsproto}/extensions.py (100%) rename {wsproto => src/wsproto}/frame_protocol.py (100%) rename {wsproto => src/wsproto}/handshake.py (100%) rename {wsproto => src/wsproto}/py.typed (100%) rename {wsproto => src/wsproto}/typing.py (100%) rename {wsproto => src/wsproto}/utilities.py (100%) diff --git a/MANIFEST.in b/MANIFEST.in index fcafa34..238b07b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,7 +2,7 @@ graft compliance graft example graft docs graft test -graft wsproto +graft src/wsproto prune docs/build prune compliance/autobahntestsuite-venv prune compliance/reports diff --git a/setup.py b/setup.py index c286f6b..689cd14 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ # Get the version version_regex = r'__version__ = ["\']([^"\']*)["\']' -with open(os.path.join(PROJECT_ROOT, 'wsproto/__init__.py')) as file_: +with open(os.path.join(PROJECT_ROOT, 'src/wsproto/__init__.py')) as file_: text = file_.read() match = re.search(version_regex, text) @@ -35,9 +35,9 @@ author='Benno Rice', author_email='benno@jeamland.net', url='https://github.com/python-hyper/wsproto/', - packages=find_packages(exclude=['test']), + packages=find_packages("src"), + package_dir={"": "src"}, package_data={'': ['LICENSE', 'README.rst']}, - package_dir={'wsproto': 'wsproto'}, python_requires=">=3.6.1", include_package_data=True, license='MIT', diff --git a/wsproto/__init__.py b/src/wsproto/__init__.py similarity index 100% rename from wsproto/__init__.py rename to src/wsproto/__init__.py diff --git a/wsproto/connection.py b/src/wsproto/connection.py similarity index 100% rename from wsproto/connection.py rename to src/wsproto/connection.py diff --git a/wsproto/events.py b/src/wsproto/events.py similarity index 100% rename from wsproto/events.py rename to src/wsproto/events.py diff --git a/wsproto/extensions.py b/src/wsproto/extensions.py similarity index 100% rename from wsproto/extensions.py rename to src/wsproto/extensions.py diff --git a/wsproto/frame_protocol.py b/src/wsproto/frame_protocol.py similarity index 100% rename from wsproto/frame_protocol.py rename to src/wsproto/frame_protocol.py diff --git a/wsproto/handshake.py b/src/wsproto/handshake.py similarity index 100% rename from wsproto/handshake.py rename to src/wsproto/handshake.py diff --git a/wsproto/py.typed b/src/wsproto/py.typed similarity index 100% rename from wsproto/py.typed rename to src/wsproto/py.typed diff --git a/wsproto/typing.py b/src/wsproto/typing.py similarity index 100% rename from wsproto/typing.py rename to src/wsproto/typing.py diff --git a/wsproto/utilities.py b/src/wsproto/utilities.py similarity index 100% rename from wsproto/utilities.py rename to src/wsproto/utilities.py diff --git a/tox.ini b/tox.ini index 4e05e0e..7c901f6 100644 --- a/tox.ini +++ b/tox.ini @@ -29,14 +29,14 @@ deps = black isort commands = - black --check --diff wsproto/ test/ example/ compliance/ - isort --dont-skip __init__.py --diff --check --settings-path setup.cfg --recursive wsproto test example compliance + black --check --diff src/wsproto/ test/ example/ compliance/ + isort --dont-skip __init__.py --diff --check --settings-path setup.cfg --recursive src/wsproto test example compliance [testenv:mypy] basepython = python3.8 deps = mypy commands = - mypy wsproto/ test/ example/ + mypy src/wsproto/ test/ example/ [testenv:lint] basepython = python3.8