Skip to content

Commit 053eb7e

Browse files
authored
Merge pull request #306 from SciCatProject/better-task-runner
Manage project with Just and uv
2 parents 561dccb + 2e94af5 commit 053eb7e

35 files changed

+3154
-790
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@ jobs:
1313
runs-on: ubuntu-24.04
1414
steps:
1515
- uses: actions/checkout@v4
16-
- uses: actions/setup-python@v5
17-
- run: python -m pip install --upgrade pip
18-
- run: python -m pip install -r requirements/ci.txt
19-
- run: tox -e static
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v6
18+
- name: Install Just
19+
uses: extractions/setup-just@v3
20+
- name: Install pre-commit
21+
run: uv tool install pre-commit --with pre-commit-uv
22+
# The first run of pre-commit may reformat files. If this happens, it returns 1 but this
23+
# should not fail the job. So just run again if it fails. A second failure means that
24+
# either the different formatters can't agree on a format or that static analysis failed.
25+
- run: pre-commit run -a || pre-commit run -a
2026
- uses: stefanzweifel/git-auto-commit-action@v6
2127
with:
2228
commit_message: Apply automatic formatting
@@ -27,30 +33,33 @@ jobs:
2733
runs-on: ubuntu-24.04
2834
steps:
2935
- uses: actions/checkout@v4
30-
- uses: actions/setup-python@v5
36+
- name: Install uv
37+
uses: astral-sh/setup-uv@v6
3138
with:
32-
python-version: 3.11
33-
- run: python -m pip install --upgrade pip
34-
- run: python -m pip install -r requirements/ci.txt
35-
- run: tox -e mypy
39+
entrypoint: "3.11" # TODO remove once we drop Python 3.10
40+
# TODO remove once we drop Python 3.10
41+
- run: uv python pin 3.11
42+
- name: Install Just
43+
uses: extractions/setup-just@v3
44+
- run: just mypy
3645

3746
tests:
3847
name: Tests
3948
needs: formatting
4049
strategy:
4150
matrix:
4251
include:
43-
- {python: '3.13', os: ubuntu-24.04, tox: py313-full}
44-
- {python: '3.12', os: ubuntu-24.04, tox: py312-full}
45-
- {python: '3.11', os: ubuntu-24.04, tox: py311-full}
46-
- {python: '3.10', os: ubuntu-24.04, tox: py310-full}
47-
- {python: '3.10', os: macos-14, tox: py310}
48-
- {python: '3.10', os: windows-2022, tox: py310}
52+
- {python: '3.13', os: ubuntu-24.04, command: test-all}
53+
- {python: '3.12', os: ubuntu-24.04, command: test-all}
54+
- {python: '3.11', os: ubuntu-24.04, command: test-all}
55+
- {python: '3.10', os: ubuntu-24.04, command: test-all}
56+
- {python: '3.10', os: macos-14, command: test}
57+
- {python: '3.10', os: windows-2022, command: test}
4958
uses: ./.github/workflows/test.yml
5059
with:
5160
os-variant: ${{ matrix.os }}
5261
python-version: ${{ matrix.python }}
53-
tox-env: ${{ matrix.tox }}
62+
command: ${{ matrix.command }}
5463
secrets: inherit
5564

5665
docs:

.github/workflows/docs.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ jobs:
2222
steps:
2323
- run: sudo apt install --yes pandoc
2424
- uses: actions/checkout@v4
25-
- uses: actions/setup-python@v5
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@v6
2627
with:
27-
python-version: 3.11
28-
- run: python -m pip install --upgrade pip
29-
- run: python -m pip install -r requirements/ci.txt
30-
- run: tox -e docs
31-
- run: touch html/.nojekyll
28+
entrypoint: "3.11" # TODO remove once we drop Python 3.10
29+
- name: Install Just
30+
uses: extractions/setup-just@v3
31+
- name: Build and test docs
32+
run: just docs
3233
- uses: actions/upload-pages-artifact@v3
3334
name: Upload documentation as artifact
3435
with:

.github/workflows/release.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ jobs:
1515
with:
1616
fetch-depth: 0 # history required so setuptools_scm can determine version
1717

18-
- uses: actions/setup-python@v5
19-
- run: python -m pip install --upgrade pip
20-
- run: python -m pip install -r requirements/wheels.txt
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v6
20+
- name: Install Just
21+
uses: extractions/setup-just@v3
2122

2223
- name: Build wheels
23-
run: python -m build
24+
run: just build
2425

2526
- name: Upload wheels
2627
uses: actions/upload-artifact@v4

.github/workflows/test.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ on:
1010
python-version:
1111
type: string
1212
description: 'Python interpreter version'
13-
tox-env:
13+
command:
1414
type: string
15-
description: 'Tox environment to run'
15+
description: 'Test command to run'
1616
checkout-ref:
1717
default: ''
1818
type: string
@@ -28,7 +28,7 @@ on:
2828
type: string
2929
python-version:
3030
type: string
31-
tox-env:
31+
command:
3232
default: 'test'
3333
type: string
3434
checkout-ref:
@@ -40,20 +40,21 @@ on:
4040

4141
jobs:
4242
tests:
43-
name: Tests ${{ inputs.os-variant }} ${{ inputs.tox-env }}
43+
name: Tests ${{ inputs.os-variant }} ${{ inputs.command }}
4444
runs-on: ${{ inputs.os-variant }}
4545
steps:
4646
- run: sudo apt install --yes docker-compose
4747
if: ${{ contains(inputs.os-variant, 'ubuntu') }}
4848
- uses: actions/checkout@v4
4949
with:
5050
ref: ${{ inputs.checkout-ref }}
51-
- uses: actions/setup-python@v5
51+
- name: Install uv
52+
uses: astral-sh/setup-uv@v6
5253
with:
53-
python-version: ${{ inputs.python-version }}
54-
- run: python -m pip install --upgrade pip
55-
- run: python -m pip install -r requirements/ci.txt
56-
- run: tox -e ${{ inputs.tox-env }}
54+
entrypoint: "${{ inputs.python-version }}"
55+
- name: Install Just
56+
uses: extractions/setup-just@v3
57+
- run: just ${{ inputs.command }}
5758
if: ${{ !inputs.backend-version }}
58-
- run: tox -e ${{ inputs.tox-env }} -- --scitacean-backend-version=${{ inputs.backend-version }}
59+
- run: just ${{ inputs.command }} --scitacean-backend-version=${{ inputs.backend-version }}
5960
if: ${{ inputs.backend-version }}

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,3 @@ __pycache__/
2626
Pipfile
2727
venv
2828
.venv
29-
30-
# We don't use uv for project management
31-
uv.lock

.pre-commit-config.yaml

Lines changed: 69 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,70 @@
11
repos:
2-
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v5.0.0
4-
hooks:
5-
- id: check-added-large-files
6-
- id: check-case-conflict
7-
- id: check-illegal-windows-names
8-
- id: check-json
9-
- id: check-merge-conflict
10-
- id: check-toml
11-
- id: check-yaml
12-
- id: detect-private-key
13-
- id: end-of-file-fixer
14-
- id: trailing-whitespace
15-
args: [--markdown-linebreak-ext=md]
16-
- repo: https://github.com/kynan/nbstripout
17-
rev: 0.8.1
18-
hooks:
19-
- id: nbstripout
20-
types: ["jupyter"]
21-
args: ["--drop-empty-cells",
22-
"--extra-keys 'metadata.language_info.version cell.metadata.jp-MarkdownHeadingCollapsed cell.metadata.pycharm'"]
23-
- repo: https://github.com/astral-sh/ruff-pre-commit
24-
rev: v0.12.0
25-
hooks:
26-
- id: ruff-format
27-
types_or: [ python, pyi ]
28-
- id: ruff
29-
args: [--fix, --exit-non-zero-on-fix]
30-
types_or: [ python, pyi, jupyter ]
31-
- repo: https://github.com/codespell-project/codespell
32-
rev: v2.4.1
33-
hooks:
34-
- id: codespell
35-
additional_dependencies:
36-
- tomli
37-
- repo: https://github.com/pre-commit/pygrep-hooks
38-
rev: v1.10.0
39-
hooks:
40-
- id: python-use-type-annotations
41-
- id: rst-backticks
42-
- id: rst-directive-colons
43-
- id: rst-inline-touching-normal
44-
- id: text-unicode-replacement-char
45-
- repo: https://github.com/rhysd/actionlint
46-
rev: v1.7.7
47-
hooks:
48-
- id: actionlint
2+
- repo: local
3+
hooks:
4+
- id: uv-lock
5+
name: lock dependencies
6+
entry: just lock
7+
language: system
8+
files: ^(uv\.lock|pyproject\.toml|uv\.toml)$
9+
pass_filenames: false
10+
11+
- repo: https://github.com/pre-commit/pre-commit-hooks
12+
rev: v5.0.0
13+
hooks:
14+
- id: check-added-large-files
15+
- id: check-case-conflict
16+
- id: check-illegal-windows-names
17+
- id: check-json
18+
- id: check-merge-conflict
19+
- id: check-toml
20+
- id: check-yaml
21+
- id: detect-private-key
22+
- id: end-of-file-fixer
23+
- id: trailing-whitespace
24+
args: [--markdown-linebreak-ext=md]
25+
26+
- repo: local
27+
hooks:
28+
- id: nbstripout
29+
name: strip notebook outputs
30+
entry: just strip-output
31+
language: system
32+
types_or: ["jupyter"]
33+
require_serial: true
34+
- id: format-python
35+
name: format python code
36+
entry: just format-python
37+
language: system
38+
types_or: ["python", "pyi"]
39+
require_serial: true
40+
- id: format-md
41+
name: format markdown
42+
entry: just format-md
43+
language: system
44+
types: [file, markdown]
45+
46+
- id: lint-python
47+
name: lint python code
48+
entry: just lint-python
49+
language: system
50+
types_or: ["python", "pyi", "jupyter"]
51+
require_serial: true
52+
- id: spelling
53+
name: check spelling
54+
entry: just spell
55+
language: system
56+
types: [text]
57+
58+
- repo: https://github.com/pre-commit/pygrep-hooks
59+
rev: v1.10.0
60+
hooks:
61+
- id: python-use-type-annotations
62+
- id: rst-backticks
63+
- id: rst-directive-colons
64+
- id: rst-inline-touching-normal
65+
- id: text-unicode-replacement-char
66+
67+
- repo: https://github.com/rhysd/actionlint
68+
rev: v1.7.7
69+
hooks:
70+
- id: actionlint

CODE_OF_CONDUCT.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
1717
Examples of behavior that contributes to a positive environment for our
1818
community include:
1919

20-
* Demonstrating empathy and kindness toward other people
21-
* Being respectful of differing opinions, viewpoints, and experiences
22-
* Giving and gracefully accepting constructive feedback
23-
* Accepting responsibility and apologizing to those affected by our mistakes,
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
2424
and learning from the experience
25-
* Focusing on what is best not just for us as individuals, but for the
25+
- Focusing on what is best not just for us as individuals, but for the
2626
overall community
2727

2828
Examples of unacceptable behavior include:
2929

30-
* The use of sexualized language or imagery, and sexual attention or
30+
- The use of sexualized language or imagery, and sexual attention or
3131
advances of any kind
32-
* Trolling, insulting or derogatory comments, and personal or political attacks
33-
* Public or private harassment
34-
* Publishing others' private information, such as a physical or email
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email
3535
address, without their explicit permission
36-
* Other conduct which could reasonably be considered inappropriate in a
36+
- Other conduct which could reasonably be considered inappropriate in a
3737
professional setting
3838

3939
## Enforcement Responsibilities
@@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
106106
### 4. Permanent Ban
107107

108108
**Community Impact**: Demonstrating a pattern of violation of community
109-
standards, including sustained inappropriate behavior, harassment of an
109+
standards, including sustained inappropriate behavior, harassment of an
110110
individual, or aggression toward or disparagement of classes of individuals.
111111

112112
**Consequence**: A permanent ban from any sort of public interaction within
@@ -121,8 +121,8 @@ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
121121
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122122
enforcement ladder](https://github.com/mozilla/diversity).
123123

124-
[homepage]: https://www.contributor-covenant.org
125-
126124
For answers to common questions about this code of conduct, see the FAQ at
127125
https://www.contributor-covenant.org/faq. Translations are available at
128126
https://www.contributor-covenant.org/translations.
127+
128+
[homepage]: https://www.contributor-covenant.org

SECURITY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Only the latest version is supported.
77
## Reporting a Vulnerability
88

99
If you believe you have found a security vulnerability in Scitacean, please
10+
1011
- ✅ report it to us by creating a [security advisory](https://github.com/SciCatProject/scitacean/security/advisories/new).
1112
- ❌ do not report security vulnerabilities through public GitHub issues, discussions, or pull requests, etc.
1213

docs/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@
192192
linkcheck_ignore = [
193193
# Specific lines in GitHub blobs cannot be found by linkcheck.
194194
r"https?://github\.com/.*?/blob/[a-f0-9]+/.+?#",
195+
# These hit a rate limit and are very slow.
196+
r"https?://github\.com/.*?/blob/",
195197
]
196198

197199
# -- Options for autodoc_pydantic -----------------------------------------

docs/developer/dependency-management.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ Dependency management
22
=====================
33

44
Scitacean is a library, so the package dependencies are never pinned.
5-
But lower bounds are fine and individual versions can be excluded.
5+
But (correct) lower bounds are encouraged and individual versions can be excluded.
66
See, e.g., `Should You Use Upper Bound Version Constraints <https://iscinumpy.dev/post/bound-version-constraints/>`_ for an explanation.
77

88
Development dependencies [#0]_ are pinned to an exact version in order to ensure reproducibility.
9-
This is done by specifying packages and version constraints in ``requirements/*.in`` files and locking those dependencies using `pip-compile-multi <https://pip-compile-multi.readthedocs.io/en/latest/index.html>`_ to produce ``requirements/*.txt`` files.
10-
Those files are then used by `tox <https://tox.wiki/en/latest/>`_ to create isolated environments and run tests, build docs, etc.
9+
This is done automatically by `uv <https://docs.astral.sh/uv/>`_ whenever ``pyproject.toml`` is updated.
10+
Pins can be updated explicitly using
1111

12-
tox can be cumbersome to use for local development.
13-
So ``requirements/dev.txt`` can be used to create a virtual environment with all dependencies.
12+
.. code-block:: bash
13+
14+
just lock
1415
1516
.. rubric:: Footnotes
1617

0 commit comments

Comments
 (0)