Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: modernize dev tooling #784

Merged
merged 14 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 32 additions & 73 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
pull_request:

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

Expand All @@ -16,7 +15,6 @@ jobs:
name: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
Expand All @@ -28,114 +26,75 @@ jobs:
- macos-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
- name: Download uv (non-Windows)
if: ${{ runner.os != 'Windows' }}
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Download uv (Windows)
if: ${{ runner.os == 'Windows' }}
run: irm https://astral.sh/uv/install.ps1 | iex
- name: Install package with dev requirements
run: uv pip install --system .[dev]
- name: Sync
run: uv sync
- name: Run pre-commit
run: pre-commit run --all-files
run: uv run pre-commit run --all-files
- name: Run pytest
run: pytest -Werror -s --block-network --cov pystac_client --cov-report term-missing
run: uv run pytest -Werror -s --block-network --cov pystac_client --cov-report term-missing
- name: Run coverage
run: coverage xml
- name: Upload All coverage to Codecov
uses: codecov/codecov-action@v5
run: uv run coverage xml
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
files: ./coverage.xml
fail_ci_if_error: false

min-versions:
name: min-versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
python-version: "3.10"
- name: Download uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install with min requirements
run: uv pip install --system --resolution=lowest-direct .
run: uv sync --no-dev --resolution=lowest-direct
- name: Run smoke test
run: stac-client search https://planetarycomputer.microsoft.com/api/stac/v1 -c sentinel-2-l2a --max-items 1

docs:
name: docs
runs-on: ubuntu-latest
# Required shell entrypoint to have properly activated conda environment
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Setup Conda Environment
uses: conda-incubator/[email protected]
with:
miniforge-version: latest
python-version: "3.10"
use-mamba: true
channel-priority: strict
environment-file: ./docs/environment.yml
activate-environment: pystac-client-docs
auto-activate-base: false
- name: Build docs
run: ./scripts/build-docs
run: stac-client search https://landsatlook.usgs.gov/stac-server -c landsat-c2l2-sr --max-items 1

pre-release:
name: pre-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Download uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install with dev requirements
run: uv pip install --system --pre .[dev]
- uses: astral-sh/setup-uv@v5
- name: Sync
run: uv sync
- name: Install any pre-releases of pystac
run: uv pip install --system -U --pre pystac
run: uv pip install -U --pre pystac
- name: Run pytest
run: pytest -Werror -s --block-network
run: uv run pytest -Werror -s --block-network

upstream:
name: upstream
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Download uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install
run: uv pip install --system .[dev]
- uses: astral-sh/setup-uv@v5
- name: Sync
run: uv sync
- name: Install pystac from main
run: uv pip install --system --force-reinstall git+https://github.com/stac-utils/pystac.git
run: uv pip install --force-reinstall git+https://github.com/stac-utils/pystac.git
- name: Run pytest
run: pytest -Werror -s --block-network
run: uv run pytest -Werror -s --block-network

dev-and-docs-requirements:
name: dev and docs requirements check
docs:
name: docs
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: "3.10"
- name: Download uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install geos
run: sudo apt -y install libgeos-dev
- name: Install
run: uv pip install --system .[dev,docs]
environment-file: docs/environment.yml
- name: Sync
run: uv sync --group docs
- name: Build docs
run: ./scripts/build-docs
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -619,5 +619,3 @@ $RECYCLE.BIN/

# Windows shortcuts
*.lnk

uv.lock
5 changes: 1 addition & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ repos:
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
- id: ruff-format
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
Expand Down
14 changes: 6 additions & 8 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

build:
os: ubuntu-22.04
tools:
python: "mambaforge-22.9"
jobs:
post_install:
- uv sync --group docs
build:
html:
- uv run -- sphinx-build -M html docs $READTHEDOCS_OUTPUT

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
# fail_on_warning: true

# Optionally build your docs in additional formats such as PDF
formats:
- pdf
- htmlzip
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Changed

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

### Fixed
Expand Down
8 changes: 5 additions & 3 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ way is to coordinate with the core developers via an issue or pull request conve

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

.. code-block:: bash

$ git clone [email protected]:your_user_name/pystac-client.git
$ cd pystac-client
$ pip install -e '.[dev]'
$ uv sync
$ source .venv/bin/activate

Testing
^^^^^^^
Expand Down
5 changes: 1 addition & 4 deletions docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ channels:
- conda-forge
- defaults
dependencies:
- cartopy
- geos
- pandoc
- python=3.10
- pip
- pip:
- -e ../[docs]
- uv
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pystac-client"
description = "Python library for working with SpatioTemporal Asset Catalog (STAC) APIs."
description = "Python library for searching SpatioTemporal Asset Catalog (STAC) APIs."
readme = "README.md"
authors = [
{ name = "Jon Duckworth", email = "[email protected]" },
Expand Down Expand Up @@ -35,9 +35,8 @@ dynamic = ["version"]
[project.scripts]
stac-client = "pystac_client.cli:cli"

[project.optional-dependencies]
[dependency-groups]
dev = [
"black~=25.1",
"codespell~=2.4.0",
"coverage~=7.2",
"doc8~=1.1.1",
Expand Down Expand Up @@ -68,7 +67,7 @@ docs = [
"hvplot~=0.11.0",
"ipykernel~=6.22",
"ipython~=8.12",
"jinja2<4.0",
"jinja2>=3.0,<4.0",
"matplotlib~=3.8",
"myst-parser~=4.0",
"nbsphinx~=0.9",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-docs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
if [ "${1:-}" = "--help" ]; then
usage
else
sphinx-build -M html docs docs/build
uv run -- sphinx-build -M html docs docs/build
fi
fi
Loading