Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
9b5ce6c
Fallback to string for UUID columns
giorgiobasile Dec 12, 2024
acbf1ad
Add unit test for UUID columns
giorgiobasile Dec 12, 2024
e68eb27
Update CHANGES.md
giorgiobasile Dec 18, 2024
5b1b75f
Merge branch 'main' of https://github.com/developmentseed/tipg into HEAD
vincentsarago Jan 17, 2025
14373c4
Merge pull request #199 from giorgiobasile/features_serialization_def…
vincentsarago Jan 17, 2025
ce6fdc8
remove python 3.8 and unify docker images
vincentsarago Jan 17, 2025
d9ab851
Merge pull request #203 from developmentseed/feature/docker-and-pytho…
vincentsarago Jan 17, 2025
decb9a0
update changelog
vincentsarago Jan 17, 2025
1fc8daa
Bump version: 0.8.0 → 0.9.0
vincentsarago Jan 17, 2025
25672e1
Fix CRS Transformation: use target CRS envelope and transform tile bo…
callsumzg Feb 11, 2025
f784525
Moved import outside if statement top the top of the file as requested.
callsumzg Feb 12, 2025
855b93f
Refactored coordinate transformation to use transform_bounds:
callsumzg Feb 12, 2025
176ac31
add transformer cache
vincentsarago Feb 20, 2025
9383c2c
update changelog
vincentsarago Feb 20, 2025
d0bb3fb
Merge pull request #205 from callsumzg/fix/spatial-envelopes
vincentsarago Feb 20, 2025
0d9c747
update doc gen
vincentsarago Feb 20, 2025
6832efa
Bump version: 0.9.0 → 0.10.0
vincentsarago Feb 20, 2025
a21862d
add Collection Abstract BaseClass
vincentsarago Feb 21, 2025
8c1e1e3
Merge pull request #206 from developmentseed/feature/collection-base-…
vincentsarago Feb 23, 2025
1d7e4fb
update get_collections_index and features/get_tile methods
vincentsarago Feb 24, 2025
63123ed
fix and docs
vincentsarago Feb 24, 2025
5d48cd7
Merge pull request #208 from developmentseed/refactor/collections-and…
vincentsarago Feb 24, 2025
2d0d0bd
infer OGC Tiles links /collections and /collections/{collectionId} re…
vincentsarago Feb 25, 2025
cfd42c3
use collection model
vincentsarago Feb 25, 2025
25c82e6
fix
vincentsarago Feb 25, 2025
2053459
Merge pull request #209 from developmentseed/feature/infer-ogc-tiles-…
vincentsarago Feb 25, 2025
72b9f64
add the ability to use a schema other than pg_temp for installing cat…
vincentsarago Mar 3, 2025
b15f0ba
Merge pull request #210 from developmentseed/feature/custom-applicati…
vincentsarago Mar 4, 2025
0b7b8b0
fix URL in html templates
vincentsarago Mar 4, 2025
11661a8
remove deprecated endpoints and add /tiles prefix for tilejson and st…
vincentsarago Mar 4, 2025
27dd522
Merge pull request #211 from developmentseed/feature/remove-deprecate…
vincentsarago Mar 4, 2025
3dd41b3
update changelog
vincentsarago Mar 4, 2025
214ff78
update from 0.10.1
vincentsarago Mar 4, 2025
ac4cf24
update changelog
vincentsarago Mar 7, 2025
88f8685
Bump version: 0.10.0 → 1.0.0
vincentsarago Mar 7, 2025
1e1f4bb
fix typo
vincentsarago Mar 17, 2025
ec27469
Merge pull request #216 from developmentseed/patch/fix-typo-issue215
vincentsarago Mar 17, 2025
1a2e5eb
Bump version: 1.0.0 → 1.0.1
vincentsarago Mar 17, 2025
91208c2
Merge remote-tracking branch 'upstream/main' into upstream-sync
Mar 18, 2025
4969fad
update file formats
Mar 18, 2025
a72e0ac
remove duplicage con_init line
Mar 18, 2025
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
53 changes: 17 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ on:
- '.github/workflows/ci.yml'
pull_request:
env:
LATEST_PY_VERSION: '3.12'
LATEST_PY_VERSION: '3.13'

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -134,12 +134,6 @@ jobs:
needs: [tests]
if: github.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
runs-on: ubuntu-latest
strategy:
matrix:
image-version:
- 'uvicorn'
- 'gunicorn'

steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -156,47 +150,34 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set tag version
id: tag
run: |
echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT

- name: Downcase REPO
id: downcase
run: |
repo_name=${{ github.repository }}
echo "repo=${repo_name,,}" >> $GITHUB_OUTPUT

- name: Image name
id: image
run: |
if [ ${{ matrix.image-version }} = 'uvicorn' ]; then
echo "name=${{ steps.downcase.outputs.repo }}:uvicorn-" >> $GITHUB_OUTPUT
else
echo "name=${{ steps.downcase.outputs.repo }}:" >> $GITHUB_OUTPUT
fi

# Push `latest` when commiting to main
- name: Build and push
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v6
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
platforms: linux/amd64,linux/arm64
context: .
file: dockerfiles/Dockerfile.${{ matrix.image-version }}
push: true
images: |
ghcr.io/${{ steps.downcase.outputs.repo }}
flavor: |
latest=false
tags: |
ghcr.io/${{ steps.image.outputs.name }}latest
type=semver,pattern={{version}}
type=raw,value=latest,enable={{is_default_branch}}

# Push `{VERSION}` when pushing a new tag
- name: Build and push
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
context: .
file: dockerfiles/Dockerfile.${{ matrix.image-version }}
push: true
tags: |
ghcr.io/${{ steps.image.outputs.name }}${{ steps.tag.outputs.version }}
file: dockerfiles/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
26 changes: 2 additions & 24 deletions .github/workflows/deploy_mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,15 @@ jobs:
- name: Checkout master
uses: actions/checkout@v4

- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .["docs"]

- name: Create API docs
env:
# we need to set a fake PG url or import will fail
DATABASE_URL: postgresql://username:password@0.0.0.0:5439/postgis
run: |
pdocs as_markdown \
--output_dir docs/src/api \
--exclude_source \
--overwrite \
tipg.filter.evaluate \
tipg.filter.filters \
tipg.resources.enums \
tipg.resources.response \
tipg.collections \
tipg.database \
tipg.dependencies \
tipg.errors \
tipg.factory \
tipg.middleware \
tipg.model \
tipg.settings

- name: Deploy docs
run: mkdocs gh-deploy --force -f docs/mkdocs.yml
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
language_version: python

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
rev: v0.8.4
hooks:
- id: ruff
args: ["--fix"]
Expand Down
76 changes: 75 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,75 @@ Note: Minor version `0.X.0` update might break the API, It's recommended to pin

## [unreleased]

## [1.0.1] - 2025-03-17

* fix typo when using catalog_ttl

## [1.0.0] - 2025-03-07

### Added

* add `tilesets` and `viewer` links in `/collections` and `/collections/{collectionId}` response links
* add the ability to use a schema other than pg_temp for installing catalog functions (using `TIPG_DB_APPLICATION_SCHEMA` environment variable)
* re-use pg *connection* for `features_count` and `features`
* add `tipg.collections.Collection` abstract base class

### Changed

* rename `tipg.collections.Collection -> tipg.collections.PgCollection` **breaking change**
* update `Collection.get_tile()` and `Collection.features()` signature to expect `request: Request` as first parameter **breaking change**
* rename `tipg.collections.get_collection_index` to `tipg.collections.pg_get_collection_index` and change the function to use `DatabaseSettings` instance directly instead of keyword option **breaking change**
* update `tipg.collections.pg_get_collection_index` to return a list of PgCollection instead of a Catalog **breaking change**
* update `tipg.collections.register_collection_catalog` to pass `db_settings` to `pg_get_collection_index` function **breaking change**
* remove **deprecated** tiles endpoint with default TileMatrixSet
* rename tilejson endpoint from `/collections/{collectionId}/{tileMatrixSetId}/tilejson.json` to `/collections/{collectionId}/tiles/{tileMatrixSetId}/tilejson.json` **breaking change**
* rename stylejson endpoint from `/collections/{collectionId}/{tileMatrixSetId}/style.json` to `/collections/{collectionId}/tiles/{tileMatrixSetId}/style.json` **breaking change**
* change `database.connect_to_db` input order **breaking change**

```python
# Before
async def connect_to_db(
app: FastAPI,
settings: Optional[PostgresSettings] = None,
schemas: Optional[List[str]] = None,
user_sql_files: Optional[List[pathlib.Path]] = None,
**kwargs,
) -> None:

# Now
async def connect_to_db(
app: FastAPI,
*,
schemas: List[str],
tipg_schema: str = "pg_temp",
user_sql_files: Optional[List[pathlib.Path]] = None,
settings: Optional[PostgresSettings] = None,
**kwargs,
) -> None:
```

### Fixed

* fix URL in HTML templates when behind proxy

## [0.10.1] - 2025-03-04

* remove `PostgresSettings` initialization from main.py

## [0.10.0] - 2025-02-20

* convert tile bbox into collection's CRS for `MVT` where selection (author @callsumzg, https://github.com/developmentseed/tipg/pull/205)

## [0.9.0] - 2025-01-17

* fix serialization of UUID columns (author @giorgiobasile, https://github.com/developmentseed/tipg/pull/199)

* Unify Docker images (deprecate `tipg-uvicorn`)

* Remove `python3.8` support

* Add `python3.13` support

## [0.8.0] - 2024-10-17

* update `starlette-cramjam` dependency and set compression-level default to 6
Expand Down Expand Up @@ -321,7 +390,12 @@ Note: Minor version `0.X.0` update might break the API, It's recommended to pin

- Initial release

[unreleased]: https://github.com/developmentseed/tipg/compare/0.8.0...HEAD
[unreleased]: https://github.com/developmentseed/tipg/compare/1.0.1...HEAD
[1.0.1]: https://github.com/developmentseed/tipg/compare/1.0.0...1.0.1
[1.0.0]: https://github.com/developmentseed/tipg/compare/0.10.0...1.0.0
[0.10.1]: https://github.com/developmentseed/tipg/compare/0.10.0...0.10.1
[0.10.0]: https://github.com/developmentseed/tipg/compare/0.9.0...0.10.0
[0.9.0]: https://github.com/developmentseed/tipg/compare/0.8.0...0.9.0
[0.8.0]: https://github.com/developmentseed/tipg/compare/0.7.3...0.8.0
[0.7.3]: https://github.com/developmentseed/tipg/compare/0.7.2...0.7.3
[0.7.2]: https://github.com/developmentseed/tipg/compare/0.7.1...0.7.2
Expand Down
29 changes: 13 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ More info about configuration options at https://developmentseed.org/tipg/user_g
## Launch

```bash
$ pip install uvicorn
$ python -m pip install uvicorn

# Set your PostGIS database instance URL in the environment
$ export DATABASE_URL=postgresql://username:password@0.0.0.0:5432/postgis
Expand Down Expand Up @@ -116,32 +116,29 @@ $ docker-compose up app

We are publishing two different docker images on `tag` and on every commit to `main` branch:

| | Gunicorn | Uvicorn |
| -- | -- | -- |
main commit | `ghcr.io/developmentseed/tipg:latest` | `ghcr.io/developmentseed/tipg:uvicorn-latest`
tags | `ghcr.io/developmentseed/tipg:0.0.0` | `ghcr.io/developmentseed/tipg:uvicorn-0.0.0`
dockerfile | [/dockerfiles/Dockerfile.gunicorn](https://github.com/developmentseed/tipg/blob/main/dockerfiles/Dockerfile.gunicorn) | [/dockerfiles/Dockerfile.uvicorn](https://github.com/developmentseed/tipg/blob/main/dockerfiles/Dockerfile.uvicorn)
| | Gunicorn |
| -- | -- |
main commit | `ghcr.io/developmentseed/tipg:latest`
tags | `ghcr.io/developmentseed/tipg:X.X.X`
dockerfile | [/dockerfiles/Dockerfile](https://github.com/developmentseed/tipg/blob/main/dockerfiles/Dockerfile)

See all version at https://github.com/developmentseed/tipg/pkgs/container/tipg

```
# Gunicorn image
$ docker run \
-p 8081:8081 \
-e PORT=8081 \
-p 8000:8000 \
-e DATABASE_URL=postgresql://username:password@0.0.0.0:5432/postgis \
ghcr.io/developmentseed/tipg:latest
ghcr.io/developmentseed/tipg:latest \
uvicorn tipg.main:app --host 0.0.0.0 --port 8000 --workers 1

# or Uvicorn image
# using Gunicorn
$ docker run \
-p 8081:8081 \
-e PORT=8081 \
-p 8000:8000 \
-e DATABASE_URL=postgresql://username:password@0.0.0.0:5432/postgis \
ghcr.io/developmentseed/tipg:uvicorn-latest
ghcr.io/developmentseed/tipg:latest \
gunicorn -k uvicorn.workers.UvicornWorker tipg.main:app --bind 0.0.0.0:8000 --workers 1
```

Note: If you are planning to use the docker image in a kubernetes deployment you may want to use the `uvicorn` image (ref: https://fastapi.tiangolo.com/deployment/server-workers/).

## Contribution & Development

See [CONTRIBUTING.md](https://github.com/developmentseed/tipg/blob/main/CONTRIBUTING.md)
Expand Down
32 changes: 2 additions & 30 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,9 @@
version: '3'

services:
app:
build:
context: .
dockerfile: dockerfiles/Dockerfile.gunicorn
environment:
- HOST=0.0.0.0
- PORT=8081
- PYTHONWARNINGS=ignore
- POSTGRES_USER=username
- POSTGRES_PASS=password
- POSTGRES_DBNAME=postgis
- POSTGRES_HOST=database
- POSTGRES_PORT=5432
- DEBUG=TRUE
ports:
- "${MY_DOCKER_IP:-127.0.0.1}:8081:8081"
depends_on:
- database
command:
bash -c "bash /tmp/scripts/wait-for-it.sh database:5432 --timeout=30 && /start.sh"
volumes:
- ./dockerfiles/scripts:/tmp/scripts

app-uvicorn:
build:
context: .
dockerfile: dockerfiles/Dockerfile.uvicorn
dockerfile: dockerfiles/Dockerfile
environment:
- HOST=0.0.0.0
- PORT=8081
- WEB_CONCURRENCY=1
- PYTHONWARNINGS=ignore
- POSTGRES_USER=username
- POSTGRES_PASS=password
Expand All @@ -44,7 +16,7 @@ services:
depends_on:
- database
command:
bash -c "bash /tmp/scripts/wait-for-it.sh database:5432 --timeout=30 && uvicorn tipg.main:app --host 0.0.0.0 --port 8081"
bash -c "bash /tmp/scripts/wait-for-it.sh database:5432 --timeout=30 && uvicorn tipg.main:app --host 0.0.0.0 --port 8081 --workers 5"
volumes:
- ./dockerfiles/scripts:/tmp/scripts

Expand Down
34 changes: 34 additions & 0 deletions dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ARG PYTHON_VERSION=3.12

FROM bitnami/python:${PYTHON_VERSION}
RUN apt update && apt upgrade -y \
&& apt install curl -y \
&& rm -rf /var/lib/apt/lists/*

# Ensure root certificates are always updated at evey container build
# and curl is using the latest version of them
RUN mkdir /usr/local/share/ca-certificates/cacert.org
RUN cd /usr/local/share/ca-certificates/cacert.org && curl -k -O https://www.cacert.org/certs/root.crt
RUN cd /usr/local/share/ca-certificates/cacert.org && curl -k -O https://www.cacert.org/certs/class3.crt
RUN update-ca-certificates
ENV CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt

RUN python -m pip install -U pip
RUN python -m pip install uvicorn uvicorn-worker gunicorn

COPY README.md README.md
COPY LICENSE LICENSE
COPY tipg/ tipg/
COPY pyproject.toml pyproject.toml

RUN python -m pip install . --no-cache-dir
RUN rm -rf tipg/ README.md pyproject.toml LICENSE

###################################################
# For compatibility (might be removed at one point)
ENV MODULE_NAME=tipg.main
ENV VARIABLE_NAME=app
ENV HOST=0.0.0.0
ENV PORT=80
ENV WEB_CONCURRENCY=1
CMD gunicorn -k uvicorn.workers.UvicornWorker ${MODULE_NAME}:${VARIABLE_NAME} --bind ${HOST}:${PORT} --workers ${WEB_CONCURRENCY}
16 changes: 0 additions & 16 deletions dockerfiles/Dockerfile.gunicorn

This file was deleted.

Loading
Loading