From 0c693944a5f820328c8d25af9b3fa06301a6eba1 Mon Sep 17 00:00:00 2001 From: Christopher Doris Date: Wed, 4 Jun 2025 15:39:33 +0100 Subject: [PATCH 1/3] use uv more --- .github/workflows/tests.yml | 30 ++++++++++++++++++++++++------ pyproject.toml | 13 +++++++++++-- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b5dfeb2a..b33b0de5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,27 +20,35 @@ jobs: arch: [x64] # x86 unsupported by MicroMamba os: [ubuntu-latest, windows-latest, macos-latest] jlversion: ['1','1.9'] + steps: - uses: actions/checkout@v4 + - name: Set up Julia ${{ matrix.jlversion }} uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.jlversion }} arch: ${{ matrix.arch }} + - uses: julia-actions/cache@v2 + - name: Build package uses: julia-actions/julia-buildpkg@v1 + - name: Run tests uses: julia-actions/julia-runtest@v1 env: JULIA_DEBUG: PythonCall JULIA_NUM_THREADS: '2' + - name: Process coverage uses: julia-actions/julia-processcoverage@v1 + - name: Upload coverage to Codecov uses: codecov/codecov-action@v5 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + python: name: Test (${{ matrix.os }}, python ${{ matrix.pyversion }}) runs-on: ${{ matrix.os }} @@ -49,33 +57,43 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macos-latest] pyversion: ["3.x", "3.8"] + steps: - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.pyversion }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.pyversion }} + + - name: Set up uv + uses: astral-sh/setup-uv@v5 + with: + python-version: ${{ matrix.pyversion }} + - name: Set up Julia uses: julia-actions/setup-julia@v2 with: version: '1' + - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install flake8 pytest pytest-cov nbval numpy cp pysrc/juliacall/juliapkg-dev.json pysrc/juliacall/juliapkg.json - pip install -e . + uv sync --dev + - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --ignore=F821 --show-source --statistics + uv run flake8 . --count --select=E9,F63,F7,F82 --ignore=F821 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + uv run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Run tests run: | - pytest -s --nbval --cov=pysrc ./pytest/ + uv run pytest -s --nbval --cov=pysrc ./pytest/ env: PYTHON_JULIACALL_THREADS: '2' + - name: Upload coverage to Codecov uses: codecov/codecov-action@v5 env: diff --git a/pyproject.toml b/pyproject.toml index 34e48b5d..672643d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,8 +12,17 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] -requires-python = ">=3.8" -dependencies = ["juliapkg ~=0.1.17"] +requires-python = ">=3.8, <4" +dependencies = ["juliapkg >=0.1.17, <0.2"] + +[dependency-groups] +dev = [ + "flake8>=5.0", + "nbval>=0.11.0", + "numpy>=1.24", + "pytest>=8.3", + "pytest-cov>=5.0", +] [tool.hatch.build.targets.wheel] packages = ["pysrc/juliacall"] From 2b12ca7abcf55da9df3d90cd89fdc2f86b0b3d36 Mon Sep 17 00:00:00 2001 From: Christopher Doris Date: Wed, 4 Jun 2025 15:47:06 +0100 Subject: [PATCH 2/3] fix python version --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b33b0de5..3730db94 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -56,7 +56,7 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest, windows-latest, macos-latest] - pyversion: ["3.x", "3.8"] + pyversion: [">=3.8", "3.8"] steps: - uses: actions/checkout@v4 From 18e771e701188d243369399bd2e9b4eca7e3a5ba Mon Sep 17 00:00:00 2001 From: Christopher Doris Date: Wed, 4 Jun 2025 15:51:01 +0100 Subject: [PATCH 3/3] fix source folder to be linted --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3730db94..94babe39 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -84,9 +84,9 @@ jobs: - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names - uv run flake8 . --count --select=E9,F63,F7,F82 --ignore=F821 --show-source --statistics + uv run flake8 ./pysrc ./pytest --count --select=E9,F63,F7,F82 --ignore=F821 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - uv run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + uv run flake8 ./pysrc ./pytest --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Run tests run: |