Skip to content
Merged
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
69 changes: 33 additions & 36 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
branches: [main]
workflow_dispatch:

env:
LATEST_PY_VERSION: '3.14'

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -19,30 +22,27 @@ jobs:
- name: Check out repository code
uses: actions/checkout@v5

# Setup Python (faster than using Python container)
- name: Setup Python
uses: actions/setup-python@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python }}
cache: pip
cache-dependency-path: setup.py
version: "0.9.*"
enable-cache: true
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
uv sync

- name: Lint code
if: ${{ matrix.python == 3.11 }}
if: ${{ matrix.python-version == env.LATEST_PY_VERSION }}
run: |
python -m pip install pre-commit
pre-commit run --all-files
uv run pre-commit run --all-files

- name: install lib postgres
uses: nyurik/action-setup-postgis@v2

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[dev,server,validation]

- name: Run test suite
run: python -m pytest --cov stac_fastapi.pgstac --cov-report xml --cov-report term-missing
run: uv run pytest --cov stac_fastapi.pgstac --cov-report xml --cov-report term-missing

validate:
runs-on: ubuntu-latest
Expand All @@ -69,20 +69,20 @@ jobs:
- name: Check out repository code
uses: actions/checkout@v5

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

- name: Install stac-fastapi and stac-api-validator
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[server] stac-api-validator==0.6.5
uv sync
uv pip install stac-api-validator==0.6.5

- name: Load data and validate
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
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
env:
PGUSER: username
PGPASSWORD: password
Expand All @@ -96,19 +96,16 @@ jobs:
test-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Checkout main
uses: actions/checkout@v5

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

- name: Install with documentation dependencies
- name: Test docs
run: |
python -m pip install --upgrade pip
python -m pip install .[docs,dev,server]

- name: Build documentation
run: mkdocs build --strict
uv run --group docs mkdocs build -f docs/mkdocs.yml
30 changes: 30 additions & 0 deletions .github/workflows/deploy_mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish docs via GitHub Pages

on:
push:
branches:
- main
paths:
# Rebuild website when docs have changed or code has changed
- "README.md"
- "docs/**"
- "**.py"
workflow_dispatch:

jobs:
build:
name: Deploy docs
runs-on: ubuntu-latest

steps:
- name: Checkout main
uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.9.*"
enable-cache: true

- name: Deploy docs
run: uv run --group docs mkdocs gh-deploy --force -f docs/mkdocs.yml
46 changes: 0 additions & 46 deletions .github/workflows/pages.yml

This file was deleted.

17 changes: 8 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python 3.x
uses: actions/setup-python@v6

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.x"
- name: Install release dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
version: "0.9.*"
enable-cache: true

- name: Build and publish package
env:
TWINE_USERNAME: ${{ secrets.PYPI_STACUTILS_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_STACUTILS_PASSWORD }}
UV_PUBLISH_USERNAME: ${{ secrets.PYPI_STACUTILS_USERNAME }}
UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_STACUTILS_PASSWORD }}
run: |
scripts/publish
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@
### Changed

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

### Added

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

### removed

- aws lambda handler in `app.py`

## [6.0.2] - 2025-10-03

- add `CORS_ORIGIN_REGEX` settings ([#298](https://github.com/stac-utils/stac-fastapi-pgstac/pull/298))
Expand Down
41 changes: 24 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Contributing

Issues and pull requests are more than welcome.
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.

## Development install

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

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

```shell
pre-commit install
**dev install**

```bash
git clone https://github.com/stac-utils/stac-fastapi-pgstac.git
cd stac-fastapi
uv sync
```

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

## Docs
**pre-commit**

This repo is set to use `pre-commit` to run *isort*, *flake8*, *pydocstring*, *black* ("uncompromising Python code formatter") and mypy when committing new code.

```shell
pre-commit install
```

### Docs

```bash
git clone https://github.com/stac-utils/stac-fastapi-pgstac
git clone https://github.com/stac-utils/stac-fastapi-pgstac.git
cd stac-fastapi-pgstac
pip install -e .[docs]
# Build docs
uv run --group docs mkdocs build -f docs/mkdocs.yml
```

Hot-reloading docs:

```bash
mkdocs serve
uv run --group docs mkdocs serve -f docs/mkdocs.yml --livereload
```

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

```shell
# Create API documentations
make docs
```bash
# deploy
mkdocs gh-deploy
uv run --group docs mkdocs gh-deploy -f docs/mkdocs.yml
```
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PYTHON_VERSION=3.12
ARG PYTHON_VERSION=3.14

FROM python:${PYTHON_VERSION}-slim AS base

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

FROM base AS builder

RUN python -m pip install -U pip

WORKDIR /app

COPY . /app
COPY stac_fastapi/ stac_fastapi/
COPY pyproject.toml pyproject.toml
COPY README.md README.md

RUN python -m pip install -e .[server]
RUN python -m pip install .[server]
RUN rm -rf stac_fastapi .toml README.md

CMD ["uvicorn", "stac_fastapi.pgstac.app:app", "--host", "0.0.0.0", "--port", "8080"]
14 changes: 0 additions & 14 deletions Dockerfile.docs

This file was deleted.

6 changes: 3 additions & 3 deletions Dockerfile.tests
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ARG PYTHON_VERSION=3.12
ARG PYTHON_VERSION=3.13

FROM python:${PYTHON_VERSION}-slim as base

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

Expand All @@ -16,4 +16,4 @@ USER newuser
WORKDIR /app
COPY . /app

RUN python -m pip install -e .[dev,server] --user
RUN python -m pip install . --user --group dev
14 changes: 6 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,12 @@ run-joplin:

.PHONY: install
install:
pip install -e .[dev,server]
uv sync --dev

.PHONY: docs-image
docs-image:
docker compose -f docker-compose.docs.yml \
build
.PHONY: pytest
pytest: install
uv run pytest

.PHONY: docs
docs: docs-image
docker compose -f docker-compose.docs.yml \
run docs
docs:
uv run --group docs mkdocs build -f docs/mkdocs.yml
Loading
Loading