Skip to content

Commit 50e6297

Browse files
authored
a couple of packaging fixes (#1632)
- use pep 508 markers to statically express dependencies - remove deprecated use of setup.py as a command line tool
1 parent 924604e commit 50e6297

File tree

6 files changed

+22
-64
lines changed

6 files changed

+22
-64
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ jobs:
3232
run: |
3333
python3 -m pip install --upgrade pip
3434
35-
- name: Install build & wheel
35+
- name: Install build
3636
run:
37-
pip3 install --upgrade build wheel
37+
pip3 install --upgrade build
3838

3939
- name: Build wheel & sdist
4040
run: |

Makefile

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ install:
2929

3030
build:
3131
-rm -f dist/*
32-
# AUTOBAHN_USE_NVX=0 python setup.py sdist --universal
33-
AUTOBAHN_USE_NVX=1 python setup.py sdist
32+
# AUTOBAHN_USE_NVX=0 python -m build
33+
AUTOBAHN_USE_NVX=1 python -m build
3434
ls -la dist
3535

3636
# upload to our internal deployment system
3737
upload: clean
38-
AUTOBAHN_USE_NVX=0 python setup.py sdist --universal
38+
AUTOBAHN_USE_NVX=0 python -m build
3939
aws s3 cp --acl public-read \
4040
dist/autobahn-*.whl \
4141
s3://fabric-deploy/autobahn/
@@ -71,7 +71,7 @@ rebuild_catalog:
7171

7272
# publish to PyPI
7373
publish: clean
74-
AUTOBAHN_USE_NVX=0 python setup.py sdist
74+
AUTOBAHN_USE_NVX=0 python -m build
7575
twine upload dist/*
7676

7777
clean_docs:
@@ -172,10 +172,6 @@ test_styleguide:
172172
test_pytest:
173173
USE_ASYNCIO=1 python -m pytest -c setup.cfg -rsvx autobahn/
174174

175-
# test via setuptools command
176-
test_setuptools:
177-
python setup.py test
178-
179175
test:
180176
tox -e flake8,py37-twtrunk,py37-asyncio
181177

deploy.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ aws --version
2222

2323
# build python source dist and wheels
2424
echo 'building package ..'
25-
python setup.py sdist bdist_wheel --universal
25+
pip install build
26+
python -m build
2627
ls -la ./dist
2728

2829
# upload to S3: https://s3.eu-central-1.amazonaws.com/crossbarbuilder/wheels/

docker/Dockerfile.cpy-slim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ RUN apt-get update \
5050
pkg-config \
5151
libcairo2-dev \
5252
libgirepository1.0-dev \
53-
&& pip install --upgrade --no-cache-dir setuptools pip wheel \
53+
&& pip install --upgrade --no-cache-dir pip \
5454
&& rm -rf ~/.cache \
5555
&& rm -rf /var/lib/apt/lists/*
5656

docker/Dockerfile.pypy-slim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ RUN apt-get update \
5555
pkg-config \
5656
libcairo2-dev \
5757
libgirepository1.0-dev \
58-
&& pip install --upgrade --no-cache-dir setuptools pip wheel \
58+
&& pip install --upgrade --no-cache-dir pip \
5959
&& rm -rf ~/.cache \
6060
&& rm -rf /var/lib/apt/lists/*
6161

setup.py

Lines changed: 12 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,12 @@
2525
###############################################################################
2626

2727
import os
28-
import sys
29-
import shutil
3028
import platform
29+
import shutil
30+
3131
from setuptools import setup
32-
from setuptools.command.test import test as test_command
3332

3433
CPY = platform.python_implementation() == 'CPython'
35-
PYPY = platform.python_implementation() == 'PyPy'
3634

3735
# read version string
3836
with open('autobahn/_version.py') as f:
@@ -51,13 +49,10 @@
5149
]
5250

5351
# C-based WebSocket acceleration (only use on CPython, not PyPy!)
54-
if CPY and sys.platform != 'win32':
55-
# wsaccel does not provide wheels: https://github.com/methane/wsaccel/issues/12
56-
extras_require_accelerate = [
57-
# "wsaccel>=0.6.3" # Apache 2.0
58-
]
59-
else:
60-
extras_require_accelerate = []
52+
# wsaccel does not provide wheels: https://github.com/methane/wsaccel/issues/12
53+
extras_require_accelerate = [
54+
# "wsaccel>=0.6.3 ; platform_python_implementation == 'CPython' and sys_platform != 'win32'" # Apache 2.0
55+
]
6156

6257
# non-standard WebSocket compression support (FIXME: consider removing altogether)
6358
# Ubuntu: sudo apt-get install libsnappy-dev
@@ -67,16 +62,13 @@
6762

6863
# accelerated JSON and non-JSON WAMP serialization support (namely MessagePack, CBOR and UBJSON)
6964
extras_require_serialization = []
70-
if CPY:
71-
extras_require_serialization.extend([
72-
'msgpack>=1.0.2', # Apache 2.0 license
73-
'ujson>=4.0.2', # BSD license
74-
])
75-
else:
65+
extras_require_serialization.extend([
66+
'msgpack>=1.0.2 ; platform_python_implementation == "CPython"', # Apache 2.0 license
67+
'ujson>=4.0.2 ; platform_python_implementation == "CPython"', # BSD license
68+
'u-msgpack-python>=2.1 ; platform_python_implementation != "CPython"', # MIT license
69+
])
70+
if not CPY:
7671
os.environ['PYUBJSON_NO_EXTENSION'] = '1' # enforce use of pure Python py-ubjson (no Cython)
77-
extras_require_serialization.extend([
78-
'u-msgpack-python>=2.1', # MIT license
79-
])
8072

8173
extras_require_serialization.extend([
8274
'cbor2>=5.2.0', # MIT license
@@ -227,33 +219,6 @@
227219
if not line.startswith('#'):
228220
extras_require_dev.append(line)
229221

230-
# for testing by users with "python setup.py test" (not Tox, which we use)
231-
test_requirements = [
232-
"pytest>=2.8.6,<3.3.0", # MIT license
233-
]
234-
235-
236-
class PyTest(test_command):
237-
"""
238-
pytest integration for setuptools.
239-
240-
see:
241-
- http://pytest.org/latest/goodpractises.html#integration-with-setuptools-test-commands
242-
- https://github.com/pyca/cryptography/pull/678/files
243-
"""
244-
245-
def finalize_options(self):
246-
test_command.finalize_options(self)
247-
self.test_args = []
248-
self.test_suite = True
249-
250-
def run_tests(self):
251-
# Import here because in module scope the eggs are not loaded.
252-
import pytest
253-
errno = pytest.main(self.test_args)
254-
sys.exit(errno)
255-
256-
257222
setup(
258223
name='autobahn',
259224
version=__version__, # noqa
@@ -286,10 +251,6 @@ def run_tests(self):
286251
'xbr': extras_require_xbr,
287252
'ui': extras_require_ui,
288253
},
289-
tests_require=test_requirements,
290-
cmdclass={
291-
'test': PyTest
292-
},
293254
packages=packages,
294255
package_data=package_data,
295256
cffi_modules=cffi_modules,

0 commit comments

Comments
 (0)