From 85b1b98295ab88316005357992b1793d7af3b2d3 Mon Sep 17 00:00:00 2001 From: Dave Shawley Date: Wed, 21 Jul 2021 12:17:28 -0400 Subject: [PATCH 1/4] Fix distribution upload breakage. The upload phase now fails if there is anything unexpected in the long description such as uninterpreted roles (e.g., `:class:`). The ReST specifications does call out that: > Only pre-determined roles are recognized; unknown roles will > generate errors. I added a distcheck job in the tox.ini to make this easier to catch in the future. --- README.rst | 4 ++-- tox.ini | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 5584c4c..882eeb4 100644 --- a/README.rst +++ b/README.rst @@ -50,13 +50,13 @@ the payload. If you are a `python-statsd`_ user, then the method names should look very familiar. That is quite intentional. I like the interface and many others do as well. There is one very very important difference though -- the -``timing`` method takes the duration as the number of **seconds** as a :class:`float` instead of the number of +``timing`` method takes the duration as the number of **seconds** as a ``float`` instead of the number of milliseconds. .. warning:: If you are accustomed to using `python-statsd`_, be aware that the ``timing`` method expects the number of - seconds as a :class:`float` instead of the number of milliseconds. + seconds as a ``float`` instead of the number of milliseconds. .. _python-statsd: https://statsd.readthedocs.io/en/latest/ diff --git a/tox.ini b/tox.ini index 64481a1..e9478f1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = lint,py37,py38,py39,tornado5 +envlist = lint,distcheck,py37,py38,py39,tornado5 toxworkdir = ./build/tox [testenv] @@ -13,6 +13,17 @@ commands = flake8 sprockets_statsd tests yapf -dr sprockets_statsd tests +[testenv:distcheck] +deps = + twine + wheel +commands = + rm -fr {envtmpdir}/dist + python setup.py sdist --dist-dir {envtmpdir}/dist + python setup.py bdist_wheel --dist-dir {envtmpdir}/dist + twine check {envtmpdir}/dist/* + rm -fr {envtmpdir}/dist + [testenv:tornado5] deps = tornado>=5,<6 From 10d95519a39bd6362f9ab36abd4fc765d607861f Mon Sep 17 00:00:00 2001 From: Dave Shawley Date: Wed, 21 Jul 2021 12:23:34 -0400 Subject: [PATCH 2/4] Format setup.py with yapf. --- setup.py | 1 + tox.ini | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index cfe6f32..61cc244 100755 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ #!/usr/bin/env python import setuptools + setuptools.setup() diff --git a/tox.ini b/tox.ini index e9478f1..0bdd33d 100644 --- a/tox.ini +++ b/tox.ini @@ -10,8 +10,8 @@ commands = [testenv:lint] commands = - flake8 sprockets_statsd tests - yapf -dr sprockets_statsd tests + flake8 sprockets_statsd tests setup.py docs/conf.py + yapf -dr sprockets_statsd tests setup.py docs/conf.py [testenv:distcheck] deps = From 589412693e40d12a54f5c9a2a91569cb769560db Mon Sep 17 00:00:00 2001 From: Dave Shawley Date: Wed, 21 Jul 2021 12:23:53 -0400 Subject: [PATCH 3/4] Stop using generic typing for asyncio.Queue. This feature isn't available in all versions of Python. --- sprockets_statsd/statsd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sprockets_statsd/statsd.py b/sprockets_statsd/statsd.py index 9571c2c..01d3121 100644 --- a/sprockets_statsd/statsd.py +++ b/sprockets_statsd/statsd.py @@ -486,7 +486,7 @@ class Processor: logger: logging.Logger protocol: typing.Optional[StatsdProtocol] - queue: asyncio.Queue[bytes] + queue: asyncio.Queue _create_transport: typing.Callable[[], typing.Coroutine[ typing.Any, typing.Any, typing.Tuple[asyncio.BaseTransport, StatsdProtocol]]] From d0b860edc071b5db1d4de70d5fd8885826ec8c36 Mon Sep 17 00:00:00 2001 From: Dave Shawley Date: Wed, 21 Jul 2021 12:27:33 -0400 Subject: [PATCH 4/4] Improve the GitHub test phase. I incorporated the changes in tox.ini into the automated test workflow so that we do not end up tagging a broken build :/ --- .github/workflows/run-tests.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index bf21fd4..b108fba 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -21,15 +21,21 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip setuptools + python -m pip install --upgrade pip setuptools twine wheel python -m pip install '.[dev]' python -m pip install -e . - name: Lint run: | - flake8 sprockets_statsd tests + flake8 sprockets_statsd tests setup.py docs/conf.py - name: Check format run: | - yapf -dr sprockets_statsd tests + yapf -dr sprockets_statsd tests setup.py docs/conf.py + - name: Verify distribution build + run: | + rm -fr dist + python setup.py bdist_wheel + python setup.py sdist + twine check dist/* - name: Run tests run: | coverage run -m unittest