Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
event loop.
17 Mar, 2025 - 2.0.0 released. Remove support for < 3.10.
31 changes: 27 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
urls = { "Homepage" = "https://github.com/joshuaalbert/FairAsyncRLock" }
dynamic = ["dependencies", "optional-dependencies"]

[tool.setuptools]
include-package-data = true


[tool.setuptools.packages.find]
where = ["src"]
3 changes: 2 additions & 1 deletion requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pytest<8.0.0
flake8
pytest
pytest-asyncio
File renamed without changes.
39 changes: 13 additions & 26 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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"),
}
)
File renamed without changes.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
assert not lock.locked()