-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
50 changed files
with
4,705 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: arturo-stac-api | ||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
|
||
services: | ||
db_service: | ||
image: kartoza/postgis:latest | ||
env: | ||
POSTGRES_USER: username | ||
POSTGRES_PASS: password | ||
POSTGRES_DBNAME: postgis | ||
POSTGRES_HOST: localhost | ||
POSTGRES_PORT: 5432 | ||
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 5s | ||
--health-retries 5 | ||
ports: | ||
# Maps tcp port 5432 on service container to the host | ||
- 5432:5432 | ||
|
||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v2 | ||
|
||
# Setup Python (faster than using Python container) | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.8" | ||
|
||
- name: Install pipenv | ||
run: | | ||
python -m pip install --upgrade pipenv wheel | ||
- id: cache-pipenv | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.local/share/virtualenvs | ||
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }} | ||
|
||
- name: Install dependencies | ||
if: steps.cache-pipenv.outputs.cache-hit != 'true' | ||
run: | | ||
pipenv install --deploy --dev | ||
- name: Run migration | ||
run: | | ||
pipenv run alembic upgrade head | ||
env: | ||
POSTGRES_USER: username | ||
POSTGRES_PASS: password | ||
POSTGRES_DBNAME: postgis | ||
POSTGRES_HOST: localhost | ||
POSTGRES_PORT: 5432 | ||
|
||
- name: Run test suite | ||
run: | | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
PIP_EXTRA_INDEX_URL | ||
*.txt | ||
!tests/resources/*.jpg | ||
**.pyc | ||
**.log | ||
*.mat | ||
target/* | ||
src/local/* | ||
src/local-test/* | ||
*.iml | ||
.idea/ | ||
model/ | ||
.DS_Store | ||
#config.yaml | ||
**.save | ||
*.jpg | ||
**.save.* | ||
**.bak | ||
.DS_Store | ||
.mvn/ | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# user specific overrides | ||
tests/tests.ini | ||
tests/logging.ini | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# dotenv | ||
.env | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# skaffold temporary build/deploy files | ||
build.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
repos: | ||
- repo: https://github.com/python/black | ||
rev: stable | ||
hooks: | ||
- id: black | ||
language_version: python3.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM python:3.8-slim | ||
|
||
# Any python libraries that require system libraries to be installed will likely | ||
# need the following packages in order to build | ||
RUN apt-get update && apt-get install -y \ | ||
build-essential \ | ||
libffi-dev \ | ||
libssl-dev \ | ||
git | ||
|
||
RUN pip install pipenv | ||
ENV PIPENV_NOSPIN=true | ||
ENV PIPENV_HIDE_EMOJIS=true | ||
|
||
ARG install_dev_dependencies=true | ||
|
||
WORKDIR /app | ||
|
||
COPY Pipfile Pipfile.lock ./ | ||
RUN pipenv install --deploy --ignore-pipfile ${install_dev_dependencies:+--dev} | ||
|
||
COPY . ./ | ||
|
||
ENV APP_HOST=0.0.0.0 | ||
ENV APP_PORT=80 | ||
|
||
ENV RELOAD='' | ||
|
||
|
||
ENTRYPOINT ["pipenv", "run"] | ||
CMD uvicorn stac_api.app:app --host=${APP_HOST} --port=${APP_PORT} ${RELOAD:+--reload} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Arturo AI | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!make | ||
APP_HOST ?= 0.0.0.0 | ||
APP_PORT ?= 8080 | ||
EXTERNAL_APP_PORT ?= ${APP_PORT} | ||
run_docker = docker run -it --rm \ | ||
-p ${EXTERNAL_APP_PORT}:${APP_PORT} \ | ||
-v $(shell pwd):/app \ | ||
--env APP_HOST=${APP_HOST} \ | ||
--env APP_PORT=${APP_PORT} \ | ||
--env POSTGRES_USER=username \ | ||
--env POSTGRES_PASS=password \ | ||
--env POSTGRES_DBNAME=postgis \ | ||
--env POSTGRES_HOST_READER=host.docker.internal \ | ||
--env POSTGRES_HOST_WRITER=host.docker.internal \ | ||
--env POSTGRES_PORT=5432 \ | ||
--env ENVIRONMENT=development \ | ||
arturo-stac-api_app | ||
|
||
.PHONY: docker-shell | ||
docker-shell: | ||
$(run_docker) /bin/bash | ||
|
||
.PHONY: test | ||
test: | ||
$(run_docker) pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[[source]] | ||
name = "pypi" | ||
url = "https://pypi.org/simple" | ||
verify_ssl = "true" | ||
|
||
[packages] | ||
uvicorn = "*" | ||
fastapi = {extras = ["all"],version = "*"} | ||
alembic = "*" | ||
psycopg2-binary = "*" | ||
shapely = "*" | ||
sqlalchemy = "*" | ||
geoalchemy2 = "<0.8.0" | ||
sqlakeyset = "*" | ||
stac-pydantic = "*" | ||
|
||
[dev-packages] | ||
pytest = "*" | ||
pytest-cov = "*" | ||
pytest-asyncio = "*" | ||
requests = "*" | ||
|
||
[requires] | ||
python_version = "3.8" |
Oops, something went wrong.