diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e1517cde..e4c8ef13 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -3,67 +3,69 @@ name: Test on: push: branches: [main] - tags: - - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 + tags: ["v*"] # Push events to matching v*, i.e. v1.0, v20.15.10 pull_request: - branches: "*" + branches: ["*"] jobs: test: - runs-on: ${{ matrix.os }} - defaults: - run: - shell: bash -e {0} # -e to fail on error - + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - python: ["3.10", "3.12"] - os: [ubuntu-latest] + env: ["dev-py311", "dev-py313"] + # Configure pytest-xdist env: - OS: ${{ matrix.os }} - PYTHON: ${{ matrix.python }} + OMP_NUM_THREADS: "1" + OPENBLAS_NUM_THREADS: "1" + MKL_NUM_THREADS: "1" + NUMEXPR_MAX_THREADS: "1" + MPLBACKEND: "agg" + DISPLAY: ":42" + PYTEST_ADDOPTS: "-n auto --dist=load --durations=10" steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python }} - - name: Get pip cache dir - id: pip-cache-dir - run: | - echo "::set-output name=dir::$(pip cache dir)" - - name: Restore pip cache - uses: actions/cache@v3 + # Cache rattler's shared package cache (speeds up downloads) + - name: Restore rattler cache + uses: actions/cache@v4 with: - path: ${{ steps.pip-cache-dir.outputs.dir }} - key: pip-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml') }} + path: ~/.cache/rattler + key: rattler-${{ runner.os }}-${{ matrix.env }}-${{ hashFiles('pyproject.toml') }} restore-keys: | - pip-${{ runner.os }}-${{ env.pythonLocation }}- - - name: Install test dependencies - run: | - python -m pip install --upgrade pip wheel - pip install pytest-cov - - name: Install dependencies + rattler-${{ runner.os }}-${{ matrix.env }}- + rattler-${{ runner.os }}- + + # Install pixi and the requested environment + - uses: prefix-dev/setup-pixi@v0.9.0 + with: + environments: ${{ matrix.env }} + # We're not comitting the pixi-lock file + locked: false + cache: false + activate-environment: ${{ matrix.env }} + + - name: Show versions run: | - pip install numpy - pip install --pre -e ".[dev,test,pre]" - - name: Test + python --version + pixi --version + + - name: Run tests env: MPLBACKEND: agg - PLATFORM: ${{ matrix.os }} - DISPLAY: :42 + DISPLAY: ":42" run: | pytest -v --cov --color=yes --cov-report=xml + - name: Archive figures generated during testing if: always() uses: actions/upload-artifact@v4 with: - name: visual_test_results_${{ matrix.os }}-python${{ matrix.python }} + name: visual_test_results_${{ matrix.env }} path: /home/runner/work/spatialdata-plot/spatialdata-plot/tests/figures/* + - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 with: diff --git a/pyproject.toml b/pyproject.toml index d491c024..54d453fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,14 +9,14 @@ authors = [ {name = "scverse"}, ] maintainers = [ - {name = "scverse", email = "tim.treis@helmholtz-munich.de"}, + {name = "Tim Treis", email = "tim.treis@scverse.org"}, ] urls.Documentation = "https://spatialdata.scverse.org/projects/plot/en/latest/index.html" urls.Source = "https://github.com/scverse/spatialdata-plot.git" urls.Home-page = "https://github.com/scverse/spatialdata-plot.git" -requires-python = ">=3.10" +requires-python = ">=3.11" dynamic= [ - "version" # allow version to be set by git tags + "version" # allow version to be set by git tags ] license = {file = "LICENSE"} readme = "README.md" @@ -30,7 +30,16 @@ dependencies = [ [project.optional-dependencies] dev = [ - "bump2version", + "jupyterlab", + "notebook", + "ipykernel", + "ipywidgets", + "jupytext", + "pytest", + "pytest-cov", + "pooch", + "ruff", + "pre-commit", ] docs = [ "sphinx>=4.5", @@ -47,12 +56,9 @@ docs = [ test = [ "pytest", "pytest-cov", + "pytest-xdist", "pooch", # for scipy.datasets module ] -# this will be used by readthedocs and will make pip also look for pre-releases, generally installing the latest available version -pre = [ - "spatialdata>=0.1.0-pre0" -] [tool.coverage.run] source = ["spatialdata_plot"] @@ -143,30 +149,45 @@ unfixable = ["B", "UP", "C4", "BLE", "T20", "RET"] "tests/*" = ["D", "PT", "B024"] "*/__init__.py" = ["F401", "D104", "D107", "E402"] "docs/*" = ["D","B","E","A"] - # "src/spatialdata/transformations/transformations.py" = ["D101","D102", "D106", "B024", "T201", "RET504"] "tests/conftest.py"= ["E402", "RET504"] "src/spatialdata_plot/pl/utils.py"= ["PGH003"] [tool.ruff.lint.pydocstyle] convention = "numpy" -[tool.bumpver] -current_version = "0.0.2" -version_pattern = "MAJOR.MINOR.PATCH" -commit_message = "bump version {old_version} -> {new_version}" -tag_message = "{new_version}" -tag_scope = "default" -pre_commit_hook = "" -post_commit_hook = "" -commit = true -tag = true -push = false - -[tool.bumpver.file_patterns] -"pyproject.toml" = [ - 'current_version = "{version}"', -] -"README.md" = [ - "{version}", - "{pep440_version}", -] +[tool.pixi.workspace] +channels = ["conda-forge"] +platforms = ["osx-arm64", "linux-64"] + +[tool.pixi.dependencies] +python = ">=3.11" + +[tool.pixi.pypi-dependencies] +spatialdata-plot = { path = ".", editable = true } + +# for gh-actions +[tool.pixi.feature.py311.dependencies] +python = "3.11.*" + +[tool.pixi.feature.py313.dependencies] +python = "3.13.*" + +[tool.pixi.environments] +# 3.11 lane (for gh-actions) +dev-py311 = { features = ["dev", "test", "py311"], solve-group = "py311" } +docs-py311 = { features = ["docs", "py311"], solve-group = "py311" } + +# 3.13 lane +default = { features = ["py313"], solve-group = "py313" } +dev-py313 = { features = ["dev", "test", "py313"], solve-group = "py313" } +docs-py313 = { features = ["docs", "py313"], solve-group = "py313" } +test-py313 = { features = ["test", "py313"], solve-group = "py313" } + +[tool.pixi.tasks] +lab = "jupyter lab" +kernel-install = "python -m ipykernel install --user --name pixi-dev --display-name \"sdata-plot (dev)\"" +test = "pytest -v --color=yes --tb=short --durations=10" +lint = "ruff check ." +format = "ruff format ." +pre-commit-install = "pre-commit install" +pre-commit-run = "pre-commit run --all-files" \ No newline at end of file