Skip to content

Commit 03f5cc2

Browse files
committed
feat: use uv
1 parent ba406cb commit 03f5cc2

File tree

12 files changed

+3271
-712
lines changed

12 files changed

+3271
-712
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 42 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,28 @@ jobs:
2222
name: test
2323
runs-on: ${{ matrix.os }}
2424
strategy:
25-
# Allow other matrix jobs to complete if 1 fails
26-
fail-fast: false
2725
matrix:
2826
python-version:
2927
- "3.10"
3028
- "3.11"
3129
- "3.12"
30+
- "3.13"
3231
os:
3332
- ubuntu-latest
3433
- windows-latest
3534
- macos-latest
36-
3735
steps:
3836
- uses: actions/checkout@v4
39-
40-
- name: Set up Python ${{ matrix.python-version }}
41-
uses: actions/setup-python@v5
37+
- uses: actions/setup-python@v5
4238
with:
4339
python-version: ${{ matrix.python-version }}
44-
cache: "pip"
45-
46-
- name: Install dependencies
47-
run: pip install .[validation] -r requirements-dev.txt
48-
49-
- name: Execute test suite
50-
run: ./scripts/test
40+
- uses: astral-sh/setup-uv@v3
41+
with:
42+
enable-cache: true
43+
- name: Sync
44+
run: uv sync --all-extras
45+
- name: test
46+
run: source .venv/bin/activate && ./scripts/test
5147
shell: bash
5248
env:
5349
TMPDIR: "${{ matrix.os == 'windows-latest' && 'D:\\a\\_temp' || '' }}"
@@ -57,38 +53,31 @@ jobs:
5753
runs-on: ubuntu-latest
5854
steps:
5955
- uses: actions/checkout@v4
60-
61-
- name: Set up Python 3.10
62-
uses: actions/setup-python@v5
56+
- uses: actions/setup-python@v5
6357
with:
6458
python-version: "3.10"
65-
cache: "pip"
66-
59+
- uses: astral-sh/setup-uv@v3
60+
with:
61+
enable-cache: true
6762
- name: Install with dependencies
68-
run: pip install .[validation] -r requirements-dev.txt
69-
63+
run: uv sync --all-extras
7064
- name: Run coverage with orjson
71-
run: pytest tests --cov
72-
65+
run: uv run pytest tests --cov
7366
- name: Uninstall orjson
74-
run: pip uninstall -y orjson
75-
67+
run: uv pip uninstall -y orjson
7668
- name: Run coverage without orjson, appending results
77-
run: pytest tests --cov --cov-append
78-
69+
run: uv run pytest tests --cov --cov-append
7970
- name: Prepare ./coverage.xml
8071
# Ignore the configured fail-under to ensure we upload the coverage report. We
8172
# will trigger a failure for coverage drops in a later job
82-
run: coverage xml --fail-under 0
83-
73+
run: uv run coverage xml --fail-under 0
8474
- name: Upload All coverage to Codecov
8575
uses: codecov/codecov-action@v4
8676
if: ${{ env.GITHUB_REPOSITORY }} == 'stac-utils/pystac'
8777
with:
8878
token: ${{ secrets.CODECOV_TOKEN }}
8979
file: ./coverage.xml
9080
fail_ci_if_error: false
91-
9281
- name: Check for coverage drop
9382
# This will use the configured fail-under, causing this job to fail if the
9483
# coverage drops.
@@ -97,59 +86,41 @@ jobs:
9786
lint:
9887
runs-on: ubuntu-latest
9988
strategy:
100-
# Allow other matrix jobs to complete if 1 fails
101-
fail-fast: false
10289
matrix:
10390
python-version:
10491
- "3.10"
10592
- "3.11"
10693
- "3.12"
107-
94+
- "3.13"
10895
steps:
10996
- uses: actions/checkout@v4
110-
111-
- name: Set up Python ${{ matrix.python-version }}
112-
uses: actions/setup-python@v5
97+
- uses: actions/setup-python@v5
11398
with:
11499
python-version: ${{ matrix.python-version }}
115-
cache: "pip"
116-
117-
- name: Install with test dependencies
118-
run: pip install . -r requirements-dev.txt
119-
100+
- uses: astral-sh/setup-uv@v3
101+
with:
102+
enable-cache: true
103+
- name: Sync
104+
run: uv sync
120105
- name: Execute linters & type checkers
121-
run: pre-commit run --all-files
106+
run: uv pre-commit run --all-files
122107

123108
without-orjson:
124109
runs-on: ubuntu-latest
125110
steps:
126111
- uses: actions/checkout@v4
127-
128112
- uses: actions/setup-python@v5
129113
with:
130114
python-version: "3.10"
131-
132-
- name: Install
133-
run: pip install .[validation] -r requirements-dev.txt
134-
115+
- uses: astral-sh/setup-uv@v3
116+
with:
117+
enable-cache: true
118+
- name: Sync
119+
run: uv sync
135120
- name: Uninstall orjson
136-
run: pip uninstall -y orjson
137-
121+
run: uv pip uninstall -y orjson
138122
- name: Run tests
139-
run: pytest tests
140-
141-
check-all-dependencies:
142-
runs-on: ubuntu-latest
143-
steps:
144-
- uses: actions/checkout@v4
145-
146-
- uses: actions/setup-python@v5
147-
with:
148-
python-version: "3.10"
149-
cache: "pip"
150-
151-
- name: Install all dependencies
152-
run: pip install .[orjson,urllib3,validation,jinja2]
123+
run: uv run pytest tests
153124

154125
check-benchmarks:
155126
# This checks to make sure any API changes haven't broken any of the
@@ -161,9 +132,11 @@ jobs:
161132
- uses: actions/setup-python@v5
162133
with:
163134
python-version: "3.10"
164-
cache: "pip"
165-
- name: Install pystac
166-
run: pip install . -r requirements-dev.txt
135+
- uses: astral-sh/setup-uv@v3
136+
with:
137+
enable-cache: true
138+
- name: Sync
139+
run: uv sync
167140
- name: Set asv machine
168141
run: asv machine --yes
169142
- name: Check benchmarks
@@ -176,10 +149,12 @@ jobs:
176149
- uses: actions/setup-python@v5
177150
with:
178151
python-version: "3.10"
179-
cache: "pip"
152+
- uses: astral-sh/setup-uv@v3
153+
with:
154+
enable-cache: true
180155
- name: Install pandoc
181156
run: sudo apt-get install pandoc
182157
- name: Install pystac
183-
run: pip install . -r docs/requirements-docs.txt
158+
run: uv sync --no-dev && uv sync --package docs --inexact
184159
- name: Check docs
185160
run: make -C docs html SPHINXOPTS="-W --keep-going"

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
repos:
55
- repo: https://github.com/asottile/pyupgrade
6-
rev: v3.17.0
6+
rev: v3.18.0
77
hooks:
88
- id: pyupgrade
99
args:
@@ -22,15 +22,15 @@ repos:
2222
name: ruff-format
2323
entry: ruff format --force-exclude
2424
language: system
25-
stages: [commit]
25+
stages: [pre-commit]
2626
types_or: [python, pyi, jupyter]
2727
require_serial: true
2828

2929
- id: codespell
3030
name: codespell
3131
entry: codespell
3232
language: system
33-
stages: [commit]
33+
stages: [pre-commit]
3434
types_or: [jupyter, markdown, python, shell]
3535

3636
- id: doc8
@@ -45,6 +45,6 @@ repos:
4545
entry: mypy
4646
args: [--no-incremental]
4747
language: system
48-
stages: [commit]
48+
stages: [pre-commit]
4949
types: [python]
5050
require_serial: true

.readthedocs.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@ build:
88
os: ubuntu-22.04
99
tools:
1010
python: "3.10"
11+
commands:
12+
# https://docs.readthedocs.io/en/stable/build-customization.html#install-dependencies-with-uv
13+
# with adaptations to use workspaces+projects instead of `uv pip`
14+
- asdf plugin add uv
15+
- asdf install uv latest
16+
- asdf global uv latest
17+
- uv sync uv --all-extras --no-dev
18+
- uv sync --package pystac-docs --inexact # we need inexact to keep the top-level sync packages
19+
- uv run sphinx-build -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html
1120

1221
formats:
1322
# Temporarily disabling PDF downloads due to problem with nbsphinx in LateX builds
1423
# - pdf
1524
- htmlzip
1625

17-
python:
18-
install:
19-
- requirements: docs/requirements-docs.txt
20-
- method: pip
21-
path: .
22-
2326
sphinx:
2427
fail_on_warning: false

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,46 +15,46 @@ PySTAC is a library for working with the [SpatioTemporal Asset Catalog](https://
1515
### Install from PyPi (recommended)
1616

1717
```shell
18-
pip install pystac
18+
python -m pip install pystac
1919
```
2020

2121
If you would like to enable the validation feature utilizing the
2222
[jsonschema](https://pypi.org/project/jsonschema/) project, install with the optional
2323
`validation` requirements:
2424

2525
```shell
26-
pip install 'pystac[validation]'
26+
python -m pip install 'pystac[validation]'
2727
```
2828

2929
If you would like to use the [`orjson`](https://pypi.org/project/orjson/) instead of the
3030
standard `json` library for JSON serialization/deserialization, install with the
3131
optional `orjson` requirements:
3232

3333
```shell
34-
pip install 'pystac[orjson]'
34+
python -m pip install 'pystac[orjson]'
3535
```
3636

3737
If you would like to use a custom `RetryStacIO` class for automatically retrying
3838
network requests when reading with PySTAC, you'll need
3939
[`urllib3`](https://urllib3.readthedocs.io/en/stable/):
4040

4141
```shell
42-
pip install 'pystac[urllib3]'
42+
python -m pip install 'pystac[urllib3]'
4343
```
4444

4545
If you are using jupyter notebooks and want to enable pretty display of pystac
4646
objects you'll need [`jinja2`](https://pypi.org/project/Jinja2/)
4747

4848
```shell
49-
pip install 'pystac[jinja2]'
49+
python -m pip install 'pystac[jinja2]'
5050
```
5151

5252
### Install from source
5353

5454
```shell
5555
git clone https://github.com/stac-utils/pystac.git
5656
cd pystac
57-
pip install .
57+
python -m pip install .
5858
```
5959

6060
See the [installation page](https://pystac.readthedocs.io/en/latest/installation.html)

docs/contributing.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ way is to coordinate with the core developers via an issue or pull request conve
88
Development installation
99
^^^^^^^^^^^^^^^^^^^^^^^^
1010
Fork PySTAC into your GitHub account. Then, clone the repo and install it locally with
11-
pip as follows:
11+
`uv <https://docs.astral.sh/uv/getting-started/installation/>` as follows:
1212

1313
.. code-block:: bash
1414
1515
git clone [email protected]:your_user_name/pystac.git
1616
cd pystac
17-
pip install -e . -r requirements-dev.txt
17+
uv sync
18+
source .venv/bin/activate
1819
1920
Testing
2021
^^^^^^^

docs/pyproject.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[project]
2+
name = "pystac-docs"
3+
version = "0.0.0"
4+
description = "This package is only for uv, so it can share a lockfile with the top-level project. It should never be published"
5+
requires-python = ">=3.10"
6+
dependencies = [
7+
"boto3>=1.35.39",
8+
"ipython>=8.28.0",
9+
"jinja2>=3.1.4",
10+
"jupyter>=1.1.1",
11+
"nbsphinx>=0.9.5",
12+
"pydata-sphinx-theme>=0.15.4",
13+
"rasterio>=1.4.1",
14+
"shapely>=2.0.6",
15+
"sphinx>=8.1.1",
16+
"sphinx-autobuild>=2024.10.3",
17+
"sphinx-design>=0.6.1",
18+
"sphinxcontrib-fulltoc>=1.2.0",
19+
]

docs/requirements-docs.in

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

0 commit comments

Comments
 (0)