diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 809227a..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" ] + python-version: [ "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/fair_async_rlock/tests/__init__.py b/requirements.txt similarity index 100% rename from fair_async_rlock/tests/__init__.py rename to requirements.txt 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"), + } +) 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/src/fair_async_rlock/tests/__init__.py b/src/fair_async_rlock/tests/__init__.py new file mode 100644 index 0000000..e69de29 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()