Skip to content

Commit

Permalink
fix: names and infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski committed Apr 3, 2023
1 parent 5c576e9 commit ee157e0
Show file tree
Hide file tree
Showing 19 changed files with 182 additions and 444 deletions.
22 changes: 1 addition & 21 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
66 changes: 8 additions & 58 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -155,20 +106,19 @@ 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
POSTGRES_DBNAME: postgis
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
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/deploy_mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -41,7 +37,7 @@ jobs:
--output_dir docs/api/ \
--exclude_source \
--overwrite \
stac_fastapi
stac_fastapi.sqlalchemy
env:
POSTGRES_USER: username
POSTGRES_PASS: password
Expand Down
109 changes: 53 additions & 56 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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',
#]
- 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',
#]
30 changes: 14 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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]
18 changes: 7 additions & 11 deletions Dockerfile.docs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
"as_markdown", \
"--output_dir", \
"docs/api/", \
"--exclude_source", \
"--overwrite", \
"stac_fastapi.sqlalchemy"]
Loading

0 comments on commit ee157e0

Please sign in to comment.