diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff4788b..7a6237c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,11 +13,11 @@ jobs: strategy: matrix: python-version: ["3.10"] - toxenv: [black, flake8, mypy] + toxenv: [black, ruff, mypy] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -34,7 +34,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.9"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"] optional-deps: [true] with-libs: [true] include: @@ -66,24 +66,24 @@ jobs: - name: Remove xz if: runner.os == 'Linux' && !matrix.optional-deps run: while which xz; do sudo rm $(which xz); done - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: python -m pip install tox - name: Test - run: tox -e py + run: tox run -e ${{ matrix.python-version }} if: matrix.with-libs - name: Test without python-isal and python-zlib-ng - run: tox -e no-libs + run: tox run -e no-libs if: true && !matrix.with-libs - name: Test with zstandard if: matrix.with-zstandard - run: tox -e zstd + run: tox run -e zstd - name: Upload coverage report uses: codecov/codecov-action@v3 @@ -93,11 +93,11 @@ jobs: needs: [lint, test] if: startsWith(github.ref, 'refs/tags') steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-depth: 0 # required for setuptools_scm - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v6 with: python-version: "3.10" - name: Make distributions diff --git a/README.rst b/README.rst index 2e5c268..da5ff17 100644 --- a/README.rst +++ b/README.rst @@ -185,7 +185,7 @@ Changelog development version ~~~~~~~~~~~~~~~~~~~ -* Dropped support for Python 3.8 +* Dropped support for Python 3.8 and 3.9 * Started supporting Python 3.13 v2.0.2 (2024-06-12) diff --git a/pyproject.toml b/pyproject.toml index c0f5bc2..afbf201 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ classifiers = [ "Development Status :: 5 - Production/Stable", "Programming Language :: Python :: 3" ] -requires-python = ">=3.9" +requires-python = ">=3.10" dynamic = ["version"] dependencies = [ 'isal>=1.6.1; platform.machine == "x86_64" or platform.machine == "AMD64" or platform.machine == "aarch64"', @@ -34,3 +34,12 @@ write_to = "src/xopen/_version.py" [tool.pytest.ini_options] addopts = "--strict-markers" + +[tool.coverage.run] +branch = true + +[tool.coverage.report] +exclude_also = [ + "def __repr__", + "@overload", +] diff --git a/src/xopen/__init__.py b/src/xopen/__init__.py index 89f5137..1348ea9 100644 --- a/src/xopen/__init__.py +++ b/src/xopen/__init__.py @@ -72,12 +72,6 @@ try: import fcntl - - # fcntl.F_SETPIPE_SZ will be available in python 3.10. - # https://github.com/python/cpython/pull/21921 - # If not available: set it to the correct value for known platforms. - if not hasattr(fcntl, "F_SETPIPE_SZ") and sys.platform == "linux": - setattr(fcntl, "F_SETPIPE_SZ", 1031) except ImportError: fcntl = None # type: ignore diff --git a/tox.ini b/tox.ini deleted file mode 100644 index f1ef44a..0000000 --- a/tox.ini +++ /dev/null @@ -1,55 +0,0 @@ -[tox] -envlist = black,flake8,mypy,py39,py310,py311,py312,py313,pypy3 -isolated_build = True - -[testenv] -deps = - pytest - pytest-timeout - coverage -setenv = - PYTHONDEVMODE = 1 - PYTHONWARNDEFAULTENCODING = 1 -commands = - coverage run --branch --source=xopen,tests -m pytest -v --doctest-modules tests - coverage report - coverage xml - coverage html - -[testenv:zstd] -deps = - {[testenv]deps} - zstandard - -[testenv:no-libs] -commands= - pip uninstall -y isal zlib-ng - {[testenv]commands} - -[testenv:black] -basepython = python3.10 -deps = black==22.3.0 -skip_install = true -commands = black --check src/ tests/ - -[testenv:flake8] -basepython = python3.10 -deps = flake8 -commands = flake8 src/ tests/ -skip_install = true - -[testenv:mypy] -basepython = python3.10 -deps = mypy -commands = mypy src/ - -[flake8] -max-line-length = 99 -max-complexity = 10 -extend_ignore = E731 - -[coverage:report] -exclude_lines = - pragma: no cover - def __repr__ - @overload diff --git a/tox.toml b/tox.toml new file mode 100644 index 0000000..3ee996d --- /dev/null +++ b/tox.toml @@ -0,0 +1,43 @@ +env_list = ["black", "ruff", "mypy", "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"] + +[env_run_base] +default_base_python = "3.10" +deps = [ + "pytest", + "pytest-timeout", + "coverage", +] +set_env = { PYTHONDEVMODE = "1", PYTHONWARNDEFAULTENCODING = "1" } +commands = [ + ["coverage", "run", "--source=xopen,tests", "-m", "pytest", "-v", "--doctest-modules", "tests"], + ["coverage", "report"], + ["coverage", "xml"], + ["coverage", "html"], +] + +[env.zstd] +deps = [ + "{[env_run_base]deps}", + "zstandard", +] + +[env.no-libs] +deps = ["{[env_run_base]deps}", "pip"] +commands = [ + ["{env_python}", "-m", "pip", "uninstall", "-y", "isal", "zlib-ng"], + { replace = "ref", of = ["env_run_base", "commands"], extend = true }, +] + +[env.black] +deps = ["black==22.3.0"] +skip_install = true +commands = [["black", "--check", "src/", "tests/"]] + +[env.ruff] +deps = ["ruff"] +commands = [["ruff", "check", "src/", "tests/"]] +skip_install = true + +[env.mypy] +deps = ["mypy"] +commands = [["mypy", "src/"]]