Skip to content

Commit

Permalink
3.8 is out and 3.13 is in (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra authored Oct 11, 2024
1 parent 808a565 commit 5bd0e4d
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 50 deletions.
39 changes: 28 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,44 @@ jobs:
os: [ubuntu-20.04, windows-2022, macOS-13]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.11"
python-version: "3.12"

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.18.0
run: python -m pip install cibuildwheel==2.21.3

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.11"
python-version: "3.12"

- name: Install build
run: python -m pip install build==1.2.2.post1

- name: Build sdist
run: python setup.py sdist
run: python -m build --sdist

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz

upload_pypi:
Expand All @@ -56,7 +61,19 @@ jobs:
steps:
- uses: actions/[email protected]
with:
name: artifact
name: sdist
path: dist
- uses: actions/[email protected]
with:
name: ubuntu-20.04
path: dist
- uses: actions/[email protected]
with:
name: windows-2022
path: dist
- uses: actions/[email protected]
with:
name: macOS-13
path: dist
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Unreleased
* Support Cython 3
* Drop support for Python 3.7
* Add support for Python 3.12
* Drop support for Python 3.7 and 3.8
* Add support for Python 3.12 and 3.13

## 1.5.1
* Pin to `Cython<3`
Expand Down
26 changes: 12 additions & 14 deletions asynq/tests/test_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,22 +137,20 @@ def _check_mock(cls, mock_fn, async_caller, non_async_caller):


def test_mock_async_context():
with asynq.mock.patch(
"asynq.tests.test_mock.fn"
) as mock_fn, asynq.mock.patch.object(
Cls, "async_classmethod"
) as mock_classmethod, asynq.mock.patch.object(
Cls, "async_method"
) as mock_method:
with (
asynq.mock.patch("asynq.tests.test_mock.fn") as mock_fn,
asynq.mock.patch.object(Cls, "async_classmethod") as mock_classmethod,
asynq.mock.patch.object(Cls, "async_method") as mock_method,
):
MockCheckerWithAssignment.check(mock_fn, mock_classmethod, mock_method)

with asynq.mock.patch(
"asynq.tests.test_mock.fn", lambda: 42
) as mock_fn, asynq.mock.patch.object(
Cls, "async_classmethod", classmethod(lambda _: 42)
) as mock_classmethod, asynq.mock.patch.object(
Cls, "async_method", lambda _: 42
) as mock_method:
with (
asynq.mock.patch("asynq.tests.test_mock.fn", lambda: 42) as mock_fn,
asynq.mock.patch.object(
Cls, "async_classmethod", classmethod(lambda _: 42)
) as mock_classmethod,
asynq.mock.patch.object(Cls, "async_method", lambda _: 42) as mock_method,
):
MockCheckerWithNew.check(mock_fn, mock_classmethod, mock_method)


Expand Down
5 changes: 3 additions & 2 deletions asynq/tests/test_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ def test():
with Profiler("test_performance(3000): actual test (w/assertions)"):
performance_test(3000).value()
gc.collect()
with debug.disable_complex_assertions(), Profiler(
"test_performance(3000): actual test (w/o assertions)"
with (
debug.disable_complex_assertions(),
Profiler("test_performance(3000): actual test (w/o assertions)"),
):
performance_test(3000).value()
12 changes: 6 additions & 6 deletions asynq/tests/test_pyright.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ def test_return_type():
assert _run_pyright("asynq/tests/typing_example/param_spec.py") == [
dict(
rule="reportArgumentType",
message='Argument of type "Literal[\'1\']" cannot be assigned to parameter "arg1" of type "int" in function "asyncio"\n "Literal[\'1\']" is incompatible with "int"',
message='Argument of type "Literal[\'1\']" cannot be assigned to parameter "arg1" of type "int" in function "asyncio"\n "Literal[\'1\']" is not assignable to "int"',
range={
"start": {"line": 14, "character": 25},
"end": {"line": 14, "character": 28},
},
),
dict(
rule="reportArgumentType",
message='Argument of type "Literal[2]" cannot be assigned to parameter "arg2" of type "str" in function "asyncio"\n "Literal[2]" is incompatible with "str"',
message='Argument of type "Literal[2]" cannot be assigned to parameter "arg2" of type "str" in function "asyncio"\n "Literal[2]" is not assignable to "str"',
range={
"start": {"line": 14, "character": 35},
"end": {"line": 14, "character": 36},
Expand All @@ -38,31 +38,31 @@ def test_return_type():
assert _run_pyright("asynq/tests/typing_example/return_type.py") == [
dict(
rule="reportAssignmentType",
message='Expression of type "int" is incompatible with declared type "str"\n "int" is incompatible with "str"',
message='Type "int" is not assignable to declared type "str"\n "int" is not assignable to "str"',
range={
"start": {"line": 38, "character": 13},
"end": {"line": 38, "character": 31},
},
),
dict(
rule="reportAssignmentType",
message='Expression of type "int" is incompatible with declared type "str"\n "int" is incompatible with "str"',
message='Type "int" is not assignable to declared type "str"\n "int" is not assignable to "str"',
range={
"start": {"line": 41, "character": 13},
"end": {"line": 41, "character": 31},
},
),
dict(
rule="reportAssignmentType",
message='Expression of type "int" is incompatible with declared type "str"\n "int" is incompatible with "str"',
message='Type "int" is not assignable to declared type "str"\n "int" is not assignable to "str"',
range={
"start": {"line": 44, "character": 13},
"end": {"line": 44, "character": 31},
},
),
dict(
rule="reportAssignmentType",
message='Expression of type "int" is incompatible with declared type "str"\n "int" is incompatible with "str"',
message='Type "int" is not assignable to declared type "str"\n "int" is not assignable to "str"',
range={
"start": {"line": 47, "character": 13},
"end": {"line": 47, "character": 31},
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.black]
target_version = ['py38', 'py39', 'py310', 'py311']
target_version = ['py39', 'py310', 'py311', 'py312', 'py313']
include = '\.pyi?$'
skip-magic-trailing-comma = true
preview = true
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pytest
Cython>=0.27.1
qcore
pygments
black==24.3.0
mypy==1.10.1
pyright==1.1.362
typing_extensions==4.11.0
black==24.10.0
mypy==1.11.2
pyright==1.1.384
typing_extensions==4.12.2
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,17 @@
classifiers=[
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
],
keywords="quora asynq common utility",
packages=["asynq", "asynq.tests"],
package_data={"asynq": DATA_FILES},
ext_modules=EXTENSIONS,
setup_requires=["Cython", "qcore", "setuptools"],
install_requires=["qcore", "pygments"],
python_requires=">=3.9",
)
12 changes: 6 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
minversion=2.3.1
envlist =
py38,py39,py310,py311,py312
py39,py310,py311,py312,py313
mypy
black
skip_missing_interpreters = True
Expand All @@ -14,7 +14,7 @@ commands =
pytest asynq

[testenv:mypy]
basepython = python3.8
basepython = python3.9
deps =
-rrequirements.txt

Expand All @@ -27,8 +27,8 @@ commands =

[gh-actions]
python =
3.8: py38, mypy
3.9: py39, black
3.9: py39, mypy
3.10: py310
3.11: py311, black
3.12: py312
3.11: py311
3.12: py312, black
3.13: py313

0 comments on commit 5bd0e4d

Please sign in to comment.