From 8169e86092e945e069f072589c0c8721f6ba0cb4 Mon Sep 17 00:00:00 2001 From: Vincent Sarago Date: Wed, 10 Apr 2024 19:18:26 +0200 Subject: [PATCH] add python 3.12 support and some docker cleanup (#654) * add python 3.12 support and some docker cleanup * :facepalm: --- .github/workflows/cicd.yaml | 42 +++++++---------------------- .github/workflows/deploy_mkdocs.yml | 10 +------ Dockerfile | 6 ++--- Dockerfile.docs | 4 +-- Makefile | 10 +++---- README.md | 12 ++++----- stac_fastapi/api/setup.py | 4 +++ stac_fastapi/extensions/setup.py | 4 +++ stac_fastapi/types/setup.py | 4 +++ 9 files changed, 38 insertions(+), 58 deletions(-) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index f86cb6786..641be715d 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/deploy_mkdocs.yml b/.github/workflows/deploy_mkdocs.yml index 7132fdb6c..4715015e9 100644 --- a/.github/workflows/deploy_mkdocs.yml +++ b/.github/workflows/deploy_mkdocs.yml @@ -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 @@ -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 diff --git a/Dockerfile b/Dockerfile index 2187ac53e..501de7f36 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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] diff --git a/Dockerfile.docs b/Dockerfile.docs index e3c7447e5..caa0f7e9f 100644 --- a/Dockerfile.docs +++ b/Dockerfile.docs @@ -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", \ @@ -21,4 +21,4 @@ CMD ["pdocs", \ "docs/api/", \ "--exclude_source", \ "--overwrite", \ - "stac_fastapi"] \ No newline at end of file + "stac_fastapi"] diff --git a/Makefile b/Makefile index e802fbb54..eef5dae35 100644 --- a/Makefile +++ b/Makefile @@ -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: @@ -21,4 +21,4 @@ docs: docs-image .PHONY: test test: image - pytest . \ No newline at end of file + python -m pytest . diff --git a/README.md b/README.md index 350ce2589..9a8ec78ed 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 ``` diff --git a/stac_fastapi/api/setup.py b/stac_fastapi/api/setup.py index 9dfa86ac9..a5bfd897e 100644 --- a/stac_fastapi/api/setup.py +++ b/stac_fastapi/api/setup.py @@ -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", diff --git a/stac_fastapi/extensions/setup.py b/stac_fastapi/extensions/setup.py index a70ea5855..af564931b 100644 --- a/stac_fastapi/extensions/setup.py +++ b/stac_fastapi/extensions/setup.py @@ -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", diff --git a/stac_fastapi/types/setup.py b/stac_fastapi/types/setup.py index 9a06fda95..c3905ede5 100644 --- a/stac_fastapi/types/setup.py +++ b/stac_fastapi/types/setup.py @@ -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",