diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 518b8c3..2ad8243 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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: @@ -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/action@v2.0.2 - if: endsWith(matrix.python, '-dev') - with: - python-version: '${{ matrix.python }}' - name: Run tests run: ./ci.sh env: @@ -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 diff --git a/.readthedocs.yml b/.readthedocs.yml index da6abdf..917704b 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -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: . diff --git a/ci.sh b/ci.sh index 9934548..abf5b67 100755 --- a/ci.sh +++ b/ci.sh @@ -2,7 +2,7 @@ set -ex -BLACK_VERSION=22.6.0 +BLACK_VERSION=24.4.2 python -m pip install -U pip setuptools wheel @@ -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 diff --git a/setup.py b/setup.py index 88f3ecc..32c15df 100644 --- a/setup.py +++ b/setup.py @@ -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=[ @@ -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", ], diff --git a/src/unasync/__init__.py b/src/unasync/__init__.py index ffc9205..e669b9a 100644 --- a/src/unasync/__init__.py +++ b/src/unasync/__init__.py @@ -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) diff --git a/tests/data/async/fstring.py b/tests/data/async/fstring.py new file mode 100644 index 0000000..e58f2c8 --- /dev/null +++ b/tests/data/async/fstring.py @@ -0,0 +1,5 @@ +similarity_algo = f""" +if (dotProduct < 0) {{ + return 1; +}} +""" diff --git a/tests/data/sync/fstring.py b/tests/data/sync/fstring.py new file mode 100644 index 0000000..e58f2c8 --- /dev/null +++ b/tests/data/sync/fstring.py @@ -0,0 +1,5 @@ +similarity_algo = f""" +if (dotProduct < 0) {{ + return 1; +}} +"""