Skip to content

Commit

Permalink
Add support for py3.6 and py3.9 (#26)
Browse files Browse the repository at this point in the history
* port to anyio v3

* configure strict pytest

* support py3.6 and py3.9

* add all black target-versions

psf/black#751 (comment)

* upgrade florimondmanca/azure-pipelines-templates

* upgrade black

* add nocov

* widen typing-extensions dep

* docment 3.6 support

* drop aiometer._concurrency
  • Loading branch information
graingert authored Jul 5, 2021
1 parent ad6f4d0 commit 2a4e867
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
![Python versions](https://img.shields.io/pypi/pyversions/aiometer.svg)
[![Package version](https://badge.fury.io/py/aiometer.svg)](https://pypi.org/project/aiometer)

`aiometer` is a Python 3.7+ concurrency scheduling library compatible with `asyncio` and `trio` and inspired by [Trimeter](https://github.com/python-trio/trimeter). It makes it easier to execute lots of tasks concurrently while controlling concurrency limits (i.e. applying _[backpressure](https://lucumr.pocoo.org/2020/1/1/async-pressure/)_) and collecting results in a predictable manner.
`aiometer` is a Python 3.6+ concurrency scheduling library compatible with `asyncio` and `trio` and inspired by [Trimeter](https://github.com/python-trio/trimeter). It makes it easier to execute lots of tasks concurrently while controlling concurrency limits (i.e. applying _[backpressure](https://lucumr.pocoo.org/2020/1/1/async-pressure/)_) and collecting results in a predictable manner.

_This project is currently in early alpha. Be sure to pin any dependencies to the latest minor._

Expand Down
8 changes: 5 additions & 3 deletions ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resources:
type: github
endpoint: github
name: florimondmanca/azure-pipelines-templates
ref: refs/tags/3.0
ref: refs/tags/3.3

trigger:
- master
Expand All @@ -19,11 +19,13 @@ variables:
jobs:
- template: job--python-check.yml@templates
parameters:
pythonVersion: "3.8"
pythonVersion: "3.9"

- template: job--python-test.yml@templates
parameters:
jobs:
py36: null
py37: null
py38:
py38: null
py39:
coverage: true
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-e .

autoflake
black==20.8b1
black==21.6b0
flake8
isort==5.*
mypy
Expand Down
2 changes: 1 addition & 1 deletion scripts/check
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export SOURCE_FILES="src/aiometer tests"

set -x

${PREFIX}black --check --diff --target-version=py37 $SOURCE_FILES
${PREFIX}black --check --diff --target-version=py36 --target-version=py37 --target-version=py38 --target-version=py39 $SOURCE_FILES
${PREFIX}flake8 $SOURCE_FILES
${PREFIX}mypy $SOURCE_FILES
${PREFIX}isort --check --diff $SOURCE_FILES
2 changes: 1 addition & 1 deletion scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export PREFIX="venv/bin/"

set -x

python -m venv venv
python3 -m venv venv
${PREFIX}python -m pip install -U pip
${PREFIX}python -m pip install -r requirements.txt

Expand Down
10 changes: 8 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ def get_long_description() -> str:
package_dir={"": "src"},
include_package_data=True,
zip_safe=False,
install_requires=["anyio~=3.2", "typing-extensions==3.7.*; python_version<'3.8'"],
python_requires=">=3.7",
install_requires=[
"anyio~=3.2",
"typing-extensions~=3.10; python_version<'3.8'",
"contextlib2>=21.6.0; python_version<'3.7'",
],
python_requires=">=3.6",
license="MIT",
classifiers=[
"Development Status :: 3 - Alpha",
Expand All @@ -43,7 +47,9 @@ def get_long_description() -> str:
"Framework :: Trio",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
],
)
15 changes: 10 additions & 5 deletions src/aiometer/_impl/amap.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from contextlib import asynccontextmanager
import sys
from typing import (
Any,
AsyncContextManager,
Expand All @@ -16,10 +16,15 @@
from .run_on_each import run_on_each
from .types import T, U

try:
from typing_extensions import Literal # Python 3.7.
except ImportError: # pragma: no cover
from typing import Literal # type: ignore
if sys.version_info > (3, 8): # pragma: no cover
from typing import Literal
else: # pragma: no cover
from typing_extensions import Literal

if sys.version_info > (3, 7): # pragma: no cover
from contextlib import asynccontextmanager
else: # pragma: no cover
from contextlib2 import asynccontextmanager


@overload
Expand Down

0 comments on commit 2a4e867

Please sign in to comment.