Skip to content

Commit eb6bce6

Browse files
committed
build: switch to uv
1 parent 8cd34fe commit eb6bce6

File tree

12 files changed

+1955
-1320
lines changed

12 files changed

+1955
-1320
lines changed

.github/CONTRIBUTING.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ If you are proposing a feature:
4545

4646
Ready to contribute?
4747

48-
You need Python >= 3.10 and [hatch](https://github.com/pypa/hatch). You can install it globally with
48+
You need Python >= 3.10 and [uv](https://github.com/astral-sh/uv). You can install it globally with
4949
[pipx](https://github.com/pypa/pipx):
5050

51+
https://docs.astral.sh/uv/getting-started/installation/
52+
5153
```console
5254
$ pipx install hatch
5355
```
@@ -73,7 +75,7 @@ Here's how to set up `python-re3data` for local development.
7375

7476
```console
7577
$ cd python-re3data
76-
$ hatch shell
78+
$ uv sync --frozen
7779
```
7880

7981
4. Create a branch for local development:
@@ -87,8 +89,8 @@ Here's how to set up `python-re3data` for local development.
8789
5. When you're done making changes, check that your changes pass pre-commit and the tests:
8890

8991
```console
90-
$ hatch run check
91-
$ hatch run cov
92+
$ just check
93+
$ just cov
9294
```
9395

9496
6. Commit your changes and push your branch to GitHub:

.github/workflows/docs.yml

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

.github/workflows/pr.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,30 @@ permissions: {}
1818
env:
1919
PYTHONUNBUFFERED: 1
2020
FORCE_COLOR: 1
21+
UV_FROZEN: true # do not update the lockfile during `uv sync` and `uv run` commands
2122

2223
jobs:
2324
test:
2425
uses: ./.github/workflows/test.yml
26+
2527
docs:
26-
permissions:
27-
contents: write
28-
uses: ./.github/workflows/docs.yml
28+
# disables this workflow from running in a repository that is not part of the indicated organization/user
29+
if: github.repository_owner == 'afuetterer'
30+
runs-on: ubuntu-24.04
31+
steps:
32+
- name: Set up just
33+
uses: extractions/setup-just@v2
34+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35+
- name: Set up uv
36+
uses: astral-sh/setup-uv@4db96194c378173c656ce18a155ffc14a9fc4355 # v5.2.2
37+
with:
38+
python-version: '3.13'
39+
enable-cache: true
40+
prune-cache: false
41+
cache-suffix: docs
42+
- run: just sync-docs
43+
- run: just docs-build
44+
2945
required-checks-pass:
3046
if: always()
3147
needs:

.github/workflows/publish.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
# Set permissions at the job level.
99
permissions: {}
1010

11+
env:
12+
UV_FROZEN: true # do not update the lockfile during `uv sync` and `uv run` commands
13+
1114
jobs:
1215
build:
1316
name: Build the package
@@ -17,6 +20,7 @@ jobs:
1720
steps:
1821
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1922
- uses: hynek/build-and-inspect-python-package@b5076c307dc91924a82ad150cdd1533b444d3310 # v2.12.0
23+
2024
upload:
2125
name: Upload package distributions to GitHub Releases
2226
# disables this workflow from running in a repository that is not part of the indicated organization/user
@@ -35,6 +39,7 @@ jobs:
3539
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
3640
with:
3741
files: dist/*
42+
3843
publish:
3944
# disables this workflow from running in a repository that is not part of the indicated organization/user
4045
if: github.repository_owner == 'afuetterer'
@@ -95,3 +100,28 @@ jobs:
95100
labels: ${{ steps.meta.outputs.labels }}
96101
# Ref: https://docs.docker.com/build/attestations/slsa-provenance/
97102
provenance: false
103+
104+
docs:
105+
# disables this workflow from running in a repository that is not part of the indicated organization/user
106+
if: github.repository_owner == 'afuetterer'
107+
runs-on: ubuntu-24.04
108+
permissions:
109+
contents: write
110+
steps:
111+
- name: Set up just
112+
uses: extractions/setup-just@v2
113+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
114+
with:
115+
fetch-depth: 0 # fetch all commits and branches
116+
- name: Set up uv
117+
uses: astral-sh/setup-uv@4db96194c378173c656ce18a155ffc14a9fc4355 # v5.2.2
118+
with:
119+
python-version: '3.13'
120+
enable-cache: true
121+
prune-cache: false
122+
cache-suffix: docs
123+
- run: just sync-docs
124+
- run: just docs-deploy
125+
env:
126+
GIT_COMMITTER_NAME: github-actions[bot]
127+
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com

.github/workflows/test.yml

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ permissions: {}
99
env:
1010
PYTHONUNBUFFERED: 1
1111
FORCE_COLOR: 1
12+
UV_FROZEN: true # do not update the lockfile during `uv sync` and `uv run` commands
1213

1314
jobs:
1415
test:
@@ -18,23 +19,26 @@ jobs:
1819
matrix:
1920
python-version: ['3.10', '3.12', '3.13']
2021
steps:
22+
- name: Set up just
23+
uses: extractions/setup-just@v2
2124
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22-
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
25+
- name: Set up uv
26+
uses: astral-sh/setup-uv@4db96194c378173c656ce18a155ffc14a9fc4355 # v5.2.2
2427
with:
2528
python-version: ${{ matrix.python-version }}
26-
cache: pip
27-
- name: Install pre-requisites (e.g. hatch)
28-
run: python -m pip install --require-hashes --requirement=requirements/ci
29+
enable-cache: true
30+
prune-cache: false
31+
- name: Install project, including dev dependencies
32+
run: just sync
2933
- name: Run test suite
30-
run: hatch run cov
34+
run: just cov
3135
env:
3236
TERM: dumb # keep rich from printing escape sequences, which made testing CLI outputs messy
3337
- name: Generate coverage report
3438
run: |
3539
export TOTAL_COV=$(hatch run cov-total)
3640
echo "TOTAL_COV=$TOTAL_COV" >> $GITHUB_ENV
37-
hatch run cov-report-markdown
41+
just cov-report-markdown
3842
echo "### Total coverage: ${TOTAL_COV}%" >> $GITHUB_STEP_SUMMARY
3943
cat coverage.md >> $GITHUB_STEP_SUMMARY
4044
if: matrix.python-version == '3.13'
@@ -66,31 +70,32 @@ jobs:
6670
matrix:
6771
os: [ubuntu-latest, windows-latest, macos-latest]
6872
steps:
73+
- name: Set up just
74+
uses: extractions/setup-just@v2
6975
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
70-
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
76+
- name: Set up uv
77+
uses: astral-sh/setup-uv@4db96194c378173c656ce18a155ffc14a9fc4355 # v5.2.2
7178
with:
7279
python-version: '3.13'
73-
cache: pip
74-
- run: python -Im pip install --editable .[dev]
80+
enable-cache: true
81+
prune-cache: false
82+
- run: just sync
7583
- run: python -Ic 'import re3data; print(re3data.__version__)'
7684
- run: re3data --version
77-
- name: Set up pipdeptree
78-
if: matrix.os == 'ubuntu-latest'
79-
run: python -m pip install --require-hashes --requirement=requirements/ci
8085
- name: Write info to step summary
8186
if: matrix.os == 'ubuntu-latest'
8287
run: |
8388
{
8489
echo -e "### ✓ All dependencies installed successfully\n\n"
8590
echo '<details><summary>Installed Python packages (dependency tree)</summary>'
8691
echo -e "\n\`\`\`console"
87-
echo "$ uv pip tree --package=python-re3data"
88-
uv pip tree --package=python-re3data
92+
echo "$ uv tree --no-group={dev,test}"
93+
uv tree --no-group={dev,test}
8994
echo -e "\`\`\`\n</details>"
9095
echo '<details><summary>Outdated Python packages</summary>'
9196
echo -e "\n\`\`\`console"
92-
echo "$ python -m pip list --outdated"
93-
python -m pip list --outdated
97+
echo "$ uv pip list --outdated"
98+
uv pip list --outdated
9499
echo -e "\`\`\`\n</details>"
95100
} >> $GITHUB_STEP_SUMMARY
96101
@@ -107,11 +112,14 @@ jobs:
107112
env:
108113
NO_COLOR: 1
109114
steps:
115+
- name: Set up just
116+
uses: extractions/setup-just@v2
110117
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
111-
- uses: astral-sh/setup-uv@4db96194c378173c656ce18a155ffc14a9fc4355 # v5.2.2
118+
- name: Set up uv
119+
uses: astral-sh/setup-uv@4db96194c378173c656ce18a155ffc14a9fc4355 # v5.2.2
112120
- name: Get package version
113121
id: package-version
114-
run: echo "version=$(uvx hatch version)" >> $GITHUB_OUTPUT
122+
run: echo "version=$(just project-version)" >> $GITHUB_OUTPUT
115123
- uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
116124
- name: Build and push
117125
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0

.github/workflows/upgrade-requirements.yml

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

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
| :---------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1010
| __Docs__ | [![docs][docs-badge]][docs-workflow] |
1111
| __Package__ | [![pypi-status][status-badge]][pypi-url] [![pypi-version][pypi-version-badge]][pypi-url] [![pypi-python-versions][pypi-python-versions-badge]][pypi-url] [![all-downloads][all-downloads-badge]][pepy-tech-url] [![monthly-downloads][monthly-downloads-badge]][pepy-tech-url] |
12-
| __Meta__ | [![doi][doi-badge]][doi-url] [![OpenSSF Scorecard][scorecard-badge]][scorecard-url] [![hatch][hatch-badge]][hatch] [![ruff][ruff-badge]][ruff] [![mypy][mypy-badge]][mypy] [![License][license-badge]][license-url] |
12+
| __Meta__ | [![doi][doi-badge]][doi-url] [![OpenSSF Scorecard][scorecard-badge]][scorecard-url] [![uv][uv-badge]][uv] [![ruff][ruff-badge]][ruff] [![mypy][mypy-badge]][mypy] [![License][license-badge]][license-url] |
1313

1414
`python-re3data` is a Python library that simplifies interacting with the [re3data](https://www.re3data.org) (Registry
1515
of Research Data Repositories) [REST API](https://www.re3data.org/api/doc), allowing you to easily retrieve and process
@@ -113,8 +113,6 @@ There are a couple of similar projects available on GitHub, e.g. via the topic
113113
[docs-workflow]: https://github.com/afuetterer/python-re3data/actions/workflows/docs.yml
114114
[doi-badge]: https://zenodo.org/badge/DOI/10.5281/zenodo.11264510.svg
115115
[doi-url]: https://doi.org/10.5281/zenodo.11264510
116-
[hatch]: https://github.com/pypa/hatch
117-
[hatch-badge]: https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg
118116
[license-badge]: https://img.shields.io/badge/license-MIT-blue.svg
119117
[license-url]: https://spdx.org/licenses/MIT.html
120118
[monthly-downloads-badge]: https://static.pepy.tech/badge/python-re3data/month
@@ -131,3 +129,5 @@ There are a couple of similar projects available on GitHub, e.g. via the topic
131129
[scorecard-badge]: https://api.securityscorecards.dev/projects/github.com/afuetterer/python-re3data/badge
132130
[scorecard-url]: https://securityscorecards.dev/viewer/?uri=github.com/afuetterer/python-re3data
133131
[status-badge]: https://img.shields.io/pypi/status/python-re3data?logo=pypi
132+
[uv]: https://github.com/astral-sh/uv
133+
[uv-badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json

0 commit comments

Comments
 (0)