Skip to content

Commit

Permalink
add python 3.12 support and some docker cleanup (#654)
Browse files Browse the repository at this point in the history
* add python 3.12 support and some docker cleanup

* 🤦
  • Loading branch information
vincentsarago authored Apr 10, 2024
1 parent 53711ec commit 8169e86
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 58 deletions.
42 changes: 9 additions & 33 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 @@ -93,14 +69,14 @@ jobs:
run: |
python -m pip install ./stac_fastapi/types[dev]
- name: Install extensions
run: |
python -m pip install ./stac_fastapi/extensions
- 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

Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/deploy_mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install \
stac_fastapi/api[docs] \
stac_fastapi/types[docs] \
stac_fastapi/api[docs] \
stac_fastapi/extensions[docs] \
- name: update API docs
Expand All @@ -40,14 +40,6 @@ jobs:
--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 -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"]
10 changes: 5 additions & 5 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 @@ -21,4 +21,4 @@ docs: docs-image

.PHONY: test
test: image
pytest .
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
```
4 changes: 4 additions & 0 deletions stac_fastapi/api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: MIT License",
],
keywords="STAC FastAPI COG",
Expand Down
4 changes: 4 additions & 0 deletions stac_fastapi/extensions/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: MIT License",
],
keywords="STAC FastAPI COG",
Expand Down
4 changes: 4 additions & 0 deletions stac_fastapi/types/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: MIT License",
],
keywords="STAC FastAPI COG",
Expand Down

0 comments on commit 8169e86

Please sign in to comment.