Skip to content

Commit b052b2a

Browse files
authored
Use uv (#1439)
* feat: use uv * chore: update changelog * fix: uv run pre-commit * fix: we can use uv run on scripts * fix: readthedocs install * fix: remove -y from uninstall orjson * fix: activate venv on windows * fix: try badslashes? * fix: uv run for benchmark check * fix: urgh windoze why * fix: more windoze thrashing * fix: docs package install * fix: try two diff steps * fix: uv run coverage * fix(ci): use double-backslashed for windoze * moar windows ci flailing * ci: try bash on windoze? * try badslashes? * just test it to make sure that works * windows, just do the stuff directly * ci: just pytest on windoze * skip windoze and python 3.13 * s/verison/version/ This is probably my most-frequent mispelling 🤦
1 parent f4cff03 commit b052b2a

13 files changed

+3282
-714
lines changed

.github/workflows/continuous-integration.yml

+55-72
Original file line numberDiff line numberDiff line change
@@ -22,134 +22,113 @@ 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-
35+
exclude:
36+
# https://github.com/stac-utils/pystac/issues/1470
37+
- os: windows-latest
38+
python-version: "3.13"
3739
steps:
3840
- uses: actions/checkout@v4
39-
40-
- name: Set up Python ${{ matrix.python-version }}
41-
uses: actions/setup-python@v5
41+
- uses: actions/setup-python@v5
4242
with:
4343
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
44+
- uses: astral-sh/setup-uv@v3
45+
with:
46+
enable-cache: true
47+
- name: Sync
48+
run: uv sync --all-extras
49+
- name: Test on windows
50+
if: runner.os == 'Windows'
5151
shell: bash
5252
env:
53-
TMPDIR: "${{ matrix.os == 'windows-latest' && 'D:\\a\\_temp' || '' }}"
53+
TMPDIR: 'D:\\a\\_temp'
54+
run: uv run pytest tests
55+
- name: Test
56+
if: runner.os != 'Windows'
57+
run: uv run scripts/test
5458

5559
coverage:
5660
name: coverage
5761
runs-on: ubuntu-latest
5862
steps:
5963
- uses: actions/checkout@v4
60-
61-
- name: Set up Python 3.10
62-
uses: actions/setup-python@v5
64+
- uses: actions/setup-python@v5
6365
with:
6466
python-version: "3.10"
65-
cache: "pip"
66-
67+
- uses: astral-sh/setup-uv@v3
68+
with:
69+
enable-cache: true
6770
- name: Install with dependencies
68-
run: pip install .[validation] -r requirements-dev.txt
69-
71+
run: uv sync --all-extras
7072
- name: Run coverage with orjson
71-
run: pytest tests --cov
72-
73+
run: uv run pytest tests --cov
7374
- name: Uninstall orjson
74-
run: pip uninstall -y orjson
75-
75+
run: uv pip uninstall orjson
7676
- name: Run coverage without orjson, appending results
77-
run: pytest tests --cov --cov-append
78-
77+
run: uv run pytest tests --cov --cov-append
7978
- name: Prepare ./coverage.xml
8079
# Ignore the configured fail-under to ensure we upload the coverage report. We
8180
# will trigger a failure for coverage drops in a later job
82-
run: coverage xml --fail-under 0
83-
81+
run: uv run coverage xml --fail-under 0
8482
- name: Upload All coverage to Codecov
8583
uses: codecov/codecov-action@v4
8684
if: ${{ env.GITHUB_REPOSITORY }} == 'stac-utils/pystac'
8785
with:
8886
token: ${{ secrets.CODECOV_TOKEN }}
8987
file: ./coverage.xml
9088
fail_ci_if_error: false
91-
9289
- name: Check for coverage drop
9390
# This will use the configured fail-under, causing this job to fail if the
9491
# coverage drops.
95-
run: coverage report
92+
run: uv run coverage report
9693

9794
lint:
9895
runs-on: ubuntu-latest
9996
strategy:
100-
# Allow other matrix jobs to complete if 1 fails
101-
fail-fast: false
10297
matrix:
10398
python-version:
10499
- "3.10"
105100
- "3.11"
106101
- "3.12"
107-
102+
- "3.13"
108103
steps:
109104
- uses: actions/checkout@v4
110-
111-
- name: Set up Python ${{ matrix.python-version }}
112-
uses: actions/setup-python@v5
105+
- uses: actions/setup-python@v5
113106
with:
114107
python-version: ${{ matrix.python-version }}
115-
cache: "pip"
116-
117-
- name: Install with test dependencies
118-
run: pip install . -r requirements-dev.txt
119-
108+
- uses: astral-sh/setup-uv@v3
109+
with:
110+
enable-cache: true
111+
- name: Sync
112+
run: uv sync
120113
- name: Execute linters & type checkers
121-
run: pre-commit run --all-files
114+
run: uv run pre-commit run --all-files
122115

123116
without-orjson:
124117
runs-on: ubuntu-latest
125118
steps:
126119
- uses: actions/checkout@v4
127-
128120
- uses: actions/setup-python@v5
129121
with:
130122
python-version: "3.10"
131-
132-
- name: Install
133-
run: pip install .[validation] -r requirements-dev.txt
134-
123+
- uses: astral-sh/setup-uv@v3
124+
with:
125+
enable-cache: true
126+
- name: Sync
127+
run: uv sync
135128
- name: Uninstall orjson
136-
run: pip uninstall -y orjson
137-
129+
run: uv pip uninstall orjson
138130
- 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]
131+
run: uv run pytest tests
153132

154133
check-benchmarks:
155134
# This checks to make sure any API changes haven't broken any of the
@@ -161,13 +140,15 @@ jobs:
161140
- uses: actions/setup-python@v5
162141
with:
163142
python-version: "3.10"
164-
cache: "pip"
165-
- name: Install pystac
166-
run: pip install . -r requirements-dev.txt
143+
- uses: astral-sh/setup-uv@v3
144+
with:
145+
enable-cache: true
146+
- name: Sync
147+
run: uv sync
167148
- name: Set asv machine
168-
run: asv machine --yes
149+
run: uv run asv machine --yes
169150
- name: Check benchmarks
170-
run: asv run -a repeat=1 -a rounds=1 HEAD
151+
run: uv run asv run -a repeat=1 -a rounds=1 HEAD
171152

172153
docs:
173154
runs-on: ubuntu-latest
@@ -176,10 +157,12 @@ jobs:
176157
- uses: actions/setup-python@v5
177158
with:
178159
python-version: "3.10"
179-
cache: "pip"
160+
- uses: astral-sh/setup-uv@v3
161+
with:
162+
enable-cache: true
180163
- name: Install pandoc
181164
run: sudo apt-get install pandoc
182165
- name: Install pystac
183-
run: pip install . -r docs/requirements-docs.txt
166+
run: uv sync --no-dev && uv sync --package pystac-docs --inexact
184167
- name: Check docs
185-
run: make -C docs html SPHINXOPTS="-W --keep-going"
168+
run: uv run make -C docs html SPHINXOPTS="-W --keep-going"

.pre-commit-config.yaml

+1-1
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:

.readthedocs.yaml

+9-6
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 --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

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Changed
66

77
- Write STAC v1.1.0 ([#1427](https://github.com/stac-utils/pystac/pull/1427))
8+
- Use [uv](https://github.com/astral-sh/uv) for development dependencies and docs ([#1439](https://github.com/stac-utils/pystac/pull/1439))
89

910
## [v1.11.0] - 2024-09-26
1011

README.md

+6-6
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

+3-2
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

+19
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

-12
This file was deleted.

0 commit comments

Comments
 (0)