Skip to content

Commit 10e5e44

Browse files
Update CI (#1025)
* dedupe readme * everything except tox * tox-uv * no need to activate * actually use pre-release flag * add check for more flexibility for tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 17341d0 commit 10e5e44

File tree

6 files changed

+49
-134
lines changed

6 files changed

+49
-134
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,13 @@ jobs:
1414
package:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v3
18-
- name: Set up Python 3.10
19-
uses: actions/setup-python@v4
17+
- uses: actions/checkout@v5
18+
- name: Set up Python 3.12
19+
uses: astral-sh/setup-uv@v6
2020
with:
21-
python-version: "3.10"
22-
cache: "pip"
23-
cache-dependency-path: "**/pyproject.toml"
24-
- name: Install build dependencies
25-
run: python -m pip install --upgrade pip wheel twine build
21+
python-version: "3.12"
22+
enable-cache: true
2623
- name: Build package
27-
run: python -m build
24+
run: uvx hatch build
2825
- name: Check package
29-
run: twine check --strict dist/*.whl
26+
run: uvx twine check --strict dist/*.whl

.github/workflows/deployment.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,18 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@v5
2121
with:
2222
fetch-depth: 0
2323

24-
- name: Set up Python 3.10
25-
uses: actions/setup-python@v4
24+
- name: Set up Python 3.12
25+
uses: astral-sh/setup-uv@v6
2626
with:
27-
python-version: "3.10"
28-
29-
- name: Install hatch
30-
run: pip install hatch
27+
python-version: "3.12"
3128

3229
# this will fail if the last commit is not tagged
3330
- name: Build project for distribution
34-
run: hatch build
31+
run: uvx hatch build
3532

3633
- name: Publish on PyPI
3734
uses: pypa/gh-action-pypi-publish@release/v1
@@ -46,14 +43,14 @@ jobs:
4643
needs: deploy
4744
runs-on: ubuntu-latest
4845
steps:
49-
- uses: actions/checkout@v3
46+
- uses: actions/checkout@v5
5047
- name: Extract branch name
5148
id: vars
5249
run: |
5350
echo ::set-output name=branch::${GITHUB_REF#refs/*/}
5451
5552
- name: Merge release into main
56-
uses: everlytic/[email protected].2
53+
uses: everlytic/[email protected].5
5754
with:
5855
github_token: ${{ secrets.RELEASE_DISPATCH_TOKEN }}
5956
target_branch: main

.github/workflows/release.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,16 @@ jobs:
99
runs-on: ubuntu-latest
1010
if: startsWith(github.ref, 'refs/tags/v')
1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v5
1313
- name: Set up Python 3.12
14-
uses: actions/setup-python@v5
14+
uses: astral-sh/setup-uv@v6
1515
with:
1616
python-version: "3.12"
17-
cache: pip
18-
- name: Install build dependencies
19-
run: python -m pip install --upgrade pip wheel twine build
17+
enable-cache: true
2018
- name: Build package
21-
run: python -m build
19+
run: uvx hatch build
2220
- name: Check package
23-
run: twine check --strict dist/*.whl
24-
- name: Install hatch
25-
run: pip install hatch
26-
- name: Build project for distribution
27-
run: hatch build
21+
run: uvx twine check --strict dist/*.whl
2822
- name: Publish a Python distribution to PyPI
2923
uses: pypa/gh-action-pypi-publish@release/v1
3024
with:

.github/workflows/test.yml

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,45 +25,32 @@ jobs:
2525
include:
2626
- python: "3.12"
2727
os: macos-latest
28-
pip-flags: "--pre"
28+
pre-release: "allow"
2929
name: "Python 3.12 (pre-release)"
3030

3131
env:
3232
OS: ${{ matrix.os }}
3333
PYTHON: ${{ matrix.python }}
34+
UV_PRERELEASE: ${{ matrix.pre-release || 'disallow' }}
3435

3536
steps:
36-
- uses: actions/checkout@v3
37+
- uses: actions/checkout@v5
3738
- name: Set up Python ${{ matrix.python }}
38-
uses: actions/setup-python@v5
39+
uses: astral-sh/setup-uv@v6
3940
with:
4041
python-version: ${{ matrix.python }}
41-
42-
- name: Get pip cache dir
43-
id: pip-cache-dir
44-
run: |
45-
echo "::set-output name=dir::$(pip cache dir)"
46-
47-
- name: Restore pip cache
48-
uses: actions/cache@v3
49-
with:
50-
path: ${{ steps.pip-cache-dir.outputs.dir }}
51-
key: pip-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/requirements.txt') }}
52-
restore-keys: |
53-
pip-${{ runner.os }}-${{ env.pythonLocation }}-
42+
enable-cache: true
5443

5544
- name: Install dependencies
5645
run: |
5746
./.scripts/ci/install_dependencies.sh
5847
5948
- name: Install pip dependencies
60-
run: |
61-
python -m pip install --upgrade pip
62-
pip install tox tox-gh-actions
49+
run: uv tool install tox --with=tox-uv --with=tox-gh-actions
6350

6451
- name: Restore data cache
6552
id: data-cache
66-
uses: actions/cache@v3
53+
uses: actions/cache@v4
6754
with:
6855
path: |
6956
~/.cache/squidpy/*.h5ad
@@ -77,10 +64,10 @@ jobs:
7764
# caching .tox is not encouraged, but since we're private and this shaves off ~1min from the step
7865
# if any problems occur and/or once the package is public, this can be removed
7966
- name: Restore tox cache
80-
uses: actions/cache@v3
67+
uses: actions/cache@v4
8168
with:
8269
path: .tox
83-
key: tox-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/requirements.txt', '**/tox.ini') }}
70+
key: tox-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('**/requirements.txt', '**/tox.ini') }}
8471

8572
- name: Test
8673
timeout-minutes: 60
@@ -103,8 +90,17 @@ jobs:
10390
path: /home/runner/work/squidpy/squidpy/tests/figures/*
10491

10592
- name: Upload coverage to Codecov
106-
uses: codecov/codecov-action@v4
93+
uses: codecov/codecov-action@v5
10794
with:
10895
name: coverage
10996
verbose: true
11097
token: ${{ secrets.CODECOV_TOKEN }} # required
98+
99+
check:
100+
if: always()
101+
needs: [test]
102+
runs-on: ubuntu-latest
103+
steps:
104+
- uses: re-actors/alls-green@release/v1
105+
with:
106+
jobs: ${{ toJSON(needs) }}

README_pypi.rst

Lines changed: 0 additions & 77 deletions
This file was deleted.

pyproject.toml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
[build-system]
22
build-backend = "hatchling.build"
3-
requires = ["hatchling", "hatch-vcs"]
3+
requires = ["hatchling", "hatch-vcs", "hatch-fancy-pypi-readme"]
44

55
[project]
66
name = "squidpy"
7-
dynamic = ["version"]
7+
dynamic = ["readme", "version"]
88
description = "Spatial Single Cell Analysis in Python"
9-
readme = "README.rst"
109
requires-python = ">=3.10"
1110
license = "BSD-3-Clause"
1211
classifiers = [
@@ -121,6 +120,15 @@ source = "vcs"
121120
[tool.hatch.metadata]
122121
allow-direct-references = true
123122

123+
[tool.hatch.metadata.hooks.fancy-pypi-readme]
124+
content-type = "text/x-rst"
125+
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
126+
text = "|PyPI| |Downloads| |CI| |Docs| |Coverage| |Discourse| |Zulip|"
127+
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
128+
path = "README.rst"
129+
start-after = "|NumFOCUS|"
130+
end-before = "Squidpy is part of the scverse® project"
131+
124132
[tool.ruff]
125133
line-length = 120
126134
exclude = [

0 commit comments

Comments
 (0)