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

Use uv #1439

Merged
merged 24 commits into from
Oct 29, 2024
Merged

Use uv #1439

Show file tree
Hide file tree
Changes from all 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
127 changes: 55 additions & 72 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,134 +22,113 @@ jobs:
name: test
runs-on: ${{ matrix.os }}
strategy:
# Allow other matrix jobs to complete if 1 fails
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
os:
- ubuntu-latest
- windows-latest
- macos-latest

exclude:
# https://github.com/stac-utils/pystac/issues/1470
- os: windows-latest
python-version: "3.13"
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Install dependencies
run: pip install .[validation] -r requirements-dev.txt

- name: Execute test suite
run: ./scripts/test
- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Sync
run: uv sync --all-extras
- name: Test on windows
if: runner.os == 'Windows'
shell: bash
env:
TMPDIR: "${{ matrix.os == 'windows-latest' && 'D:\\a\\_temp' || '' }}"
TMPDIR: 'D:\\a\\_temp'
run: uv run pytest tests
- name: Test
if: runner.os != 'Windows'
run: uv run scripts/test

coverage:
name: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v5
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"

- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Install with dependencies
run: pip install .[validation] -r requirements-dev.txt

run: uv sync --all-extras
- name: Run coverage with orjson
run: pytest tests --cov

run: uv run pytest tests --cov
- name: Uninstall orjson
run: pip uninstall -y orjson

run: uv pip uninstall orjson
- name: Run coverage without orjson, appending results
run: pytest tests --cov --cov-append

run: uv run pytest tests --cov --cov-append
- name: Prepare ./coverage.xml
# Ignore the configured fail-under to ensure we upload the coverage report. We
# will trigger a failure for coverage drops in a later job
run: coverage xml --fail-under 0

run: uv run coverage xml --fail-under 0
- name: Upload All coverage to Codecov
uses: codecov/codecov-action@v4
if: ${{ env.GITHUB_REPOSITORY }} == 'stac-utils/pystac'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: false

- name: Check for coverage drop
# This will use the configured fail-under, causing this job to fail if the
# coverage drops.
run: coverage report
run: uv run coverage report

lint:
runs-on: ubuntu-latest
strategy:
# Allow other matrix jobs to complete if 1 fails
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"

- "3.13"
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Install with test dependencies
run: pip install . -r requirements-dev.txt

- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Sync
run: uv sync
- name: Execute linters & type checkers
run: pre-commit run --all-files
run: uv run pre-commit run --all-files

without-orjson:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install
run: pip install .[validation] -r requirements-dev.txt

- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Sync
run: uv sync
- name: Uninstall orjson
run: pip uninstall -y orjson

run: uv pip uninstall orjson
- name: Run tests
run: pytest tests

check-all-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"

- name: Install all dependencies
run: pip install .[orjson,urllib3,validation,jinja2]
run: uv run pytest tests

check-benchmarks:
# This checks to make sure any API changes haven't broken any of the
Expand All @@ -161,13 +140,15 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install pystac
run: pip install . -r requirements-dev.txt
- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Sync
run: uv sync
- name: Set asv machine
run: asv machine --yes
run: uv run asv machine --yes
- name: Check benchmarks
run: asv run -a repeat=1 -a rounds=1 HEAD
run: uv run asv run -a repeat=1 -a rounds=1 HEAD

docs:
runs-on: ubuntu-latest
Expand All @@ -176,10 +157,12 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Install pandoc
run: sudo apt-get install pandoc
- name: Install pystac
run: pip install . -r docs/requirements-docs.txt
run: uv sync --no-dev && uv sync --package pystac-docs --inexact
- name: Check docs
run: make -C docs html SPHINXOPTS="-W --keep-going"
run: uv run make -C docs html SPHINXOPTS="-W --keep-going"
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
rev: v3.18.0
hooks:
- id: pyupgrade
args:
Expand Down
15 changes: 9 additions & 6 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@ build:
os: ubuntu-22.04
tools:
python: "3.10"
commands:
# https://docs.readthedocs.io/en/stable/build-customization.html#install-dependencies-with-uv
# with adaptations to use workspaces+projects instead of `uv pip`
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
- uv sync --all-extras --no-dev
- uv sync --package pystac-docs --inexact # we need inexact to keep the top-level sync packages
- uv run sphinx-build -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html

formats:
# Temporarily disabling PDF downloads due to problem with nbsphinx in LateX builds
# - pdf
- htmlzip

python:
install:
- requirements: docs/requirements-docs.txt
- method: pip
path: .

sphinx:
fail_on_warning: false
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Changed

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

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

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,46 @@ PySTAC is a library for working with the [SpatioTemporal Asset Catalog](https://
### Install from PyPi (recommended)

```shell
pip install pystac
python -m pip install pystac
```

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

```shell
pip install 'pystac[validation]'
python -m pip install 'pystac[validation]'
```

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

```shell
pip install 'pystac[orjson]'
python -m pip install 'pystac[orjson]'
```

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

```shell
pip install 'pystac[urllib3]'
python -m pip install 'pystac[urllib3]'
```

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

```shell
pip install 'pystac[jinja2]'
python -m pip install 'pystac[jinja2]'
```

### Install from source

```shell
git clone https://github.com/stac-utils/pystac.git
cd pystac
pip install .
python -m pip install .
```

See the [installation page](https://pystac.readthedocs.io/en/latest/installation.html)
Expand Down
5 changes: 3 additions & 2 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ way is to coordinate with the core developers via an issue or pull request conve
Development installation
^^^^^^^^^^^^^^^^^^^^^^^^
Fork PySTAC into your GitHub account. Then, clone the repo and install it locally with
pip as follows:
`uv <https://docs.astral.sh/uv/getting-started/installation/>` as follows:

.. code-block:: bash

git clone git@github.com:your_user_name/pystac.git
cd pystac
pip install -e . -r requirements-dev.txt
uv sync
source .venv/bin/activate

Testing
^^^^^^^
Expand Down
19 changes: 19 additions & 0 deletions docs/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[project]
name = "pystac-docs"
version = "0.0.0"
description = "This package is only for uv, so it can share a lockfile with the top-level project. It should never be published"
requires-python = ">=3.10"
dependencies = [
"boto3>=1.35.39",
"ipython>=8.28.0",
"jinja2>=3.1.4",
"jupyter>=1.1.1",
"nbsphinx>=0.9.5",
"pydata-sphinx-theme>=0.15.4",
"rasterio>=1.4.1",
"shapely>=2.0.6",
"sphinx>=8.1.1",
"sphinx-autobuild>=2024.10.3",
"sphinx-design>=0.6.1",
"sphinxcontrib-fulltoc>=1.2.0",
]
12 changes: 0 additions & 12 deletions docs/requirements-docs.in

This file was deleted.

Loading