Skip to content

Commit 8fe690a

Browse files
switch to uv+pyproject.toml and move docs (#308)
* switch to uv+pyproject.toml and move docs * remove stac-api-validator from dev * remove 3.14 for now * use uv * use uv * update mirakuru dep * add python 3.14 in CI * update lock * Update CONTRIBUTING.md Co-authored-by: Henry Rodman <henry.rodman@gmail.com> * update to python3.14 --------- Co-authored-by: Henry Rodman <henry.rodman@gmail.com>
1 parent 0daf0bf commit 8fe690a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+5052
-293
lines changed

.github/workflows/cicd.yaml

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
branches: [main]
77
workflow_dispatch:
88

9+
env:
10+
LATEST_PY_VERSION: '3.14'
11+
912
jobs:
1013
test:
1114
runs-on: ubuntu-latest
@@ -19,30 +22,27 @@ jobs:
1922
- name: Check out repository code
2023
uses: actions/checkout@v5
2124

22-
# Setup Python (faster than using Python container)
23-
- name: Setup Python
24-
uses: actions/setup-python@v6
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@v7
2527
with:
26-
python-version: ${{ matrix.python }}
27-
cache: pip
28-
cache-dependency-path: setup.py
28+
version: "0.9.*"
29+
enable-cache: true
30+
python-version: ${{ matrix.python-version }}
31+
32+
- name: Install dependencies
33+
run: |
34+
uv sync
2935
3036
- name: Lint code
31-
if: ${{ matrix.python == 3.11 }}
37+
if: ${{ matrix.python-version == env.LATEST_PY_VERSION }}
3238
run: |
33-
python -m pip install pre-commit
34-
pre-commit run --all-files
39+
uv run pre-commit run --all-files
3540
3641
- name: install lib postgres
3742
uses: nyurik/action-setup-postgis@v2
3843

39-
- name: Install dependencies
40-
run: |
41-
python -m pip install --upgrade pip
42-
python -m pip install .[dev,server,validation]
43-
4444
- name: Run test suite
45-
run: python -m pytest --cov stac_fastapi.pgstac --cov-report xml --cov-report term-missing
45+
run: uv run pytest --cov stac_fastapi.pgstac --cov-report xml --cov-report term-missing
4646

4747
validate:
4848
runs-on: ubuntu-latest
@@ -69,20 +69,20 @@ jobs:
6969
- name: Check out repository code
7070
uses: actions/checkout@v5
7171

72-
- name: Setup Python
73-
uses: actions/setup-python@v6
72+
- name: Install uv
73+
uses: astral-sh/setup-uv@v7
7474
with:
75-
python-version: "3.11"
76-
cache: pip
77-
cache-dependency-path: setup.py
75+
version: "0.9.*"
76+
enable-cache: true
77+
python-version: ${{ env.LATEST_PY_VERSION }}
7878

79-
- name: Install stac-fastapi and stac-api-validator
79+
- name: Install dependencies
8080
run: |
81-
python -m pip install --upgrade pip
82-
python -m pip install .[server] stac-api-validator==0.6.5
81+
uv sync
82+
uv pip install stac-api-validator==0.6.5
8383
8484
- name: Load data and validate
85-
run: python -m stac_fastapi.pgstac.app & ./scripts/wait-for-it.sh localhost:8080 && python ./scripts/ingest_joplin.py http://localhost:8080 && ./scripts/validate http://localhost:8080
85+
run: uv run python -m stac_fastapi.pgstac.app & ./scripts/wait-for-it.sh localhost:8080 && uv run ./scripts/ingest_joplin.py http://localhost:8080 && uv run ./scripts/validate http://localhost:8080
8686
env:
8787
PGUSER: username
8888
PGPASSWORD: password
@@ -96,19 +96,16 @@ jobs:
9696
test-docs:
9797
runs-on: ubuntu-latest
9898
steps:
99-
- uses: actions/checkout@v5
99+
- name: Checkout main
100+
uses: actions/checkout@v5
100101

101-
- name: Setup Python
102-
uses: actions/setup-python@v6
102+
- name: Install uv
103+
uses: astral-sh/setup-uv@v7
103104
with:
104-
python-version: "3.11"
105-
cache: pip
106-
cache-dependency-path: setup.py
105+
version: "0.9.*"
106+
enable-cache: true
107+
python-version: ${{ env.LATEST_PY_VERSION }}
107108

108-
- name: Install with documentation dependencies
109+
- name: Test docs
109110
run: |
110-
python -m pip install --upgrade pip
111-
python -m pip install .[docs,dev,server]
112-
113-
- name: Build documentation
114-
run: mkdocs build --strict
111+
uv run --group docs mkdocs build -f docs/mkdocs.yml
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish docs via GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
# Rebuild website when docs have changed or code has changed
9+
- "README.md"
10+
- "docs/**"
11+
- "**.py"
12+
workflow_dispatch:
13+
14+
jobs:
15+
build:
16+
name: Deploy docs
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout main
21+
uses: actions/checkout@v5
22+
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v7
25+
with:
26+
version: "0.9.*"
27+
enable-cache: true
28+
29+
- name: Deploy docs
30+
run: uv run --group docs mkdocs gh-deploy --force -f docs/mkdocs.yml

.github/workflows/pages.yml

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

.github/workflows/publish.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v5
14-
- name: Set up Python 3.x
15-
uses: actions/setup-python@v6
14+
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v7
1617
with:
17-
python-version: "3.x"
18-
- name: Install release dependencies
19-
run: |
20-
python -m pip install --upgrade pip
21-
pip install setuptools wheel twine
18+
version: "0.9.*"
19+
enable-cache: true
20+
2221
- name: Build and publish package
2322
env:
24-
TWINE_USERNAME: ${{ secrets.PYPI_STACUTILS_USERNAME }}
25-
TWINE_PASSWORD: ${{ secrets.PYPI_STACUTILS_PASSWORD }}
23+
UV_PUBLISH_USERNAME: ${{ secrets.PYPI_STACUTILS_USERNAME }}
24+
UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_STACUTILS_PASSWORD }}
2625
run: |
2726
scripts/publish

CHANGES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,20 @@
55
### Changed
66

77
- update `pypgstac` version requirement to `>=0.9,<0.10`
8+
- switch to pyproject.toml for package metadata
9+
- use `uv` for project managment
10+
- add python 3.14 support
811

912
### Added
1013

1114
- lower bounds for `hydraters` requirements
1215
- `EXCLUDE_HYDRATE_MARKERS=TRUE/FALSE` (defaults to `TRUE`) to exclude `𒍟※` markers returned by PgSTAC
1316
- python `3.13` and `3.14` support
1417

18+
### removed
19+
20+
- aws lambda handler in `app.py`
21+
1522
## [6.0.2] - 2025-10-03
1623

1724
- add `CORS_ORIGIN_REGEX` settings ([#298](https://github.com/stac-utils/stac-fastapi-pgstac/pull/298))

CONTRIBUTING.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# Contributing
22

3-
Issues and pull requests are more than welcome.
3+
Use Github [Pull Requests](https://github.com/stac-utils/stac-fastapi-pgstac/pulls) to provide new features or to request review of draft code, and use [Issues](https://github.com/stac-utils/stac-fastapi-pgstac/issues) to report bugs or request new features.
44

55
## Development install
66

7-
```shell
8-
git clone https://github.com/stac-utils/stac-fastapi-pgstac
9-
cd stac-fastapi-pgstac
10-
make install
11-
```
7+
We recommand using [`uv`](https://docs.astral.sh/uv) as project manager for development.
128

13-
This repo is set to use `pre-commit` to run *isort*, *flake8*, *pydocstring*, *black* ("uncompromising Python code formatter") and mypy when committing new code.
9+
See https://docs.astral.sh/uv/getting-started/installation/ for installation
1410

15-
```shell
16-
pre-commit install
11+
**dev install**
12+
13+
```bash
14+
git clone https://github.com/stac-utils/stac-fastapi-pgstac.git
15+
cd stac-fastapi
16+
uv sync
1717
```
1818

1919
To run the service on 0.0.0.0:8082 and ingest example data into the database (the "joplin" collection):
@@ -30,26 +30,33 @@ To run the tests:
3030
make test
3131
```
3232

33-
## Docs
33+
**pre-commit**
34+
35+
This repo is set to use `pre-commit` to run *isort*, *flake8*, *pydocstring*, *black* ("uncompromising Python code formatter") and mypy when committing new code.
36+
37+
```shell
38+
pre-commit install
39+
```
40+
41+
### Docs
3442

3543
```bash
36-
git clone https://github.com/stac-utils/stac-fastapi-pgstac
44+
git clone https://github.com/stac-utils/stac-fastapi-pgstac.git
3745
cd stac-fastapi-pgstac
38-
pip install -e .[docs]
46+
# Build docs
47+
uv run --group docs mkdocs build -f docs/mkdocs.yml
3948
```
4049

4150
Hot-reloading docs:
4251

4352
```bash
44-
mkdocs serve
53+
uv run --group docs mkdocs serve -f docs/mkdocs.yml --livereload
4554
```
4655

4756
To manually deploy docs (note you should never need to do this because GitHub
4857
Actions deploys automatically for new commits.):
4958

50-
```shell
51-
# Create API documentations
52-
make docs
59+
```bash
5360
# deploy
54-
mkdocs gh-deploy
61+
uv run --group docs mkdocs gh-deploy -f docs/mkdocs.yml
5562
```

Dockerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PYTHON_VERSION=3.12
1+
ARG PYTHON_VERSION=3.14
22

33
FROM python:${PYTHON_VERSION}-slim AS base
44

@@ -14,10 +14,15 @@ ENV CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
1414

1515
FROM base AS builder
1616

17+
RUN python -m pip install -U pip
18+
1719
WORKDIR /app
1820

19-
COPY . /app
21+
COPY stac_fastapi/ stac_fastapi/
22+
COPY pyproject.toml pyproject.toml
23+
COPY README.md README.md
2024

21-
RUN python -m pip install -e .[server]
25+
RUN python -m pip install .[server]
26+
RUN rm -rf stac_fastapi .toml README.md
2227

2328
CMD ["uvicorn", "stac_fastapi.pgstac.app:app", "--host", "0.0.0.0", "--port", "8080"]

Dockerfile.docs

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

Dockerfile.tests

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
ARG PYTHON_VERSION=3.12
1+
ARG PYTHON_VERSION=3.13
22

33
FROM python:${PYTHON_VERSION}-slim as base
44

55
# Any python libraries that require system libraries to be installed will likely
66
# need the following packages in order to build
77
RUN apt-get update && \
88
apt-get -y upgrade && \
9-
apt-get install -y build-essential git libpq-dev postgresql-15-postgis-3 && \
9+
apt-get install -y build-essential git libpq-dev postgresql-17-postgis-3 && \
1010
apt-get clean && \
1111
rm -rf /var/lib/apt/lists/*
1212

@@ -16,4 +16,4 @@ USER newuser
1616
WORKDIR /app
1717
COPY . /app
1818

19-
RUN python -m pip install -e .[dev,server] --user
19+
RUN python -m pip install . --user --group dev

Makefile

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,12 @@ run-joplin:
4242

4343
.PHONY: install
4444
install:
45-
pip install -e .[dev,server]
45+
uv sync --dev
4646

47-
.PHONY: docs-image
48-
docs-image:
49-
docker compose -f docker-compose.docs.yml \
50-
build
47+
.PHONY: pytest
48+
pytest: install
49+
uv run pytest
5150

5251
.PHONY: docs
53-
docs: docs-image
54-
docker compose -f docker-compose.docs.yml \
55-
run docs
52+
docs:
53+
uv run --group docs mkdocs build -f docs/mkdocs.yml

0 commit comments

Comments
 (0)