Skip to content

Commit

Permalink
Support Python 3.8 - 3.12 (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
pquentin authored May 3, 2024
1 parent 1b6fd0c commit 9268f55
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 29 deletions.
25 changes: 10 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['3.7', '3.8', '3.9', '3.10']
python: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: pip
Expand All @@ -34,7 +34,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['3.7', '3.8', '3.9', '3.10', '3.11-dev']
python: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
check_formatting: ['0']
extra_name: ['']
include:
Expand All @@ -43,19 +43,14 @@ jobs:
extra_name: ', check formatting'
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v2
if: "!endsWith(matrix.python, '-dev')"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
allow-prereleases: true
cache: pip
cache-dependency-path: test-requirements.txt
- name: Setup python (dev)
uses: deadsnakes/[email protected]
if: endsWith(matrix.python, '-dev')
with:
python-version: '${{ matrix.python }}'
- name: Run tests
run: ./ci.sh
env:
Expand All @@ -70,12 +65,12 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['3.7', '3.8', '3.9', '3.10']
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: pip
Expand Down
16 changes: 9 additions & 7 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# https://docs.readthedocs.io/en/latest/yaml-config.html
formats:
- htmlzip
- epub
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.12"

requirements_file: ci/rtd-requirements.txt

python:
version: 3
pip_install: True
install:
- requirements: ci/rtd-requirements.txt
- path: .
6 changes: 2 additions & 4 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -ex

BLACK_VERSION=22.6.0
BLACK_VERSION=24.4.2

python -m pip install -U pip setuptools wheel

Expand Down Expand Up @@ -55,6 +55,4 @@ fi
# Actual tests
pip install -Ur test-requirements.txt

pytest -W error -ra -v tests --cov --cov-config=.coveragerc

bash <(curl -s https://codecov.io/bash)
pytest -W error -ra -v tests --cov --cov-config=.coveragerc --cov-fail-under=93
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
include_package_data=True,
packages=find_packages("src"),
package_dir={"": "src"},
install_requires=["tokenize_rt"],
install_requires=["tokenize_rt", "setuptools"],
keywords=["async"],
python_requires=">=3.7",
classifiers=[
Expand All @@ -27,10 +27,11 @@
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"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",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],
Expand Down
2 changes: 1 addition & 1 deletion src/unasync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def _unasync_file(self, filepath):
with open(filepath, "rb") as f:
encoding, _ = std_tokenize.detect_encoding(f.readline)

with open(filepath, "rt", encoding=encoding) as f:
with open(filepath, encoding=encoding) as f:
tokens = tokenize_rt.src_to_tokens(f.read())
tokens = self._unasync_tokens(tokens)
result = tokenize_rt.tokens_to_src(tokens)
Expand Down
5 changes: 5 additions & 0 deletions tests/data/async/fstring.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
similarity_algo = f"""
if (dotProduct < 0) {{
return 1;
}}
"""
5 changes: 5 additions & 0 deletions tests/data/sync/fstring.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
similarity_algo = f"""
if (dotProduct < 0) {{
return 1;
}}
"""

0 comments on commit 9268f55

Please sign in to comment.