Skip to content

Commit

Permalink
update from main
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Apr 11, 2024
2 parents 6cae792 + 315cfae commit e579311
Show file tree
Hide file tree
Showing 32 changed files with 743 additions and 189 deletions.
76 changes: 47 additions & 29 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
timeout-minutes: 20

services:
db_service:
image: ghcr.io/stac-utils/pgstac:v0.7.1
env:
POSTGRES_USER: username
POSTGRES_PASSWORD: password
POSTGRES_DB: postgis
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
PGUSER: username
PGPASSWORD: password
PGDATABASE: postgis
ALLOW_IP_RANGE: 0.0.0.0/0
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 10s
--health-retries 10
--log-driver none
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432

steps:
- name: Check out repository code
uses: actions/checkout@v4
Expand All @@ -55,18 +31,18 @@ jobs:
- name: Install types
run: |
pip install ./stac_fastapi/types[dev]
python -m pip install ./stac_fastapi/types[dev]
- name: Install core api
run: |
pip install ./stac_fastapi/api[dev]
python -m pip install ./stac_fastapi/api[dev]
- name: Install Extensions
run: |
pip install ./stac_fastapi/extensions[dev]
python -m pip install ./stac_fastapi/extensions[dev]
- name: Test
run: pytest -svvv
run: python -m pytest -svvv
env:
ENVIRONMENT: testing

Expand All @@ -76,3 +52,45 @@ jobs:
- uses: actions/checkout@v4
- name: Test generating docs
run: make docs

benchmark:
needs: [test]
runs-on: ubuntu-20.04
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install types
run: |
python -m pip install ./stac_fastapi/types[dev]
- name: Install core api
run: |
python -m pip install ./stac_fastapi/api[dev,benchmark]
- name: Install extensions
run: |
python -m pip install ./stac_fastapi/extensions
- name: Run Benchmark
run: python -m pytest stac_fastapi/api/tests/benchmarks.py --benchmark-only --benchmark-columns 'min, max, mean, median' --benchmark-json output.json

- name: Store and benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: STAC FastAPI Benchmarks
tool: 'pytest'
output-file-path: output.json
alert-threshold: '130%'
comment-on-alert: true
fail-on-alert: false
# GitHub API token to make a commit comment
github-token: ${{ secrets.GITHUB_TOKEN }}
gh-pages-branch: 'gh-benchmarks'
# Make a commit only if main
auto-push: ${{ github.ref == 'refs/heads/main' }}
19 changes: 5 additions & 14 deletions .github/workflows/deploy_mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
# Rebuild website when docs have changed or code has changed
- "README.md"
- "docs/**"
- "mkdocs.yml"
- "**.py"
workflow_dispatch:

Expand All @@ -28,27 +27,19 @@ jobs:

- name: Install dependencies
run: |
pip install --upgrade pip
pip install \
stac_fastapi/api[docs] \
python -m pip install --upgrade pip
python -m pip install \
stac_fastapi/types[docs] \
stac_fastapi/api[docs] \
stac_fastapi/extensions[docs] \
- name: update API docs
run: |
pdocs as_markdown \
--output_dir docs/api/ \
--output_dir docs/src/api/ \
--exclude_source \
--overwrite \
stac_fastapi
env:
POSTGRES_USER: username
POSTGRES_PASS: password
POSTGRES_DBNAME: postgis
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_HOST_READER: localhost
POSTGRES_HOST_WRITER: localhost
- name: Deploy docs
run: mkdocs gh-deploy --force
run: mkdocs gh-deploy --force -f docs/mkdocs.yml
14 changes: 14 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,22 @@

### Added

* Add benchmark in CI ([#650](https://github.com/stac-utils/stac-fastapi/pull/650))
* Add `/queryables` link to the landing page ([#587](https://github.com/stac-utils/stac-fastapi/pull/587))
- `id`, `title`, `description` and `api_version` fields can be customized via env variables

### Changed

* Updated the collection update endpoint to match with the collection-transaction extension. ([#630](https://github.com/stac-utils/stac-fastapi/issues/630))
* Improve bbox and datetime typing ([#490](https://github.com/stac-utils/stac-fastapi/pull/490)
* Add `items` link to inferred link relations ([#634](https://github.com/stac-utils/stac-fastapi/issues/634))
* Make sure FastAPI uses Pydantic validation and serialization by not wrapping endpoint output with a Response object ([#650](https://github.com/stac-utils/stac-fastapi/pull/650))
* Allow `GeometryCollections` for `intersects` parameter in POST search queries ([#548](https://github.com/stac-utils/stac-fastapi/pull/548))

### Removed

* Deprecate `response_class` option in `stac_fastapi.api.routes.create_async_endpoint` method ([#650](https://github.com/stac-utils/stac-fastapi/pull/650))

## [2.4.9] - 2023-11-17

### Added
Expand Down
24 changes: 12 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ Issues and pull requests are more than welcome.
**dev install**

```bash
$ git clone https://github.com/stac-utils/stac-fastapi.git
$ cd stac-fastapi
$ pip install -e stac_fastapi/api[dev]
git clone https://github.com/stac-utils/stac-fastapi.git
cd stac-fastapi
python -m pip install -e stac_fastapi/api[dev]
```

**Python3.8 only**
**pre-commit**

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

```bash
$ pre-commit install
pre-commit install
```

### Docs

```bash
$ git clone https://github.com/stac-utils/stac-fastapi.git
$ cd stac-fastapi
$ pip install -e stac_fastapi/api["docs"]
git clone https://github.com/stac-utils/stac-fastapi.git
cd stac-fastapi
python pip install -e stac_fastapi/api["docs"]
```

Hot-reloading docs:

```bash
$ mkdocs serve
$ mkdocs serve -f docs/mkdocs.yml
```

To manually deploy docs (note you should never need to do this because GitHub
Expand All @@ -38,11 +38,11 @@ Actions deploys automatically for new commits.):
```bash
Create API documentations
$ pdocs as_markdown \
--output_dir docs/api/ \
--output_dir docs/src/api/ \
--exclude_source \
--overwrite \
stac_fastapi

# deploy
$ mkdocs gh-deploy
$ mkdocs gh-deploy -f docs/mkdocs.yml
```
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ WORKDIR /app

COPY . /app

RUN pip install -e ./stac_fastapi/types[dev] && \
pip install -e ./stac_fastapi/api[dev] && \
pip install -e ./stac_fastapi/extensions[dev]
RUN python -m pip install -e ./stac_fastapi/types[dev] && \
python -m pip install -e ./stac_fastapi/api[dev] && \
python -m pip install -e ./stac_fastapi/extensions[dev]
4 changes: 2 additions & 2 deletions Dockerfile.docs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ COPY . /opt/src
WORKDIR /opt/src

RUN python -m pip install \
stac_fastapi/api \
stac_fastapi/types \
stac_fastapi/api \
stac_fastapi/extensions

CMD ["pdocs", \
Expand All @@ -21,4 +21,4 @@ CMD ["pdocs", \
"docs/api/", \
"--exclude_source", \
"--overwrite", \
"stac_fastapi"]
"stac_fastapi"]
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ image:

.PHONY: install
install:
pip install wheel && \
pip install -e ./stac_fastapi/api[dev] && \
pip install -e ./stac_fastapi/types[dev] && \
pip install -e ./stac_fastapi/extensions[dev]
python -m pip install wheel && \
python -m pip install -e ./stac_fastapi/types[dev] && \
python -m pip install -e ./stac_fastapi/api[dev] && \
python -m pip install -e ./stac_fastapi/extensions[dev]

.PHONY: docs-image
docs-image:
Expand All @@ -18,3 +18,7 @@ docs-image:
docs: docs-image
docker-compose -f docker-compose.docs.yml \
run docs

.PHONY: test
test: image
python -m pytest .
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ Backends are hosted in their own repositories:

```bash
# Install from PyPI
pip install stac-fastapi.api stac-fastapi.types stac-fastapi.extensions
python -m pip install stac-fastapi.types stac-fastapi.api stac-fastapi.extensions

# Install a backend of your choice
pip install stac-fastapi.sqlalchemy
python -m pip install stac-fastapi.sqlalchemy
# or
pip install stac-fastapi.pgstac
python -m pip install stac-fastapi.pgstac
```

Other backends may be available from other sources, search [PyPI](https://pypi.org/) for more.
Expand All @@ -60,14 +60,14 @@ Other backends may be available from other sources, search [PyPI](https://pypi.o
Install the packages in editable mode:

```shell
pip install -e \
'stac_fastapi/api[dev]' \
python -m pip install -e \
'stac_fastapi/types[dev]' \
'stac_fastapi/api[dev]' \
'stac_fastapi/extensions[dev]'
```

To run the tests:

```shell
pytest
python -m pytest
```
1 change: 0 additions & 1 deletion docs/contributing.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/index.md

This file was deleted.

8 changes: 6 additions & 2 deletions mkdocs.yml → docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ site_description: STAC FastAPI.
# Repository
repo_name: "stac-utils/stac-fastapi"
repo_url: "https://github.com/stac-utils/stac-fastapi"
edit_uri: "blob/master/docs/src/"
edit_uri: "blob/main/docs/src/"

docs_dir: 'src'
site_dir: 'build'

# Social links
extra:
Expand All @@ -15,6 +18,7 @@ extra:
# Layout
nav:
- Home: "index.md"
- Tips and Tricks: tips-and-tricks.md
- API:
- packages: api/stac_fastapi/index.md
- stac_fastapi.api:
Expand Down Expand Up @@ -70,9 +74,9 @@ nav:
- search: api/stac_fastapi/types/search.md
- stac: api/stac_fastapi/types/stac.md
- version: api/stac_fastapi/types/version.md
- Performance Benchmarks: benchmarks.html
- Development - Contributing: "contributing.md"
- Release Notes: "release-notes.md"
- Tips and Tricks: tips-and-tricks.md

plugins:
- search
Expand Down
1 change: 0 additions & 1 deletion docs/release-notes.md

This file was deleted.

Loading

0 comments on commit e579311

Please sign in to comment.