Skip to content

Commit

Permalink
Modernize metadata and deps, support 3.8-3.12 (#154)
Browse files Browse the repository at this point in the history
* Modernize metadata and deps, support 3.8-3.12

* rtd config

* rtd extras
  • Loading branch information
amyreese authored Feb 6, 2024
1 parent 1af4bf4 commit 39c5fe8
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 61 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ ignore =
E2
E3
E4
E704

max-line-length = 88
per-file-ignores =
__init__.py: F401
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11.0-rc.1 - 3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: [macOS-latest, ubuntu-latest, windows-latest]

steps:
Expand All @@ -26,8 +26,7 @@ jobs:
- name: Install
run: |
python -m pip install --upgrade pip
make setup
pip install -U .
make EXTRAS=dev install
- name: Test
run: make test
- name: Lint
Expand Down
8 changes: 6 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
version: 2
sphinx:
configuration: docs/conf.py
build:
os: ubuntu-22.04
tools:
python: "3.10"
python:
version: 3.7
install:
- requirements: requirements-dev.txt
- method: pip
path: .
extra_requirements:
- docs
4 changes: 2 additions & 2 deletions aioitertools/builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ async def min(itr: AnyIterable[Orderable], **kwargs: Any) -> Any:
return value


async def sum(itr: AnyIterable[T], start: T = None) -> T:
async def sum(itr: AnyIterable[T], start: Optional[T] = None) -> T:
"""
Compute the sum of a mixed iterable, adding each value with the start value.
Expand Down Expand Up @@ -420,4 +420,4 @@ async def zip(*itrs: AnyIterable[Any]) -> AsyncIterator[Tuple[Any, ...]]:
)
if builtins.any(isinstance(v, AnyStop) for v in values):
break
yield values
yield tuple(values)
6 changes: 2 additions & 4 deletions aioitertools/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@


class Orderable(Protocol): # pragma: no cover
def __lt__(self, other):
...
def __lt__(self, other): ...

def __gt__(self, other):
...
def __gt__(self, other): ...


async def maybe_await(object: Union[Awaitable[T], T]) -> T:
Expand Down
2 changes: 1 addition & 1 deletion aioitertools/tests/builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,5 +364,5 @@ async def test_zip_shortest(self):
long = [0, 1, 2, 3, 5]

result = await ait.list(ait.zip(short, long))
expected = [["a", 0], ["b", 1], ["c", 2]]
expected = [("a", 0), ("b", 1), ("c", 2)]
self.assertListEqual(expected, result)
27 changes: 11 additions & 16 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,30 @@
build:
flit build

dev:
flit install --symlink

setup:
python -m pip install -Ur requirements-dev.txt
PKG:=aioitertools
EXTRAS:=dev,docs

.venv:
python -m venv .venv
source .venv/bin/activate && make setup dev
source .venv/bin/activate && make install
echo 'run `source .venv/bin/activate` to use virtualenv'

venv: .venv

install:
python -m pip install -Ue .[$(EXTRAS)]

release: lint test clean
flit publish

format:
python -m usort format aioitertools
python -m black aioitertools
python -m ufmt format $(PKG)

lint:
python -m flake8 aioitertools
python -m usort check aioitertools
python -m black --check aioitertools
python -m flake8 $(PKG)
python -m ufmt check $(PKG)

test:
python -m coverage run -m aioitertools.tests
python -m coverage run -m $(PKG).tests
python -m coverage report
python -m mypy aioitertools
python -m mypy -p $(PKG)

html: .venv README.md docs/*
source .venv/bin/activate && sphinx-build -b html docs html
Expand Down
2 changes: 0 additions & 2 deletions mypy.ini

This file was deleted.

51 changes: 31 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,45 @@
[build-system]
requires = ["flit_core >=2,<4"]
requires = ["flit_core >=3.8,<4"]
build-backend = "flit_core.buildapi"

[tool.flit.metadata]
module = "aioitertools"
author = "Amethyst Reese"
author-email = "[email protected]"
description-file = "README.md"
home-page = "https://aioitertools.omnilib.dev"
requires = ["typing_extensions>=4.0; python_version < '3.10'"]
requires-python = ">=3.6"
[project]
name = "aioitertools"
readme = "README.md"
authors = [{ name = "Amethyst Reese", email = "[email protected]" }]
license = { file = "LICENSE" }
dynamic = ["version", "description"]
classifiers = [
"Development Status :: 4 - Beta",
"Framework :: AsyncIO",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Topic :: Software Development :: Libraries",
]
requires-python = ">=3.8"
dependencies = ["typing_extensions>=4.0; python_version < '3.10'"]

[tool.flit.metadata.urls]
Documentation = "https://aioitertools.omnilib.dev/en/latest/"
[project.optional-dependencies]
dev = [
"attribution==1.6.2",
"black==24.1.0",
"coverage==7.4.0",
"flake8==7.0.0",
"flit==3.9.0",
"mypy==1.8.0",
"usort==1.0.7",
"ufmt==2.3.0",
]
docs = [
"sphinx==7.2.6",
"sphinx-mdinclude==0.5.3",
]

[project.urls]
Documentation = "https://aioitertools.omnilib.dev"
Github = "https://github.com/omnilib/aioitertools"

[tool.flit.sdist]
exclude = [
".github/",
]
exclude = [".github/"]

[tool.attribution]
name = "aioitertools"
Expand All @@ -44,9 +58,6 @@ precision = 1
show_missing = true
skip_covered = true

[tool.isort]
line_length = 88
multi_line_output = 3
force_grid_wrap = false
include_trailing_comma = true
use_parentheses = true
[tool.mypy]
# strict = true
ignore_missing_imports = true
10 changes: 0 additions & 10 deletions requirements-dev.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

0 comments on commit 39c5fe8

Please sign in to comment.