From ae9db85945988e50555ca10a7138f02ef5b8c266 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 30 Aug 2020 11:00:18 -0400 Subject: [PATCH 01/11] more -Ur for pip --- ci/travis.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/travis.sh b/ci/travis.sh index ea3cb62..0920031 100755 --- a/ci/travis.sh +++ b/ci/travis.sh @@ -53,7 +53,7 @@ if [ "$USE_PYPY_RELEASE_VERSION" != "" ]; then source testenv/bin/activate fi -pip install -U pip setuptools wheel +pip install -Ur pip setuptools wheel if [ "$CHECK_FORMATTING" = "1" ]; then pip install yapf==${YAPF_VERSION} @@ -78,7 +78,7 @@ EOF fi python setup.py sdist --formats=zip -pip install dist/*.zip +pip install -Ur dist/*.zip if [ "$CHECK_DOCS" = "1" ]; then pip install -Ur ci/rtd-requirements.txt From fbebf1a6f1b1153967064aa08987b728a000ee3f Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 30 Aug 2020 11:04:14 -0400 Subject: [PATCH 02/11] just more -U --- ci/travis.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/travis.sh b/ci/travis.sh index 0920031..6082bf0 100755 --- a/ci/travis.sh +++ b/ci/travis.sh @@ -53,7 +53,7 @@ if [ "$USE_PYPY_RELEASE_VERSION" != "" ]; then source testenv/bin/activate fi -pip install -Ur pip setuptools wheel +pip install -U pip setuptools wheel if [ "$CHECK_FORMATTING" = "1" ]; then pip install yapf==${YAPF_VERSION} @@ -78,7 +78,7 @@ EOF fi python setup.py sdist --formats=zip -pip install -Ur dist/*.zip +pip install -U dist/*.zip if [ "$CHECK_DOCS" = "1" ]; then pip install -Ur ci/rtd-requirements.txt From 500cc336316bb38e53a3934c30288511c348cce1 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 30 Aug 2020 11:09:38 -0400 Subject: [PATCH 03/11] debug pip freeze --- ci/travis.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/travis.sh b/ci/travis.sh index 6082bf0..92cfb8b 100755 --- a/ci/travis.sh +++ b/ci/travis.sh @@ -77,6 +77,7 @@ EOF exit 0 fi +pip freeze python setup.py sdist --formats=zip pip install -U dist/*.zip From 89c3e6471f251b5beae5743b64752b481fbc5913 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 30 Aug 2020 12:21:19 -0400 Subject: [PATCH 04/11] switch to test-requirements.in/.txt pair --- test-requirements.in | 2 ++ test-requirements.txt | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 test-requirements.in diff --git a/test-requirements.in b/test-requirements.in new file mode 100644 index 0000000..9955dec --- /dev/null +++ b/test-requirements.in @@ -0,0 +1,2 @@ +pytest +pytest-cov diff --git a/test-requirements.txt b/test-requirements.txt index 9955dec..c409c63 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,2 +1,18 @@ -pytest -pytest-cov +# +# This file is autogenerated by pip-compile +# To update, run: +# +# pip-compile --output-file=test-requirements.txt test-requirements.in +# +attrs==20.1.0 # via pytest +coverage==5.2.1 # via pytest-cov +iniconfig==1.0.1 # via pytest +more-itertools==8.5.0 # via pytest +packaging==20.4 # via pytest +pluggy==0.13.1 # via pytest +py==1.9.0 # via pytest +pyparsing==2.4.7 # via packaging +pytest-cov==2.10.1 # via -r test-requirements.in +pytest==6.0.1 # via -r test-requirements.in, pytest-cov +six==1.15.0 # via packaging +toml==0.10.1 # via pytest From f7438648025a04a32e862b1fc4ec7f52016094c8 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 30 Aug 2020 12:25:33 -0400 Subject: [PATCH 05/11] python_requires=">=3.6" because recent trio and pytest-trio do --- .travis.yml | 2 -- setup.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3002df6..3a1bf4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,8 +14,6 @@ matrix: # Uncomment if you want to test on pypy nightly: # - language: generic # env: USE_PYPY_NIGHTLY=1 - - python: 3.5.0 - - python: 3.5.2 - python: 3.6 # As of 2018-07-05, Travis's 3.7 and 3.8 builds only work if you # use dist: xenial AND sudo: required diff --git a/setup.py b/setup.py index 3195c92..e4aafb4 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ keywords=[ "async", "scheduler", "trio", ], - python_requires=">=3.5", + python_requires=">=3.6", classifiers=[ "License :: OSI Approved :: MIT License", "License :: OSI Approved :: Apache Software License", From dc49feb2bd8d58ed2f00b054225036ef127d1492 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 30 Aug 2020 12:26:56 -0400 Subject: [PATCH 06/11] switch to pypy3.6 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3a1bf4d..4acfdf9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ matrix: - python: 3.6 env: CHECK_FORMATTING=1 # The pypy tests are slow, so list them early - - python: pypy3.5 + - python: pypy3.6 # Uncomment if you want to test on pypy nightly: # - language: generic # env: USE_PYPY_NIGHTLY=1 From 3c75cda8a3c7502a96614af836d7952b4c8e220a Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 30 Aug 2020 12:29:03 -0400 Subject: [PATCH 07/11] yapf --- setup.py | 4 +++- trimeter/_impl.py | 12 ++++++------ trimeter/_tests/conftest.py | 1 + trimeter/_tests/test_basics.py | 13 ++++++++----- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/setup.py b/setup.py index e4aafb4..034e4dc 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,9 @@ "attrs", ], keywords=[ - "async", "scheduler", "trio", + "async", + "scheduler", + "trio", ], python_requires=">=3.6", classifiers=[ diff --git a/trimeter/_impl.py b/trimeter/_impl.py index 484a022..480f6ca 100644 --- a/trimeter/_impl.py +++ b/trimeter/_impl.py @@ -56,7 +56,8 @@ def new_state(self): class MaxState: def __init__(self, max_meter): self.sem = trio.Semaphore( - initial_value=max_meter.max_at_once, max_value=max_meter.max_at_once + initial_value=max_meter.max_at_once, + max_value=max_meter.max_at_once ) async def wait_task_can_start(self): @@ -73,7 +74,9 @@ def notify_task_finished(self): @attr.s(frozen=True) class TokenBucketMeter: max_per_second = attr.ib(converter=float, validator=_check_positive) - max_burst = attr.ib(default=1, converter=operator.index, validator=_check_positive) + max_burst = attr.ib( + default=1, converter=operator.index, validator=_check_positive + ) def __attrs_post_init__(self): _check_positive(self, "max_per_second", self.max_per_second) @@ -121,9 +124,7 @@ def notify_task_finished(self): # XX should we have a special-case to allow KeyboardInterrupt to pass through? -async def _worker( - async_fn, value, index, config -): +async def _worker(async_fn, value, index, config): if config.capture_outcome: result = await outcome.acapture(async_fn, value) else: @@ -203,7 +204,6 @@ async def run_on_each( await send_to.aclose() - @asynccontextmanager @async_generator async def amap( diff --git a/trimeter/_tests/conftest.py b/trimeter/_tests/conftest.py index 25c5453..e51a6a2 100644 --- a/trimeter/_tests/conftest.py +++ b/trimeter/_tests/conftest.py @@ -5,6 +5,7 @@ import pytest from trio.testing import MockClock, trio_test + @pytest.fixture def mock_clock(): return MockClock() diff --git a/trimeter/_tests/test_basics.py b/trimeter/_tests/test_basics.py index af6caba..7fd470c 100644 --- a/trimeter/_tests/test_basics.py +++ b/trimeter/_tests/test_basics.py @@ -2,6 +2,7 @@ import trio from trimeter import run_on_each, amap, run_all + # Just the most basic smoke test of the three functions async def test_basics(): ran_on = [] @@ -20,9 +21,11 @@ async def afn(value): results.append(result) assert sorted(results) == [2, 3, 4] - results = await run_all([ - partial(afn, 10), - partial(afn, 11), - partial(afn, 12), - ]) + results = await run_all( + [ + partial(afn, 10), + partial(afn, 11), + partial(afn, 12), + ] + ) assert results == [11, 12, 13] From c2f689696df457e79d1ac446de8857608b2d6611 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 30 Aug 2020 12:30:59 -0400 Subject: [PATCH 08/11] switch to rtd-requirements.in/.txt pair --- ci/rtd-requirements.in | 4 ++++ ci/rtd-requirements.txt | 39 +++++++++++++++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 ci/rtd-requirements.in diff --git a/ci/rtd-requirements.in b/ci/rtd-requirements.in new file mode 100644 index 0000000..67898ba --- /dev/null +++ b/ci/rtd-requirements.in @@ -0,0 +1,4 @@ +# RTD is currently installing 1.5.3, which has a bug in :lineno-match: +sphinx >= 1.6.1 +sphinx_rtd_theme +sphinxcontrib-trio diff --git a/ci/rtd-requirements.txt b/ci/rtd-requirements.txt index 67898ba..8008227 100644 --- a/ci/rtd-requirements.txt +++ b/ci/rtd-requirements.txt @@ -1,4 +1,35 @@ -# RTD is currently installing 1.5.3, which has a bug in :lineno-match: -sphinx >= 1.6.1 -sphinx_rtd_theme -sphinxcontrib-trio +# +# This file is autogenerated by pip-compile +# To update, run: +# +# pip-compile --output-file=rtd-requirements.txt rtd-requirements.in +# +alabaster==0.7.12 # via sphinx +babel==2.8.0 # via sphinx +certifi==2020.6.20 # via requests +chardet==3.0.4 # via requests +docutils==0.16 # via sphinx +idna==2.10 # via requests +imagesize==1.2.0 # via sphinx +jinja2==2.11.2 # via sphinx +markupsafe==1.1.1 # via jinja2 +packaging==20.4 # via sphinx +pygments==2.6.1 # via sphinx +pyparsing==2.4.7 # via packaging +pytz==2020.1 # via babel +requests==2.24.0 # via sphinx +six==1.15.0 # via packaging +snowballstemmer==2.0.0 # via sphinx +sphinx-rtd-theme==0.5.0 # via -r rtd-requirements.in +sphinx==3.2.1 # via -r rtd-requirements.in, sphinx-rtd-theme, sphinxcontrib-trio +sphinxcontrib-applehelp==1.0.2 # via sphinx +sphinxcontrib-devhelp==1.0.2 # via sphinx +sphinxcontrib-htmlhelp==1.0.3 # via sphinx +sphinxcontrib-jsmath==1.0.1 # via sphinx +sphinxcontrib-qthelp==1.0.3 # via sphinx +sphinxcontrib-serializinghtml==1.1.4 # via sphinx +sphinxcontrib-trio==1.1.2 # via -r rtd-requirements.in +urllib3==1.25.10 # via requests + +# The following packages are considered to be unsafe in a requirements file: +# setuptools From a756aa1f5497bd6796247573556ecb725fe93a52 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 30 Aug 2020 12:53:06 -0400 Subject: [PATCH 09/11] more python/pypy updates --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4acfdf9..615be01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,12 +5,12 @@ dist: trusty matrix: include: # These are quick and often catch errors, so list them first - - python: 3.6 + - python: 3.8 env: CHECK_DOCS=1 - - python: 3.6 + - python: 3.8 env: CHECK_FORMATTING=1 # The pypy tests are slow, so list them early - - python: pypy3.6 + - python: pypy3 # Uncomment if you want to test on pypy nightly: # - language: generic # env: USE_PYPY_NIGHTLY=1 @@ -21,7 +21,7 @@ matrix: - python: 3.7 dist: xenial sudo: required - - python: 3.8-dev + - python: 3.8 dist: xenial sudo: required From 162c0bf806b48a37e7ba54040265c712f4178470 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 30 Aug 2020 13:00:26 -0400 Subject: [PATCH 10/11] be more like trio's Travis config --- .travis.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 615be01..768f7dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: python -sudo: false -dist: trusty +dist: focal matrix: include: @@ -9,21 +8,21 @@ matrix: env: CHECK_DOCS=1 - python: 3.8 env: CHECK_FORMATTING=1 - # The pypy tests are slow, so list them early - - python: pypy3 + # The pypy tests are slow, so we list them first + - python: pypy3.6-7.2.0 + dist: bionic + - language: generic + env: PYPY_NIGHTLY_BRANCH=py3.6 # Uncomment if you want to test on pypy nightly: # - language: generic # env: USE_PYPY_NIGHTLY=1 - - python: 3.6 + - python: 3.6-dev # As of 2018-07-05, Travis's 3.7 and 3.8 builds only work if you # use dist: xenial AND sudo: required # See: https://github.com/python-trio/trio/pull/556#issuecomment-402879391 - - python: 3.7 - dist: xenial - sudo: required - - python: 3.8 - dist: xenial - sudo: required + - python: 3.7-dev + - python: 3.8-dev + - python: 3.9-dev script: - ci/travis.sh From c2e9b680317d9bfab8c004a80e106e1ede1e176f Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Sun, 30 Aug 2020 13:08:39 -0400 Subject: [PATCH 11/11] undo exploratory changes --- ci/travis.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/travis.sh b/ci/travis.sh index 92cfb8b..ea3cb62 100755 --- a/ci/travis.sh +++ b/ci/travis.sh @@ -77,9 +77,8 @@ EOF exit 0 fi -pip freeze python setup.py sdist --formats=zip -pip install -U dist/*.zip +pip install dist/*.zip if [ "$CHECK_DOCS" = "1" ]; then pip install -Ur ci/rtd-requirements.txt