From 4b20b55b0c96bed11dc87f2cafb29d9fe5e2edd6 Mon Sep 17 00:00:00 2001 From: joshuaalbert Date: Mon, 17 Mar 2025 12:23:13 +0100 Subject: [PATCH 1/3] * pre #22 --- .github/workflows/unittests.yml | 3 +-- README.md | 3 ++- pyproject.toml | 31 ++++++++++++++++++++++---- requirements-tests.txt | 3 ++- requirements.txt | 0 setup.py | 39 +++++++++++---------------------- 6 files changed, 45 insertions(+), 34 deletions(-) create mode 100644 requirements.txt diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 809227a..1b3d8ae 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ] steps: - uses: actions/checkout@v3 @@ -27,7 +27,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install flake8 pytest pip install -r requirements-tests.txt pip install . - name: Lint with flake8 diff --git a/README.md b/README.md index f953029..def4349 100644 --- a/README.md +++ b/README.md @@ -111,4 +111,5 @@ with `asyncio.Lock`. ### Change Log 27 Jan, 2024 - 1.0.7 released. Fixed a bug that allowed another task to get the lock before a waiter got its turn on the -event loop. \ No newline at end of file +event loop. +17 Mar, 2025 - 2.0.0 released. Remove support for < 3.10. \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index b5a3c46..4ff2cbe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,29 @@ +# pyproject.toml + [build-system] -requires = [ - "setuptools>=42", - "wheel" +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "fair_async_rlock" +version = "2.0.0" +description = "A fair async RLock for Python" +readme = "README.md" +requires-python = ">=3.10" +license = { text = "Apache Software License" } +authors = [{ name = "Joshua G. Albert", email = "albert@strw.leidenuniv.nl" }] +keywords = ["async", "fair", "reentrant", "lock", "concurrency"] +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent" ] -build-backend = "setuptools.build_meta" \ No newline at end of file +urls = { "Homepage" = "https://github.com/joshuaalbert/FairAsyncRLock" } +dynamic = ["dependencies", "optional-dependencies"] + +[tool.setuptools] +include-package-data = true + + +[tool.setuptools.packages.find] +where = ["src"] diff --git a/requirements-tests.txt b/requirements-tests.txt index 2a32ed4..c5c1912 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -1,2 +1,3 @@ -pytest<8.0.0 +flake8 +pytest pytest-asyncio \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/setup.py b/setup.py index 76192c3..612b904 100755 --- a/setup.py +++ b/setup.py @@ -1,31 +1,18 @@ #!/usr/bin/env python -from setuptools import find_packages from setuptools import setup -with open("README.md", "r") as fh: - long_description = fh.read() +install_requires = [] -setup(name='fair_async_rlock', - version='1.0.7', - description='A well-tested implementation of a fair asynchronous RLock for concurrent programming.', - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/Joshuaalbert/FairAsyncRLock", - author='Joshua G. Albert', - author_email='albert@strw.leidenuniv.nl', - setup_requires=[], - install_requires=[], - tests_require=[ - 'pytest', - 'pytest-asyncio' - ], - package_dir={'': './'}, - packages=find_packages('./'), - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: Apache Software License", - "Operating System :: OS Independent", - ], - python_requires='>=3.7', - ) + +def load_requirements(file_name): + with open(file_name, "r") as file: + return [line.strip() for line in file if line.strip() and not line.startswith("#")] + + +setup( + install_requires=load_requirements("requirements.txt"), + extras_require={ + "tests": load_requirements("requirements-tests.txt"), + } +) From e9eac277ccd3f1ec2f554e6fa87ac6d37ce885ed Mon Sep 17 00:00:00 2001 From: joshuaalbert Date: Mon, 17 Mar 2025 12:25:14 +0100 Subject: [PATCH 2/3] * fix src root --- {fair_async_rlock => src/fair_async_rlock}/__init__.py | 0 .../fair_async_rlock}/fair_async_rlock.py | 0 {fair_async_rlock => src/fair_async_rlock}/tests/__init__.py | 0 .../fair_async_rlock}/tests/test_fair_async_rlock.py | 5 ++++- 4 files changed, 4 insertions(+), 1 deletion(-) rename {fair_async_rlock => src/fair_async_rlock}/__init__.py (100%) rename {fair_async_rlock => src/fair_async_rlock}/fair_async_rlock.py (100%) rename {fair_async_rlock => src/fair_async_rlock}/tests/__init__.py (100%) rename {fair_async_rlock => src/fair_async_rlock}/tests/test_fair_async_rlock.py (99%) diff --git a/fair_async_rlock/__init__.py b/src/fair_async_rlock/__init__.py similarity index 100% rename from fair_async_rlock/__init__.py rename to src/fair_async_rlock/__init__.py diff --git a/fair_async_rlock/fair_async_rlock.py b/src/fair_async_rlock/fair_async_rlock.py similarity index 100% rename from fair_async_rlock/fair_async_rlock.py rename to src/fair_async_rlock/fair_async_rlock.py diff --git a/fair_async_rlock/tests/__init__.py b/src/fair_async_rlock/tests/__init__.py similarity index 100% rename from fair_async_rlock/tests/__init__.py rename to src/fair_async_rlock/tests/__init__.py diff --git a/fair_async_rlock/tests/test_fair_async_rlock.py b/src/fair_async_rlock/tests/test_fair_async_rlock.py similarity index 99% rename from fair_async_rlock/tests/test_fair_async_rlock.py rename to src/fair_async_rlock/tests/test_fair_async_rlock.py index 89a220c..b1ae6e8 100644 --- a/fair_async_rlock/tests/test_fair_async_rlock.py +++ b/src/fair_async_rlock/tests/test_fair_async_rlock.py @@ -653,12 +653,15 @@ async def task3(): await asyncio.gather(t1, t2, t3) + @pytest.mark.asyncio def test_locked(): lock = FairAsyncRLock() assert not lock.locked() + async def task(): async with lock: assert lock.locked() + asyncio.run(task()) - assert not lock.locked() \ No newline at end of file + assert not lock.locked() From 6cbed50e3557a0905478141e1f95f588217359ff Mon Sep 17 00:00:00 2001 From: joshuaalbert Date: Mon, 17 Mar 2025 12:27:22 +0100 Subject: [PATCH 3/3] * remove tests --- .github/workflows/unittests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 1b3d8ae..038d87d 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ] + python-version: [ "3.10", "3.11", "3.12", "3.13" ] steps: - uses: actions/checkout@v3