From 4f472d70e4b877b76508bab117ddbfd3c80123e0 Mon Sep 17 00:00:00 2001 From: jylpah Date: Mon, 25 Dec 2023 12:23:35 +0200 Subject: [PATCH 1/3] add CI badges, update module links --- README.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 12b4ffc..970bb0a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![CI](https://github.com/Jylpah/pyutils/actions/workflows/python-package.yml/badge.svg) [![codecov](https://codecov.io/gh/Jylpah/pyutils/graph/badge.svg?token=5EJ07RU78R)](https://codecov.io/gh/Jylpah/pyutils) + # pyutils Misc Python utils @@ -16,13 +18,14 @@ pip install --upgrade git+https://github.com/Jylpah/pyutils.git # MODULES -* [AsyncQueue(asyncio.Queue, Generic[T])](asyncqueue.py): Implement `async.Queue()` interface for non-async queues using `asyncio.sleep()` and `get_nowait()` and `put_nowait()` methods. Handy when using async code with `multiprocessing` -* [BucketMapper(Generic[T])](bucketmapper.py): Class to map objects into fixed buckets according to an attribute (`float|int`). Uses `bisect` package. -* [CounterQueue(asyncio.Queue)](counterqueue.py): Async Queue that keeps count on `task_done()` completed -* [EventCounter()](eventcounter.py): Count / log statistics and merge different `EventCounter()` instances to provide aggregated stats of the events counted -* [FileQueue(asyncio.Queue)](filequeue.py): Class to build file queue to process from command line arguments or STDIN (`-`) -* [IterableQueue(Queue[T], AsyncIterable[T], Countable):](iterablequeue.py): Async queue that implements `AsyncIterable()`. The queue supports join(). Bit complex, but I could not figure how to simplify it while implenting both `join()` and `AsyncIterable()` -* [MultilevelFormatter(logging.Formatter)](multilevelformatter.py): Log using different formats per logging level -* [ThrottledClientSession(aiohttp.ClientSession)](throttledclientsession.py): Rate-throttled client session class inherited from aiohttp.ClientSession -* [utils](utils.py) module for ... utils of [pyutils](.) +* [AsyncQueue(asyncio.Queue, Generic[T])](src/pyutils/asyncqueue.py): Implement `async.Queue()` interface for non-async queues using `asyncio.sleep()` and `get_nowait()` and `put_nowait()` methods. Handy when using async code with `multiprocessing` +* [AsyncTyper(Typer)](src/pyutils/asynctyper.py): An wrapper for `Typer` to run `asyncio` commands. +* [BucketMapper(Generic[T])](src/pyutils/bucketmapper.py): Class to map objects into fixed buckets according to an attribute (`float|int`). Uses `bisect` package. +* [CounterQueue(asyncio.Queue)](src/pyutils/counterqueue.py): Async Queue that keeps count on `task_done()` completed +* [EventCounter()](src/pyutils/eventcounter.py): Count / log statistics and merge different `EventCounter()` instances to provide aggregated stats of the events counted +* [FileQueue(asyncio.Queue)](src/pyutils/filequeue.py): Class to build file queue to process from command line arguments or STDIN (`-`) +* [IterableQueue(Queue[T], AsyncIterable[T], Countable):](src/pyutils/iterablequeue.py): Async queue that implements `AsyncIterable()`. The queue supports join(). Bit complex, but I could not figure how to simplify it while implenting both `join()` and `AsyncIterable()` +* [MultilevelFormatter(logging.Formatter)](src/pyutils/multilevelformatter.py): Log using different formats per logging level +* [ThrottledClientSession(aiohttp.ClientSession)](src/pyutils/throttledclientsession.py): Rate-throttled client session class inherited from aiohttp.ClientSession +* [utils](src/pyutils/utils.py) module for ... utils of [pyutils](.) From a3a4dc4c8934a281d98ebf9334204f49e57af01f Mon Sep 17 00:00:00 2001 From: jylpah Date: Mon, 25 Dec 2023 12:48:21 +0200 Subject: [PATCH 2/3] add cache go GH actions, pump up action versions --- .github/workflows/python-package.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index c0f1da9..9658d6f 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -20,17 +20,18 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + cache: 'pip' - name: Install dependencies run: | python -m pip install --upgrade pip python -m pip install flake8 pytest python -m pip install . - python -m pip install ".[dev]" + python -m pip install ".[dev]" - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names From 25dbde8625d73f84f821a02bb4262aa3e8785f84 Mon Sep 17 00:00:00 2001 From: jylpah Date: Mon, 25 Dec 2023 12:49:10 +0200 Subject: [PATCH 3/3] update dependency formats --- pyproject.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 15dfb08..855d024 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ dependencies = [ "aiohttp~=3.9.1", "aiodns~=3.0.0", "aioconsole~=0.6.1", - "alive-progress>=3.1.1", + "alive-progress~=3.1.1", "Brotli~=1.1.0", "Deprecated~=1.2.14", "click~=8.1", @@ -36,9 +36,9 @@ dev = [ "pytest-asyncio", "pytest-datafiles", "pytest-cov~=4.1", - "pytest-timeout", - "types-aiofiles>=23.1.0.1", - "types-Deprecated>=1.2.9.3", + "pytest-timeout~=2.2.0", + "types-aiofiles~=23.1.0.1", + "types-Deprecated~=1.2.9.3", ]