From ee157e08bbf8e452fa5f832d2c0a450ff6c274aa Mon Sep 17 00:00:00 2001 From: Pete Gadomski Date: Wed, 22 Mar 2023 05:28:17 -0600 Subject: [PATCH] fix: names and infrastructure --- .github/dependabot.yml | 22 +---- .github/workflows/cicd.yaml | 66 ++----------- .github/workflows/deploy_mkdocs.yml | 8 +- .pre-commit-config.yaml | 109 +++++++++++---------- CONTRIBUTING.md | 30 +++--- Dockerfile | 6 +- Dockerfile.docs | 18 ++-- Makefile | 75 ++++----------- RELEASING.md | 2 +- docker-compose.docs.yml | 2 +- docker-compose.nginx.yml | 9 +- docker-compose.yml | 64 +------------ docs/tips-and-tricks.md | 29 ------ mkdocs.yml | 141 ++++++++++++---------------- nginx.conf | 11 +-- pyproject.toml | 4 +- scripts/ingest_joplin.py | 2 +- scripts/publish | 24 +---- setup.py | 4 + 19 files changed, 182 insertions(+), 444 deletions(-) delete mode 100644 docs/tips-and-tricks.md diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 465c88f..11dd2d7 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,26 +9,6 @@ updates: schedule: interval: weekly - package-ecosystem: pip - directory: "/stac_fastapi/api" - schedule: - interval: weekly - - package-ecosystem: pip - directory: "/stac_fastapi/api" - schedule: - interval: weekly - - package-ecosystem: pip - directory: "/stac_fastapi/types" - schedule: - interval: weekly - - package-ecosystem: pip - directory: "/stac_fastapi/extensions" - schedule: - interval: weekly - - package-ecosystem: pip - directory: "/stac_fastapi/pgstac" - schedule: - interval: weekly - - package-ecosystem: pip - directory: "/stac_fastapi/sqlalchemy" + directory: "/" schedule: interval: weekly diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index 6f4eadd..36818fe 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -53,33 +53,13 @@ jobs: python -m pip install pre-commit pre-commit run --all-files - - name: Install pipenv + - name: Install run: | - python -m pip install --upgrade pipenv wheel - - - name: Install types - run: | - pip install ./stac_fastapi/types[dev] - - - name: Install core api - run: | - pip install ./stac_fastapi/api[dev] - - - name: Install Extensions - run: | - pip install ./stac_fastapi/extensions[dev] - - - name: Install sqlalchemy stac-fastapi - run: | - pip install ./stac_fastapi/sqlalchemy[dev,server] - - - name: Install pgstac stac-fastapi - run: | - pip install ./stac_fastapi/pgstac[dev,server] + pip install .[dev,server] - name: Run migration run: | - cd stac_fastapi/sqlalchemy && alembic upgrade head + alembic upgrade head env: POSTGRES_USER: username POSTGRES_PASS: password @@ -88,32 +68,7 @@ jobs: POSTGRES_PORT: 5432 - name: Run test suite - run: | - cd stac_fastapi/api && pipenv run pytest -svvv - env: - ENVIRONMENT: testing - - - name: Run test suite - run: | - cd stac_fastapi/types && pipenv run pytest -svvv - env: - ENVIRONMENT: testing - - - name: Run test suite - run: | - cd stac_fastapi/sqlalchemy && pipenv run pytest -svvv - env: - ENVIRONMENT: testing - POSTGRES_USER: username - POSTGRES_PASS: password - POSTGRES_DBNAME: postgis - POSTGRES_HOST_READER: localhost - POSTGRES_HOST_WRITER: localhost - POSTGRES_PORT: 5432 - - - name: Run test suite - run: | - cd stac_fastapi/pgstac && pipenv run pytest -svvv + run: make test env: ENVIRONMENT: testing POSTGRES_USER: username @@ -125,10 +80,6 @@ jobs: validate: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - backend: ["sqlalchemy", "pgstac"] services: pgstac: image: ghcr.io/stac-utils/pgstac:v0.7.1 @@ -155,12 +106,11 @@ jobs: with: python-version: "3.10" cache: pip - cache-dependency-path: stac_fastapi/pgstac/setup.cfg + cache-dependency-path: setup.py - name: Install stac-fastapi and stac-api-validator - run: pip install ./stac_fastapi/api ./stac_fastapi/types ./stac_fastapi/${{ matrix.backend }}[server] stac-api-validator==0.4.1 + run: pip install .[server] stac-api-validator==0.4.1 - name: Run migration - if: ${{ matrix.backend == 'sqlalchemy' }} - run: cd stac_fastapi/sqlalchemy && alembic upgrade head + run: alembic upgrade head env: POSTGRES_USER: username POSTGRES_PASS: password @@ -168,7 +118,7 @@ jobs: POSTGRES_HOST: localhost POSTGRES_PORT: 5432 - name: Load data and validate - run: python -m stac_fastapi.${{ matrix.backend }}.app & ./scripts/wait-for-it.sh localhost:8080 && python ./scripts/ingest_joplin.py http://localhost:8080 && ./scripts/validate http://localhost:8080 + run: python -m stac_fastapi.sqlalchemy.app & ./scripts/wait-for-it.sh localhost:8080 && python ./scripts/ingest_joplin.py http://localhost:8080 && ./scripts/validate http://localhost:8080 env: POSTGRES_USER: username POSTGRES_PASS: password diff --git a/.github/workflows/deploy_mkdocs.yml b/.github/workflows/deploy_mkdocs.yml index 546718a..6b5cb86 100644 --- a/.github/workflows/deploy_mkdocs.yml +++ b/.github/workflows/deploy_mkdocs.yml @@ -28,11 +28,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install -e \ - stac_fastapi/api \ - stac_fastapi/types \ - stac_fastapi/extensions \ - stac_fastapi/sqlalchemy + python -m pip install -e . python -m pip install mkdocs mkdocs-material pdocs - name: update API docs @@ -41,7 +37,7 @@ jobs: --output_dir docs/api/ \ --exclude_source \ --overwrite \ - stac_fastapi + stac_fastapi.sqlalchemy env: POSTGRES_USER: username POSTGRES_PASS: password diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cba32d7..8222a5d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,57 +1,54 @@ repos: - - repo: https://github.com/PyCQA/isort - rev: 5.12.0 - hooks: - - id: isort - language_version: python3.8 - - - repo: https://github.com/psf/black - rev: 22.12.0 - hooks: - - id: black - args: ['--safe'] - language_version: python3.8 - - - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 - hooks: - - id: flake8 - language_version: python3.8 - args: [ - # E501 let black handle all line length decisions - # W503 black conflicts with "line break before operator" rule - # E203 black conflicts with "whitespace before ':'" rule - '--ignore=E501,W503,E203,C901'] - - - repo: https://github.com/chewse/pre-commit-mirrors-pydocstyle - # 2.1.1 - rev: v2.1.1 - hooks: - - id: pydocstyle - language_version: python3.8 - exclude: '.*(test|alembic|scripts).*' - args: [ - # Check for docstring presence only - '--select=D1', - - ] - # Don't require docstrings for tests - # '--match=(?!test).*\.py'] -# - -# repo: https://github.com/pre-commit/mirrors-mypy -# rev: v0.770 -# hooks: -# - id: mypy -# language_version: python3.8 -# args: [--no-strict-optional, --ignore-missing-imports] - - - repo: https://github.com/PyCQA/pydocstyle - rev: 6.3.0 - hooks: - - id: pydocstyle - language_version: python3.8 - exclude: '.*(test|alembic|scripts).*' - #args: [ - # Don't require docstrings for tests - #'--match=(?!test|alembic|scripts).*\.py', - #] \ No newline at end of file + - repo: https://github.com/PyCQA/isort + rev: 5.12.0 + hooks: + - id: isort + language_version: python3.8 + - repo: https://github.com/psf/black + rev: 22.12.0 + hooks: + - id: black + args: ["--safe"] + language_version: python3.8 + - repo: https://github.com/pycqa/flake8 + rev: 6.0.0 + hooks: + - id: flake8 + language_version: python3.8 + args: [ + # E501 let black handle all line length decisions + # W503 black conflicts with "line break before operator" rule + # E203 black conflicts with "whitespace before ':'" rule + "--ignore=E501,W503,E203,C901", + ] + - repo: https://github.com/chewse/pre-commit-mirrors-pydocstyle + # 2.1.1 + rev: v2.1.1 + hooks: + - id: pydocstyle + language_version: python3.8 + exclude: ".*(test|alembic|scripts).*" + args: + [ + # Check for docstring presence only + "--select=D1", + ] + # Don't require docstrings for tests + # '--match=(?!test).*\.py'] + # - + # repo: https://github.com/pre-commit/mirrors-mypy + # rev: v0.770 + # hooks: + # - id: mypy + # language_version: python3.8 + # args: [--no-strict-optional, --ignore-missing-imports] + - repo: https://github.com/PyCQA/pydocstyle + rev: 6.3.0 + hooks: + - id: pydocstyle + language_version: python3.8 + exclude: ".*(test|alembic|scripts).*" + #args: [ + # Don't require docstrings for tests + #'--match=(?!test|alembic|scripts).*\.py', + #] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5cca160..6880909 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,47 +2,45 @@ Issues and pull requests are more than welcome. -**dev install** +## Development install -```bash -$ git clone https://github.com/stac-utils/stac-fastapi.git -$ cd stac-fastapi -$ pip install -e stac_fastapi/api[dev] +```shell +git clone https://github.com/stac-utils/stac-fastapi-sqlalchemy +cd stac-fastapi-sqlalchemy +make install ``` -**Python3.8 only** - This repo is set to use `pre-commit` to run *isort*, *flake8*, *pydocstring*, *black* ("uncompromising Python code formatter") 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-sqlalchemy +cd stac-fastapi-sqlalchemy +pip install -e .[docs] ``` Hot-reloading docs: ```bash -$ mkdocs serve +mkdocs serve ``` To manually deploy docs (note you should never need to do this because GitHub Actions deploys automatically for new commits.): ```bash -Create API documentations -$ pdocs as_markdown \ +# Create API documentations +pdocs as_markdown \ --output_dir docs/api/ \ --exclude_source \ --overwrite \ - stac_fastapi + stac_fastapi.sqlalchemy # deploy -$ mkdocs gh-deploy +mkdocs gh-deploy ``` diff --git a/Dockerfile b/Dockerfile index 5c218e2..1bd8331 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,8 +16,4 @@ 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] && \ - pip install -e ./stac_fastapi/sqlalchemy[dev,server] && \ - pip install -e ./stac_fastapi/pgstac[dev,server] +RUN pip install -e .[dev,server] diff --git a/Dockerfile.docs b/Dockerfile.docs index f145b31..a33974b 100644 --- a/Dockerfile.docs +++ b/Dockerfile.docs @@ -10,16 +10,12 @@ COPY . /opt/src WORKDIR /opt/src -RUN python -m pip install \ - stac_fastapi/api \ - stac_fastapi/types \ - stac_fastapi/extensions \ - stac_fastapi/sqlalchemy +RUN python -m pip install . CMD ["pdocs", \ - "as_markdown", \ - "--output_dir", \ - "docs/api/", \ - "--exclude_source", \ - "--overwrite", \ - "stac_fastapi"] \ No newline at end of file + "as_markdown", \ + "--output_dir", \ + "docs/api/", \ + "--exclude_source", \ + "--overwrite", \ + "stac_fastapi.sqlalchemy"] diff --git a/Makefile b/Makefile index fbeb7d8..4a19a41 100644 --- a/Makefile +++ b/Makefile @@ -2,87 +2,44 @@ APP_HOST ?= 0.0.0.0 APP_PORT ?= 8080 EXTERNAL_APP_PORT ?= ${APP_PORT} -run_sqlalchemy = docker-compose run --rm \ - -p ${EXTERNAL_APP_PORT}:${APP_PORT} \ - -e APP_HOST=${APP_HOST} \ - -e APP_PORT=${APP_PORT} \ - app-sqlalchemy -run_pgstac = docker-compose run --rm \ +run = docker-compose run --rm \ -p ${EXTERNAL_APP_PORT}:${APP_PORT} \ -e APP_HOST=${APP_HOST} \ -e APP_PORT=${APP_PORT} \ - app-pgstac + app .PHONY: image image: docker-compose build -.PHONY: docker-run-all -docker-run-all: +.PHONY: docker-run +docker-run: docker-compose up -.PHONY: docker-run-sqlalchemy -docker-run-sqlalchemy: image - $(run_sqlalchemy) - -.PHONY: docker-run-pgstac -docker-run-pgstac: image - $(run_pgstac) - .PHONY: docker-run-nginx-proxy docker-run-nginx-proxy: docker-compose -f docker-compose.yml -f docker-compose.nginx.yml up -.PHONY: docker-shell-sqlalchemy -docker-shell-sqlalchemy: - $(run_sqlalchemy) /bin/bash - -.PHONY: docker-shell-pgstac -docker-shell-pgstac: - $(run_pgstac) /bin/bash - -.PHONY: test-sqlalchemy -test-sqlalchemy: run-joplin-sqlalchemy - $(run_sqlalchemy) /bin/bash -c 'export && ./scripts/wait-for-it.sh database:5432 && cd /app/stac_fastapi/sqlalchemy/tests/ && pytest -vvv' +.PHONY: docker-shell +docker-shell: + $(run) /bin/bash -.PHONY: test-pgstac -test-pgstac: - $(run_pgstac) /bin/bash -c 'export && ./scripts/wait-for-it.sh database:5432 && cd /app/stac_fastapi/pgstac/tests/ && pytest -vvv' - -.PHONY: test-api -test-api: - $(run_sqlalchemy) /bin/bash -c 'cd /app/stac_fastapi/api && pytest -svvv' +.PHONY: test +test: run-joplin + $(run) /bin/bash -c 'export && ./scripts/wait-for-it.sh database:5432 && cd /app/tests/ && pytest -vvv' .PHONY: run-database run-database: docker-compose run --rm database -.PHONY: run-joplin-sqlalchemy -run-joplin-sqlalchemy: - docker-compose run --rm loadjoplin-sqlalchemy - -.PHONY: run-joplin-pgstac -run-joplin-pgstac: - docker-compose run --rm loadjoplin-pgstac - -.PHONY: test -test: test-sqlalchemy test-pgstac - -.PHONY: pybase-install -pybase-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] - -.PHONY: pgstac-install -pgstac-install: pybase-install - pip install -e ./stac_fastapi/pgstac[dev,server] +.PHONY: run-joplin +run-joplin: + docker-compose run --rm loadjoplin -.PHONY: sqlalchemy-install -sqlalchemy-install: pybase-install - pip install -e ./stac_fastapi/sqlalchemy[dev,server] +.PHONY: install +install: + pip install -e .[dev,server] .PHONY: docs-image docs-image: diff --git a/RELEASING.md b/RELEASING.md index 8aa14af..6c0c74a 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -4,7 +4,7 @@ This is a checklist for releasing a new version of **stac-fastapi**. 1. Determine the next version. We currently do not have published versioning guidelines, but there is some text on the subject here: . 2. Create a release branch named `release/vX.Y.Z`, where `X.Y.Z` is the new version. -3. Search and replace all instances of the current version number with the new version. As of this writing, there's five different `version.py` files, and one `VERSION` file, in the repo. +3. Search and replace all instances of the current version number with the new version. 4. Update [CHANGES.md](./CHANGES.md) for the new version. Add the appropriate header, and update the links at the bottom of the file. 5. Audit CHANGES.md for completeness and accuracy. Also, ensure that the changes in this version are appropriate for the version number change (i.e. if you're making breaking changes, you should be increasing the `MAJOR` version number). 6. (optional) If you have permissions, run `scripts/publish --test` to test your PyPI publish. If successful, the published packages will be available on . diff --git a/docker-compose.docs.yml b/docker-compose.docs.yml index 5ed8778..9c441f1 100644 --- a/docker-compose.docs.yml +++ b/docker-compose.docs.yml @@ -5,7 +5,7 @@ services: container_name: stac-fastapi-docs-dev build: context: . - dockerfile: docker/Dockerfile.docs + dockerfile: Dockerfile.docs platform: linux/amd64 environment: - POSTGRES_USER=username diff --git a/docker-compose.nginx.yml b/docker-compose.nginx.yml index b70bffe..5ea3bdb 100644 --- a/docker-compose.nginx.yml +++ b/docker-compose.nginx.yml @@ -7,12 +7,9 @@ services: volumes: - ./nginx.conf:/etc/nginx/nginx.conf depends_on: - - app-pgstac - - app-sqlalchemy + - app command: [ "nginx-debug", "-g", "daemon off;" ] - app-pgstac: - environment: - - UVICORN_ROOT_PATH=/api/v1/pgstac - app-sqlalchemy: + + app: environment: - UVICORN_ROOT_PATH=/api/v1/sqlalchemy diff --git a/docker-compose.yml b/docker-compose.yml index 5637f7e..d665db6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,9 @@ version: '3' services: - app-sqlalchemy: + app: container_name: stac-fastapi-sqlalchemy image: stac-utils/stac-fastapi - build: - context: . - dockerfile: docker/Dockerfile + build: . platform: linux/amd64 environment: - APP_HOST=0.0.0.0 @@ -28,37 +26,6 @@ services: - database command: bash -c "./scripts/wait-for-it.sh database:5432 && python -m stac_fastapi.sqlalchemy.app" - app-pgstac: - container_name: stac-fastapi-pgstac - image: stac-utils/stac-fastapi - platform: linux/amd64 - environment: - - APP_HOST=0.0.0.0 - - APP_PORT=8082 - - RELOAD=true - - ENVIRONMENT=local - - POSTGRES_USER=username - - POSTGRES_PASS=password - - POSTGRES_DBNAME=postgis - - POSTGRES_HOST_READER=database - - POSTGRES_HOST_WRITER=database - - POSTGRES_PORT=5432 - - WEB_CONCURRENCY=10 - - VSI_CACHE=TRUE - - GDAL_HTTP_MERGE_CONSECUTIVE_RANGES=YES - - GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR - - DB_MIN_CONN_SIZE=1 - - DB_MAX_CONN_SIZE=1 - - USE_API_HYDRATE=${USE_API_HYDRATE:-false} - ports: - - "8082:8082" - volumes: - - ./stac_fastapi:/app/stac_fastapi - - ./scripts:/app/scripts - depends_on: - - database - command: bash -c "./scripts/wait-for-it.sh database:5432 && python -m stac_fastapi.pgstac.app" - database: container_name: stac-db image: ghcr.io/stac-utils/pgstac:v0.7.1 @@ -74,7 +41,7 @@ services: command: postgres -N 500 # Load joplin demo dataset into the SQLAlchemy Application - loadjoplin-sqlalchemy: + loadjoplin: image: stac-utils/stac-fastapi environment: - ENVIRONMENT=development @@ -87,31 +54,10 @@ services: - ./stac_fastapi:/app/stac_fastapi - ./scripts:/app/scripts command: > - bash -c "./scripts/wait-for-it.sh app-sqlalchemy:8081 -t 60 && cd stac_fastapi/sqlalchemy && alembic upgrade head && python /app/scripts/ingest_joplin.py http://app-sqlalchemy:8081" - depends_on: - - database - - app-sqlalchemy - - # Load joplin demo dataset into the PGStac Application - loadjoplin-pgstac: - image: stac-utils/stac-fastapi - environment: - - ENVIRONMENT=development - volumes: - - ./stac_fastapi:/app/stac_fastapi - - ./scripts:/app/scripts - command: - - "./scripts/wait-for-it.sh" - - "-t" - - "60" - - "app-pgstac:8082" - - "--" - - "python" - - "/app/scripts/ingest_joplin.py" - - "http://app-pgstac:8082" + bash -c "./scripts/wait-for-it.sh app:8081 -t 60 && alembic upgrade head && python /app/scripts/ingest_joplin.py http://app:8081" depends_on: - database - - app-pgstac + - app networks: default: diff --git a/docs/tips-and-tricks.md b/docs/tips-and-tricks.md deleted file mode 100644 index 3d4c9ac..0000000 --- a/docs/tips-and-tricks.md +++ /dev/null @@ -1,29 +0,0 @@ -# Tips and Tricks -This page contains a few 'tips and tricks' for getting stac-fastapi working in various situations. - -## Get stac-fastapi working with CORS -CORS (Cross-Origin Resource Sharing) support may be required to use stac-fastapi in certain situations. For example, if you are running -[stac-browser](https://github.com/radiantearth/stac-browser) to browse the STAC catalog created by stac-fastapi, then you will need to enable CORS support. - -To do this, edit `stac_fastapi/sqlalchemy/stac_fastapi/sqlalchemy/app.py` (or the equivalent in the `pgstac` folder) and add the following import: - -``` -from fastapi.middleware.cors import CORSMiddleware -``` - -and then edit the `api = StacApi(...` call to add the following parameter: - -``` -middlewares=[lambda app: CORSMiddleware(app, allow_origins=["*"])] -``` - -If needed, you can edit the `allow_origins` parameter to only allow CORS requests from specific origins. - -## Enable the Context extension -The Context STAC extension provides information on the number of items matched and returned from a STAC search. This is required by various other STAC-related tools, such as the pystac command-line client. To enable the extension, edit `stac_fastapi/sqlalchemy/stac_fastapi/sqlalchemy/app.py` (or the equivalent in the `pgstac` folder) and add the following import: - -``` -from stac_fastapi.extensions.core.context import ContextExtension -``` - -and then edit the `api = StacApi(...` call to add `ContextExtension()` to the list given as the `extensions` parameter. \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index d0e1b02..1b75fc0 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,65 +1,40 @@ -site_name: stac-fastapi -site_description: STAC FastAPI. +site_name: stac-fastapi-sqlalchemy +site_description: STAC FastAPI - sqlalchemy backend. # Repository -repo_name: 'stac-utils/stac-fastapi' -repo_url: 'https://github.com/stac-utils/stac-fastapi' -edit_uri: 'blob/master/docs/src/' - +repo_name: "stac-utils/stac-fastapi-sqlalchemy" +repo_url: "https://github.com/stac-utils/stac-fastapi-sqlalchemy" +edit_uri: "blob/master/docs/src/" # Social links extra: social: - - icon: 'fontawesome/brands/github' - link: 'https://github.com/stac-utils' + - icon: "fontawesome/brands/github" + link: "https://github.com/stac-utils" # Layout nav: - - Home: 'index.md' + - Home: "index.md" - API: - - stac_fastapi.api: - - app: api/stac_fastapi/api/app.md - - config: api/stac_fastapi/api/config.md - - errors: api/stac_fastapi/api/errors.md - - middleware: api/stac_fastapi/api/middleware.md - - models: api/stac_fastapi/api/models.md - - openapi: api/stac_fastapi/api/openapi.md - - routes: api/stac_fastapi/api/routes.md - - stac_fastapi.extensions: - - core: - - context: api/stac_fastapi/extensions/core/context.md - - filter: api/stac_fastapi/extensions/core/filter/filter.md - - fields: api/stac_fastapi/extensions/core/fields/fields.md - - query: api/stac_fastapi/extensions/core/query/query.md - - sort: api/stac_fastapi/extensions/core/sort/sort.md - - transaction: api/stac_fastapi/extensions/core/transaction.md - - pagination: api/stac_fastapi/extensions/core/pagination/pagination.md - - third_party: - - bulk_transactions: api/stac_fastapi/extensions/third_party/bulk_transactions.md - - stac_fastapi.server: - - app: api/stac_fastapi/server/app.md - - stac_fastapi.sqlalchemy: - - models: - - database: api/stac_fastapi/sqlalchemy/models/database.md - - decompose: api/stac_fastapi/sqlalchemy/models/decompose.md - - links: api/stac_fastapi/sqlalchemy/models/links.md - - schemas: api/stac_fastapi/sqlalchemy/models/schemas.md - - config: api/stac_fastapi/sqlalchemy/config.md - - core: api/stac_fastapi/sqlalchemy/core.md - - session: api/stac_fastapi/sqlalchemy/session.md - - tokens: api/stac_fastapi/sqlalchemy/tokens.md - - transactions: api/stac_fastapi/sqlalchemy/transactions.md - - version: api/stac_fastapi/sqlalchemy/version.md - - stac_fastapi.types: - - core: api/stac_fastapi/types/core.md - - config: api/stac_fastapi/types/config.md - - errors: api/stac_fastapi/types/errors.md - - extension: api/stac_fastapi/types/extension.md - - index: api/stac_fastapi/types/index.md - - search: api/stac_fastapi/types/search.md - - version: api/stac_fastapi/types/version.md - - Development - Contributing: 'contributing.md' - - Release Notes: 'release-notes.md' + - stac_fastapi.sqlalchemy: + - extensions: + - index: api/stac_fastapi/sqlalchemy/extensions/index.md + - query: api/stac_fastapi/sqlalchemy/extensions/query.md + - models: + - database: api/stac_fastapi/sqlalchemy/models/database.md + - index: api/stac_fastapi/sqlalchemy/models/index.md + - search: api/stac_fastapi/sqlalchemy/models/search.md + - app: api/stac_fastapi/sqlalchemy/app.md + - config: api/stac_fastapi/sqlalchemy/config.md + - core: api/stac_fastapi/sqlalchemy/core.md + - index: api/stac_fastapi/sqlalchemy/index.md + - serializers: api/stac_fastapi/sqlalchemy/serializers.md + - session: api/stac_fastapi/sqlalchemy/session.md + - tokens: api/stac_fastapi/sqlalchemy/tokens.md + - transactions: api/stac_fastapi/sqlalchemy/transactions.md + - version: api/stac_fastapi/sqlalchemy/version.md + - Development - Contributing: "contributing.md" + - Release Notes: "release-notes.md" plugins: - search @@ -67,13 +42,13 @@ plugins: # Theme theme: icon: - logo: 'material/home' - repo: 'fontawesome/brands/github' - name: 'material' - language: 'en' + logo: "material/home" + repo: "fontawesome/brands/github" + name: "material" + language: "en" font: - text: 'Nunito Sans' - code: 'Fira Code' + text: "Nunito Sans" + code: "Fira Code" extra_css: - stylesheets/extra.css @@ -82,28 +57,28 @@ extra_css: # This way, I can write in Pandoc's Markdown and have it be supported here. # https://pandoc.org/MANUAL.html markdown_extensions: - - admonition - - attr_list - - codehilite: - guess_lang: false - - def_list - - footnotes - - pymdownx.arithmatex - - pymdownx.betterem - - pymdownx.caret: - insert: false - - pymdownx.details - - pymdownx.emoji - - pymdownx.escapeall: - hardbreak: true - nbsp: true - - pymdownx.magiclink: - hide_protocol: true - repo_url_shortener: true - - pymdownx.smartsymbols - - pymdownx.superfences - - pymdownx.tasklist: - custom_checkbox: true - - pymdownx.tilde - - toc: - permalink: true + - admonition + - attr_list + - codehilite: + guess_lang: false + - def_list + - footnotes + - pymdownx.arithmatex + - pymdownx.betterem + - pymdownx.caret: + insert: false + - pymdownx.details + - pymdownx.emoji + - pymdownx.escapeall: + hardbreak: true + nbsp: true + - pymdownx.magiclink: + hide_protocol: true + repo_url_shortener: true + - pymdownx.smartsymbols + - pymdownx.superfences + - pymdownx.tasklist: + custom_checkbox: true + - pymdownx.tilde + - toc: + permalink: true diff --git a/nginx.conf b/nginx.conf index 0084e14..3efc969 100644 --- a/nginx.conf +++ b/nginx.conf @@ -4,18 +4,9 @@ http { server { listen 80; - location /api/v1/pgstac { - rewrite ^/api/v1/pgstac(.*)$ $1 break; - proxy_pass http://app-pgstac:8082; - proxy_set_header HOST $host; - proxy_set_header Referer $http_referer; - proxy_set_header X-Forwarded-For $remote_addr; - proxy_set_header X-Forwarded-Proto $scheme; - } - location /api/v1/sqlalchemy { rewrite ^/api/v1/sqlalchemy(.*)$ $1 break; - proxy_pass http://app-sqlalchemy:8081; + proxy_pass http://app:8081; proxy_set_header HOST $host; proxy_set_header Referer $http_referer; proxy_set_header X-Forwarded-For $remote_addr; diff --git a/pyproject.toml b/pyproject.toml index 4f04d8a..292a535 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,6 +6,6 @@ max-line-length = 90 [tool.isort] profile = "black" -known_first_party = "stac_fastapi" -known_third_party = ["rasterio", "stac-pydantic", "sqlalchemy", "geoalchemy2", "fastapi"] +known_first_party = "stac_fastapi.sqlalchemy" +known_third_party = ["rasterio", "stac-pydantic", "sqlalchemy", "geoalchemy2", "fastapi", "stac_fastapi"] sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] diff --git a/scripts/ingest_joplin.py b/scripts/ingest_joplin.py index 76320fa..6d27321 100644 --- a/scripts/ingest_joplin.py +++ b/scripts/ingest_joplin.py @@ -7,7 +7,7 @@ import requests workingdir = Path(__file__).parent.absolute() -joplindata = workingdir.parent / "stac_fastapi" / "testdata" / "joplin" +joplindata = workingdir.parent / "testdata" / "joplin" app_host = sys.argv[1] diff --git a/scripts/publish b/scripts/publish index 083b130..a6b16ac 100755 --- a/scripts/publish +++ b/scripts/publish @@ -6,19 +6,10 @@ if [[ -n "${CI}" ]]; then set -x fi -# Import shared variables -SUBPACKAGE_DIRS=( - "stac_fastapi/types" - "stac_fastapi/extensions" - "stac_fastapi/api" - "stac_fastapi/sqlalchemy" - "stac_fastapi/pgstac" -) - function usage() { echo -n \ "Usage: $(basename "$0") -Publish all stac-fastapi packages. +Publish stac-fastapi-sqlalchemy. Options: --test Publish to test pypi. Requires a 'testpypi' repository @@ -59,14 +50,7 @@ if [ -z "${TEST_PYPI}" ] && [ -z "${CI}" ]; then fi if [ "${BASH_SOURCE[0]}" = "${0}" ]; then - for PACKAGE_DIR in "${SUBPACKAGE_DIRS[@]}" - do - echo ${PACKAGE_DIR} - pushd ./${PACKAGE_DIR} - rm -rf dist - python setup.py sdist bdist_wheel - twine upload ${TEST_PYPI} dist/* - popd - - done + rm -rf dist + python setup.py sdist bdist_wheel + twine upload ${TEST_PYPI} dist/* fi \ No newline at end of file diff --git a/setup.py b/setup.py index fd4f530..c504380 100644 --- a/setup.py +++ b/setup.py @@ -23,10 +23,14 @@ extra_reqs = { "dev": [ + "orjson", + "pystac[validation]", "pytest", "pytest-cov", "pre-commit", "requests", + "twine", + "wheel", ], "docs": ["mkdocs", "mkdocs-material", "pdocs"], "server": ["uvicorn[standard]==0.19.0"],