Skip to content

Commit

Permalink
Upgrade to Cython 3
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra committed Jul 28, 2023
1 parent 1eda688 commit 9e816f3
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 34 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12-dev"]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Unreleased
* Support Cython 3
* Drop support for Python 3.7
* Add support for Python 3.12

## 1.5.1
* Pin to `Cython<3`

Expand Down
10 changes: 5 additions & 5 deletions asynq/async_task.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ from cpython.ref cimport PyObject
cimport qcore.events as core_events
cimport qcore.helpers as core_helpers
cimport qcore.inspection as core_inspection
cimport futures
cimport scheduler
cimport _debug
cimport profiler
cimport batching
from . cimport futures
from . cimport scheduler
from . cimport _debug
from . cimport profiler
from . cimport batching


cdef _debug.DebugOptions _debug_options
Expand Down
6 changes: 3 additions & 3 deletions asynq/batching.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import cython
from cpython.ref cimport PyObject

cimport qcore.inspection as core_inspection
cimport futures
cimport _debug
cimport profiler
from . cimport futures
from . cimport _debug
from . cimport profiler


cdef _debug.DebugOptions _debug_options
Expand Down
2 changes: 1 addition & 1 deletion asynq/contexts.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import cython

cimport async_task
from . cimport async_task


@cython.locals(active_task=async_task.AsyncTask)
Expand Down
6 changes: 3 additions & 3 deletions asynq/decorators.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ from cpython.ref cimport PyObject
cimport qcore.helpers as core_helpers
cimport qcore.inspection as core_inspection
cimport qcore.decorators
cimport futures
cimport async_task
cimport _debug
from . cimport futures
from . cimport async_task
from . cimport _debug

cdef _debug.DebugOptions _debug_options

Expand Down
2 changes: 1 addition & 1 deletion asynq/futures.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ from cpython.ref cimport PyObject

cimport qcore.events as core_events
cimport qcore.helpers as core_helpers
cimport _debug
from . cimport _debug

cdef _debug.DebugOptions _debug_options
cdef core_helpers.MarkerObject _none
Expand Down
8 changes: 4 additions & 4 deletions asynq/scheduler.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import cython
from cpython.ref cimport PyObject

cimport qcore.events as core_events
cimport futures
cimport async_task
cimport batching
cimport _debug
from . cimport futures
from . cimport async_task
from . cimport batching
from . cimport _debug


cdef _debug.DebugOptions _debug_options
Expand Down
4 changes: 2 additions & 2 deletions asynq/scoped_value.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@

import cython

cimport contexts
from . cimport contexts


cdef object _empty_context

cdef class AsyncScopedValue(object):
cpdef public object _value
cdef public object _value

cpdef object get(self)
cpdef set(self, object value)
Expand Down
8 changes: 4 additions & 4 deletions asynq/utils.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import cython
from cpython.ref cimport PyObject
from cpython cimport bool

from futures cimport FutureBase
cimport async_task
cimport scheduler
cimport _debug
from .futures cimport FutureBase
from . cimport async_task
from . cimport scheduler
from . cimport _debug


cdef _debug.DebugOptions _debug_options
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ pytest
Cython>=0.27.1
qcore
pygments
black==23.3.0
mypy==1.3.0
black==23.7.0
mypy==1.4.1
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@


if __name__ == "__main__":
for extension in EXTENSIONS:
extension.cython_directives = {"language_level": "3"}

with open("./README.rst", encoding="utf-8") as f:
long_description = f.read()

Expand All @@ -65,16 +68,16 @@
classifiers=[
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"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",
],
keywords="quora asynq common utility",
packages=["asynq", "asynq.tests"],
package_data={"asynq": DATA_FILES},
ext_modules=EXTENSIONS,
setup_requires=["Cython==0.29.36", "qcore", "setuptools"],
install_requires=["Cython>=0.27.1", "qcore", "pygments"],
setup_requires=["Cython", "qcore", "setuptools"],
install_requires=["qcore", "pygments"],
)
10 changes: 5 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
minversion=2.3.1
envlist =
py37,py38,py39,py310,py311
py38,py39,py310,py311,py312
mypy
black
skip_missing_interpreters = True
Expand All @@ -14,7 +14,7 @@ commands =
pytest asynq

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

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

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

0 comments on commit 9e816f3

Please sign in to comment.