Skip to content

Commit

Permalink
electricitymap-contrib Poetry package (#2971)
Browse files Browse the repository at this point in the history
* Move poetry scaffolding to root

* Move parsers to Poetry

* Move linting and unit tests to Poetry

* Update labeler action

* Ensure that script.py fails with exit code

* Add temporary requirements.txt file
  • Loading branch information
skovhus authored Feb 5, 2021
1 parent 29ed888 commit 5f2d938
Show file tree
Hide file tree
Showing 17 changed files with 1,141 additions and 246 deletions.
25 changes: 11 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,26 @@ jobs:
steps:
- checkout
- restore_cache:
key: pip-{{ .Branch }}-{{ checksum "parsers/requirements.txt" }}
key: venv-{{ checksum "poetry.lock" }}
- run:
name: Upgrade pip
command: sudo pip install -q --upgrade pip
- run:
name: Install dependencies
command: |
set -eux -o pipefail
python --version
pip -v --version
sudo pip install --progress-bar=off -q flake8 pylint==2.4.4
sudo apt-get install libxml2-dev tesseract-ocr tesseract-ocr-eng
sudo pip install --progress-bar=off -q -r parsers/requirements.txt
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
pylint -E parsers/*.py -d unsubscriptable-object,unsupported-assignment-operation,unpacking-non-sequence
python -m unittest discover parsers/test
cd config && poetry install && poetry run test && poetry run lint
poetry install -E parsers
- run:
name: Verify changes
command: |
set -eux -o pipefail
poetry run lint
poetry run test
- save_cache:
key: pip-{{ .Branch }}-{{ checksum "parsers/requirements.txt" }}
key: venv-{{ checksum "poetry.lock" }}
paths:
- "~/.cache/pip"
- ".venv"

lint_json:
docker:
Expand Down
3 changes: 2 additions & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dependencies:
- .**/requirements.txt
- poetry.lock
- pyproject.toml

frontend 🎨:
- web/src/**/*
Expand Down
File renamed without changes.
190 changes: 0 additions & 190 deletions config/poetry.lock

This file was deleted.

23 changes: 0 additions & 23 deletions config/pyproject.toml

This file was deleted.

16 changes: 0 additions & 16 deletions config/scripts.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import json
from pathlib import Path

CONFIG_DIR = Path(__file__).parent.parent.parent.parent.resolve()
CONFIG_DIR = Path(__file__).parent.parent.parent.parent.joinpath('config').resolve()

# Prepare zone bounding boxes
ZONE_BOUNDING_BOXES = {}
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions electricitymap/contrib/parsers
2 changes: 2 additions & 0 deletions parsers/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# NOTE: this file is being deprecated! Please switch to use Poetry instead and
# update the pyproject.toml instead
arrow==0.16.0
beautifulsoup4==4.6.0
click==6.7
Expand Down
Loading

0 comments on commit 5f2d938

Please sign in to comment.