diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 6ffa618..3610632 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -22,13 +22,10 @@ jobs: with: python-version: '3.13' - - name: Install setuptools - run: pip install setuptools - - - name: Install crc32c - run: python setup.py develop + - name: Install tox-uv + run: pip install tox-uv - name: Benchmark with 1 [GB] 10 times env: CRC32C_SW_MODE: ${{ matrix.sw_mode }} - run: python -m crc32c.benchmark -i 10 -s 1073741824 + run: tox -e benchmark -- -i 10 -s 1073741824 diff --git a/.github/workflows/build_and_release.yml b/.github/workflows/build_and_release.yml index 3bd2ee8..41c1ccd 100644 --- a/.github/workflows/build_and_release.yml +++ b/.github/workflows/build_and_release.yml @@ -63,32 +63,6 @@ jobs: name: source-dist path: dist/*.tar.gz - test_sdist: - name: Check source distribution is usable - needs: [build_sdist] - runs-on: ubuntu-22.04 - steps: - - uses: actions/setup-python@v5 - name: Install Python - with: - python-version: "3.13" - - - uses: actions/download-artifact@v4 - with: - name: source-dist - - - name: Extract source distribution - run: tar xvf crc32c*.tar.gz && rm crc32c*.tar.gz - - - name: Install source distribution - run: pip install ./crc32c* - - - name: Install test dependencies - run: pip install pytest - - - name: Run source distribution tests - run: cd crc32c* && python run-tests.py - merge_artifacts: needs: [build_wheels, build_sdist] runs-on: ubuntu-latest diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ea85171..22064b4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,15 +18,7 @@ jobs: architecture: x64 - name: Checkout uses: actions/checkout@v3 - - name: Install build - run: pip install build - - name: Install dev requirements - run: pip install -r requirements-dev.txt - - name: Build and install package - run: python -m build -w && pip install dist/crc32c*.whl - - name: Run mypy - run: mypy --strict src test - - name: Run black - run: black --check . - - name: Run isort - run: isort --profile black --check --diff . + - name: Install tox-uv + run: pip install tox-uv + - name: Run linting steps + run: tox -e lint diff --git a/CHANGELOG.md b/CHANGELOG.md index 99a86ac..230c2b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ This includes its build system (setuptools), moving most static content from `setup.py` to `pyproject.toml`, and moving the `pytest` configuration out from `pytest.ini` too. +* Introduced `tox` as a job runner for development avtivities, + good to use with `tox-uv` for easy multi-python testing. ## [2.7.1] diff --git a/pyproject.toml b/pyproject.toml index 8d0518e..8cf13d8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,8 +29,54 @@ urls.github = "https://github.com/ICRAR/crc32c" urls.changelog = "https://github.com/ICRAR/crc32c/blob/master/CHANGELOG.md" urls.issues = "https://github.com/ICRAR/crc32c/issues" +[dependency-groups] +test = [ + "pytest", +] +lint = [ + "black", + "isort", + "mypy", +] [tool.pytest.ini_options] markers = [ "calculates_crc32c: Mark a test as needing crc32c working" ] + +[tool.tox] +requires = ["tox>=4.23"] +env_list = [ + "py3.8", + "py3.9", + "py3.10", + "py3.11", + "py3.12", + "py3.13", +] + +[tool.tox.env_run_base] +description = "Run test under {base_python}" +labels = ["test"] +commands = [["{env_python}", "-u", "run-tests.py"]] +dependency_groups = ["test"] +passenv = ["CRC32C_SW_MODE"] + +[tool.tox.env.benchmark] +description = "Run basic benckmark" +labels = ["benchmark"] +commands = [["{env_python}", "-m", "crc32c.benchmark", { replace = "posargs", extend = true }]] +passenv = ["CRC32C_SW_MODE"] +parallel_show_output = true + +[tool.tox.env.lint] +description = "Run linting checks" +labels = ["lint"] +commands = [ + ["mypy", "--strict", "src", "test"], + ["black", "--check", "src", "test"], + ["isort", "--profile", "black", "--check", "--diff", "src", "test"], +] +dependency_groups = ["lint", "test"] +package = "skip" +changedir = "{toxinidir}" diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index c2216e6..0000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Keep alphasorted -black -isort -mypy -pytest -wheel