Skip to content

Commit 2c92ed6

Browse files
authored
Merge branch 'master' into unasync-remove
2 parents 415991b + 3d7a369 commit 2c92ed6

File tree

9 files changed

+45
-29
lines changed

9 files changed

+45
-29
lines changed

.github/workflows/ci.yml

+10-15
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ jobs:
99
strategy:
1010
fail-fast: false
1111
matrix:
12-
python: ['3.8', '3.9', '3.10']
12+
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
1313

1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v4
1717
- name: Setup python
18-
uses: actions/setup-python@v2
18+
uses: actions/setup-python@v5
1919
with:
2020
python-version: ${{ matrix.python }}
2121
cache: pip
@@ -34,7 +34,7 @@ jobs:
3434
strategy:
3535
fail-fast: false
3636
matrix:
37-
python: ['3.8', '3.9', '3.10', '3.11-dev']
37+
python: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
3838
check_formatting: ['0']
3939
extra_name: ['']
4040
include:
@@ -43,19 +43,14 @@ jobs:
4343
extra_name: ', check formatting'
4444
steps:
4545
- name: Checkout
46-
uses: actions/checkout@v2
46+
uses: actions/checkout@v4
4747
- name: Setup python
48-
uses: actions/setup-python@v2
49-
if: "!endsWith(matrix.python, '-dev')"
48+
uses: actions/setup-python@v5
5049
with:
5150
python-version: ${{ matrix.python }}
51+
allow-prereleases: true
5252
cache: pip
5353
cache-dependency-path: test-requirements.txt
54-
- name: Setup python (dev)
55-
uses: deadsnakes/[email protected]
56-
if: endsWith(matrix.python, '-dev')
57-
with:
58-
python-version: '${{ matrix.python }}'
5954
- name: Run tests
6055
run: ./ci.sh
6156
env:
@@ -70,12 +65,12 @@ jobs:
7065
strategy:
7166
fail-fast: false
7267
matrix:
73-
python: ['3.8', '3.9', '3.10']
68+
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
7469
steps:
7570
- name: Checkout
76-
uses: actions/checkout@v2
71+
uses: actions/checkout@v4
7772
- name: Setup python
78-
uses: actions/setup-python@v2
73+
uses: actions/setup-python@v5
7974
with:
8075
python-version: ${{ matrix.python }}
8176
cache: pip

.readthedocs.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
# https://docs.readthedocs.io/en/latest/yaml-config.html
2-
formats:
3-
- htmlzip
4-
- epub
1+
version: 2
2+
3+
build:
4+
os: ubuntu-22.04
5+
tools:
6+
python: "3.12"
57

6-
requirements_file: ci/rtd-requirements.txt
78

89
python:
9-
version: 3
10-
pip_install: True
10+
install:
11+
- requirements: ci/rtd-requirements.txt
12+
- path: .

ci.sh

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -ex
44

5-
BLACK_VERSION=22.6.0
5+
BLACK_VERSION=24.4.2
66

77
python -m pip install -U pip setuptools wheel
88

@@ -55,6 +55,4 @@ fi
5555
# Actual tests
5656
pip install -Ur test-requirements.txt
5757

58-
pytest -W error -ra -v tests --cov --cov-config=.coveragerc
59-
60-
bash <(curl -s https://codecov.io/bash)
58+
pytest -W error -ra -v tests --cov --cov-config=.coveragerc --cov-fail-under=93

docs/source/history.rst

+8
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,11 @@ Release history
44
.. currentmodule:: unasync
55

66
.. towncrier release notes start
7+
8+
unasync 0.6.0 (2024-05-03)
9+
--------------------------
10+
11+
* Drop support for Python 2.7, 3.5, 3.6 and 3.7
12+
* Add support for Python 3.9, 3.10, 3.11 and 3.12
13+
* Replace ``tokenize`` with ``tokenize-rt`` which roundtrips correctly and
14+
handles Python 3.12 f-strings correctly.

setup.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
include_package_data=True,
1818
packages=find_packages("src"),
1919
package_dir={"": "src"},
20-
install_requires=["tokenize_rt"],
20+
install_requires=["tokenize_rt", "setuptools"],
2121
keywords=["async"],
2222
python_requires=">=3.8",
2323
classifiers=[
@@ -27,10 +27,11 @@
2727
"Operating System :: POSIX :: Linux",
2828
"Operating System :: MacOS :: MacOS X",
2929
"Operating System :: Microsoft :: Windows",
30-
"Programming Language :: Python :: 3.7",
3130
"Programming Language :: Python :: 3.8",
3231
"Programming Language :: Python :: 3.9",
3332
"Programming Language :: Python :: 3.10",
33+
"Programming Language :: Python :: 3.11",
34+
"Programming Language :: Python :: 3.12",
3435
"Programming Language :: Python :: Implementation :: CPython",
3536
"Programming Language :: Python :: Implementation :: PyPy",
3637
],

src/unasync/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def _unasync_file(self, filepath):
7171
with open(filepath, "rt", encoding=encoding) as f:
7272
contents = f.read()
7373
tokens = self._unasync_tokenize(contents=contents, filename=filepath)
74+
tokens = self._unasync_tokens(tokens)
7475
result = tokenize_rt.tokens_to_src(tokens)
7576
outfilepath = filepath.replace(self.fromdir, self.todir)
7677
os.makedirs(os.path.dirname(outfilepath), exist_ok=True)
@@ -100,6 +101,7 @@ def _unasync_tokenize(self, contents, filename):
100101
# find all lines related to each node and mark those lines for removal
101102
lines_to_remove.add(lineno)
102103

104+
def _unasync_tokens(self, tokens):
103105
skip_next = False
104106
for token in tokens:
105107
if token.line in lines_to_remove:

src/unasync/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# This file is imported from __init__.py and exec'd from setup.py
22

3-
__version__ = "0.5.0+dev"
3+
__version__ = "0.6.0+dev"

tests/data/async/fstring.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
similarity_algo = f"""
2+
if (dotProduct < 0) {{
3+
return 1;
4+
}}
5+
"""

tests/data/sync/fstring.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
similarity_algo = f"""
2+
if (dotProduct < 0) {{
3+
return 1;
4+
}}
5+
"""

0 commit comments

Comments
 (0)