Skip to content

Commit

Permalink
Project update (#24)
Browse files Browse the repository at this point in the history
Project update:

- running on docker
- upgrade dependencies
- removed jdc provider
- add GitHub actions lint and test
  • Loading branch information
ysavary authored Nov 27, 2021
1 parent 7eab378 commit c97cb05
Show file tree
Hide file tree
Showing 61 changed files with 2,589 additions and 3,051 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
local_settings.py
env.list
volumes
.env*
22 changes: 22 additions & 0 deletions .env.localhost.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# COMMONS
MONGODB_URL=mongodb://localhost:27017/winds_mobi
REDIS_URL=redis://localhost:6380/0
GOOGLE_API_KEY=

# PROVIDERS

# Windline
WINDLINE_SQL_URL=

# METAR
CHECKWX_API_KEY=

# Romma
ROMMA_KEY=

# iWeathar
IWEATHAR_KEY=

# BornToFly
BORN_TO_FLY_VENDOR_ID=
BORN_TO_FLY_DEVICE_ID=
22 changes: 22 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# COMMONS
MONGODB_URL=mongodb://mongodb:27017/winds_mobi
REDIS_URL=redis://host.docker.internal:6380/0
GOOGLE_API_KEY=

# PROVIDERS

# Windline
WINDLINE_SQL_URL=

# METAR
CHECKWX_API_KEY=

# Romma
ROMMA_KEY=

# iWeathar
IWEATHAR_KEY=

# BornToFly
BORN_TO_FLY_VENDOR_ID=
BORN_TO_FLY_DEVICE_ID=
2 changes: 1 addition & 1 deletion setup.cfg → .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
max-line-length = 120
multiline-quotes = '''
extend-ignore = E203
exclude = winds_mobi_provider/uwxutils.py
35 changes: 35 additions & 0 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test project
on:
push:
branches:
- master
pull_request:

jobs:
test-python:
name: Lint and test
runs-on: ubuntu-latest
env:
PYTHON_VERSION: "3.9"
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install python dependencies with pipenv
run: |
pip install pipenv
pipenv install --deploy --dev
- name: Check python code format
run: pipenv run black --check .

- name: Run python linter
run: pipenv run flake8 .

- name: Run python tests
run: pipenv run pytest
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*.pyc
.idea/
/local_settings.py
/env.list
/volumes/
.env
.env.localhost
32 changes: 22 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
FROM python:3.7-slim-buster
FROM python:3.9-slim-buster AS base

ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

# PHP 7.3 is required by JDC provider
RUN apt-get update; \
DEBIAN_FRONTEND=noninteractive apt-get --yes --no-install-recommends install build-essential \
python-scipy libpq-dev libmariadb-dev-compat php7.3-cli; \
rm -rf /var/lib/apt/lists/*
apt-get --yes --no-install-recommends install python-scipy libpq5 libmariadb3

ADD . /app
WORKDIR /app
FROM base AS python-deps

RUN apt-get update; \
apt-get --yes --no-install-recommends install build-essential python-scipy libpq-dev libmariadb-dev

RUN pip install pipenv
RUN pipenv install --system --deploy

RUN apt-get --yes --purge autoremove build-essential
COPY . .
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy

FROM base AS runtime

ENV PATH="/.venv/bin:$PATH"

WORKDIR /app
COPY . .

FROM runtime AS production

ENTRYPOINT ["python"]
COPY --from=python-deps /.venv /.venv
ENTRYPOINT ["python", "run_providers.py"]
50 changes: 29 additions & 21 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,38 @@ verify_ssl = true
name = "pypi"

[packages]
arrow = "==0.12.1"
cachetools = "==1.1.3"
furl = "==2.1.0"
apscheduler = "==3.8.1"
arrow = "==1.2.1"
cachetools = "==4.2.4"
furl = "==2.1.3"
lxml = "==4.6.3"
metar = "==1.6.0"
mysqlclient = "==1.4.6"
pint = "==0.8.1"
psycopg2 = "==2.8.4"
pyaml = "==16.9.0"
pymongo = "==3.7.2"
pyproj = "==2.6.1.post1"
pytz = "==2018.5"
redis = "==2.10.3"
requests = "==2.25.1"
sentry-sdk = "==1.2.0"
scikit-learn = "==0.20.0"
scipy = "==1.4.1"
tenacity = "==5.0.2"
xmltodict = "==0.10.2"
metar = "==1.8.0"
mysqlclient = "==2.1.0"
pint = "==0.17"
psycopg2 = "==2.9.1"
pyaml = "==21.8.3"
pymongo = "==3.12.0"
pyproj = "==3.2.1"
pytz = "==2021.3"
redis = "==3.5.3"
requests = "==2.26.0"
sentry-sdk = "==1.4.3"
scikit-learn = "==1.0.1"
scipy = "==1.7.3"
tenacity = "==8.0.1"
# https://github.com/agronholm/apscheduler/discussions/570
tzlocal = "==2.1"
xmltodict = "==0.12.0"

[dev-packages]
flake8 = "*"
"flake8-quotes" = "*"
black = "==21.11b1"
flake8 = "==4.0.1"
pytest = "==6.2.5"
python-dotenv = "*"
"requests[socks]" = "*"

[requires]
python_version = "3.6"
python_version = "3.9"

[pipenv]
allow_prereleases = true
Loading

0 comments on commit c97cb05

Please sign in to comment.