Skip to content

Commit 9163eb2

Browse files
authored
feat: modernize dev tooling (#784)
* feat: modernize dev tooling * feat: update docs * chore: update changelog * ci: remove 3.13, sync correctly * feat: ad uv.lock * fix: docs * ci: use conda for docs env * fix: conda better * docs: try splitting the readthedocs config * fix: readthedocs * fix: readthedocs output * fix: remove conda * fix: ci
1 parent 605e95c commit 9163eb2

10 files changed

+3214
-112
lines changed

.github/workflows/continuous-integration.yml

+33-74
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
pull_request:
88

99
concurrency:
10-
# Cancel running job if another commit is pushed to the branch
1110
group: ${{ github.ref }}
1211
cancel-in-progress: true
1312

@@ -16,7 +15,6 @@ jobs:
1615
name: build
1716
runs-on: ${{ matrix.os }}
1817
strategy:
19-
fail-fast: false
2018
matrix:
2119
python-version:
2220
- "3.10"
@@ -28,114 +26,75 @@ jobs:
2826
- macos-latest
2927
steps:
3028
- uses: actions/checkout@v4
31-
- name: Set up Python ${{ matrix.python-version }}
32-
uses: actions/setup-python@v5
29+
- uses: astral-sh/setup-uv@v5
3330
with:
3431
python-version: ${{ matrix.python-version }}
35-
- name: Download uv (non-Windows)
36-
if: ${{ runner.os != 'Windows' }}
37-
run: curl -LsSf https://astral.sh/uv/install.sh | sh
38-
- name: Download uv (Windows)
39-
if: ${{ runner.os == 'Windows' }}
40-
run: irm https://astral.sh/uv/install.ps1 | iex
41-
- name: Install package with dev requirements
42-
run: uv pip install --system .[dev]
32+
- name: Sync
33+
run: uv sync
4334
- name: Run pre-commit
44-
run: pre-commit run --all-files
35+
run: uv run pre-commit run --all-files
4536
- name: Run pytest
46-
run: pytest -Werror -s --block-network --cov pystac_client --cov-report term-missing
37+
run: uv run pytest -Werror -s --block-network --cov pystac_client --cov-report term-missing
4738
- name: Run coverage
48-
run: coverage xml
49-
- name: Upload All coverage to Codecov
50-
uses: codecov/codecov-action@v5
39+
run: uv run coverage xml
40+
- uses: codecov/codecov-action@v5
5141
with:
5242
token: ${{ secrets.CODECOV_TOKEN }}
53-
file: ./coverage.xml
43+
files: ./coverage.xml
5444
fail_ci_if_error: false
5545

5646
min-versions:
5747
name: min-versions
5848
runs-on: ubuntu-latest
5949
steps:
6050
- uses: actions/checkout@v4
61-
- uses: actions/setup-python@v5
51+
- uses: astral-sh/setup-uv@v5
6252
with:
6353
python-version: "3.10"
64-
- name: Download uv
65-
run: curl -LsSf https://astral.sh/uv/install.sh | sh
6654
- name: Install with min requirements
67-
run: uv pip install --system --resolution=lowest-direct .
55+
run: uv sync --no-dev --resolution=lowest-direct
6856
- name: Run smoke test
69-
run: stac-client search https://planetarycomputer.microsoft.com/api/stac/v1 -c sentinel-2-l2a --max-items 1
70-
71-
docs:
72-
name: docs
73-
runs-on: ubuntu-latest
74-
# Required shell entrypoint to have properly activated conda environment
75-
defaults:
76-
run:
77-
shell: bash -l {0}
78-
steps:
79-
- uses: actions/checkout@v4
80-
- name: Setup Conda Environment
81-
uses: conda-incubator/[email protected]
82-
with:
83-
miniforge-version: latest
84-
python-version: "3.10"
85-
use-mamba: true
86-
channel-priority: strict
87-
environment-file: ./docs/environment.yml
88-
activate-environment: pystac-client-docs
89-
auto-activate-base: false
90-
- name: Build docs
91-
run: ./scripts/build-docs
57+
run: stac-client search https://landsatlook.usgs.gov/stac-server -c landsat-c2l2-sr --max-items 1
9258

9359
pre-release:
9460
name: pre-release
9561
runs-on: ubuntu-latest
9662
steps:
9763
- uses: actions/checkout@v4
98-
- uses: actions/setup-python@v5
99-
with:
100-
python-version: "3.10"
101-
- name: Download uv
102-
run: curl -LsSf https://astral.sh/uv/install.sh | sh
103-
- name: Install with dev requirements
104-
run: uv pip install --system --pre .[dev]
64+
- uses: astral-sh/setup-uv@v5
65+
- name: Sync
66+
run: uv sync
10567
- name: Install any pre-releases of pystac
106-
run: uv pip install --system -U --pre pystac
68+
run: uv pip install -U --pre pystac
10769
- name: Run pytest
108-
run: pytest -Werror -s --block-network
70+
run: uv run pytest -Werror -s --block-network
10971

11072
upstream:
11173
name: upstream
11274
runs-on: ubuntu-latest
11375
if: github.event_name != 'pull_request'
11476
steps:
11577
- uses: actions/checkout@v4
116-
- uses: actions/setup-python@v5
117-
with:
118-
python-version: "3.10"
119-
- name: Download uv
120-
run: curl -LsSf https://astral.sh/uv/install.sh | sh
121-
- name: Install
122-
run: uv pip install --system .[dev]
78+
- uses: astral-sh/setup-uv@v5
79+
- name: Sync
80+
run: uv sync
12381
- name: Install pystac from main
124-
run: uv pip install --system --force-reinstall git+https://github.com/stac-utils/pystac.git
82+
run: uv pip install --force-reinstall git+https://github.com/stac-utils/pystac.git
12583
- name: Run pytest
126-
run: pytest -Werror -s --block-network
84+
run: uv run pytest -Werror -s --block-network
12785

128-
dev-and-docs-requirements:
129-
name: dev and docs requirements check
86+
docs:
87+
name: docs
13088
runs-on: ubuntu-latest
89+
defaults:
90+
run:
91+
shell: bash -el {0}
13192
steps:
13293
- uses: actions/checkout@v4
133-
- uses: actions/setup-python@v5
134-
with:
135-
python-version: "3.10"
136-
- name: Download uv
137-
run: curl -LsSf https://astral.sh/uv/install.sh | sh
138-
- name: Install geos
139-
run: sudo apt -y install libgeos-dev
140-
- name: Install
141-
run: uv pip install --system .[dev,docs]
94+
- uses: astral-sh/setup-uv@v5
95+
- name: Install pandoc
96+
run: sudo apt-get install -y pandoc
97+
- name: Sync
98+
run: uv sync --group docs
99+
- name: Build docs
100+
run: ./scripts/build-docs

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -619,5 +619,3 @@ $RECYCLE.BIN/
619619

620620
# Windows shortcuts
621621
*.lnk
622-
623-
uv.lock

.pre-commit-config.yaml

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ repos:
77
hooks:
88
- id: ruff
99
args: [--fix, --exit-non-zero-on-fix]
10-
- repo: https://github.com/psf/black
11-
rev: 24.10.0
12-
hooks:
13-
- id: black
10+
- id: ruff-format
1411
- repo: https://github.com/codespell-project/codespell
1512
rev: v2.3.0
1613
hooks:

.readthedocs.yml

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
# .readthedocs.yml
2-
# Read the Docs configuration file
3-
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4-
5-
# Required
61
version: 2
72

83
build:
94
os: ubuntu-22.04
105
tools:
11-
python: "mambaforge-22.9"
6+
python: "3.12"
7+
jobs:
8+
post_install:
9+
- asdf plugin add uv
10+
- asdf install uv latest
11+
- asdf global uv latest
12+
- uv sync --group docs
13+
build:
14+
html:
15+
- uv run -- sphinx-build -M html docs $READTHEDOCS_OUTPUT
16+
pdf:
17+
- uv run -- sphinx-build -M latexpdf docs $READTHEDOCS_OUTPUT
1218

13-
# Build documentation in the docs/ directory with Sphinx
1419
sphinx:
1520
configuration: docs/conf.py
16-
# fail_on_warning: true
1721

18-
# Optionally build your docs in additional formats such as PDF
1922
formats:
2023
- pdf
2124
- htmlzip
22-
23-
conda:
24-
environment: docs/environment.yml

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99

1010
### Changed
1111

12+
- Use [uv](https://docs.astral.sh/uv/) for development ([#784](https://github.com/stac-utils/pystac-client/pull/784))
1213
- Updated to Python 3.10 syntax with **pyupgrade** [#783](https://github.com/stac-utils/pystac-client/pull/783/)
1314

1415
### Fixed

docs/contributing.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ way is to coordinate with the core developers via an issue or pull request conve
77

88
Development installation
99
^^^^^^^^^^^^^^^^^^^^^^^^
10-
Fork PySTAC Client into your GitHub account. Clone the repo, install
11-
the library as an "editable link", then install the development dependencies:
10+
Fork PySTAC Client into your GitHub account. Clone the repo, install `uv
11+
<https://docs.astral.sh/uv/getting-started/installation/>`_ then sync and
12+
activate the created virtual environment:
1213

1314
.. code-block:: bash
1415
1516
$ git clone [email protected]:your_user_name/pystac-client.git
1617
$ cd pystac-client
17-
$ pip install -e '.[dev]'
18+
$ uv sync
19+
$ source .venv/bin/activate
1820
1921
Testing
2022
^^^^^^^

docs/environment.yml

-12
This file was deleted.

pyproject.toml

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "pystac-client"
3-
description = "Python library for working with SpatioTemporal Asset Catalog (STAC) APIs."
3+
description = "Python library for searching SpatioTemporal Asset Catalog (STAC) APIs."
44
readme = "README.md"
55
authors = [
66
{ name = "Jon Duckworth", email = "[email protected]" },
@@ -35,9 +35,8 @@ dynamic = ["version"]
3535
[project.scripts]
3636
stac-client = "pystac_client.cli:cli"
3737

38-
[project.optional-dependencies]
38+
[dependency-groups]
3939
dev = [
40-
"black~=25.1",
4140
"codespell~=2.4.0",
4241
"coverage~=7.2",
4342
"doc8~=1.1.1",
@@ -68,7 +67,7 @@ docs = [
6867
"hvplot~=0.11.0",
6968
"ipykernel~=6.22",
7069
"ipython~=8.12",
71-
"jinja2<4.0",
70+
"jinja2>=3.0,<4.0",
7271
"matplotlib~=3.8",
7372
"myst-parser~=4.0",
7473
"nbsphinx~=0.9",

scripts/build-docs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
1717
if [ "${1:-}" = "--help" ]; then
1818
usage
1919
else
20-
sphinx-build -M html docs docs/build
20+
uv run -- sphinx-build -M html docs docs/build
2121
fi
2222
fi

0 commit comments

Comments
 (0)