-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: add flake8 and fix warnings #79
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Lint | ||
|
||
on: push | ||
|
||
jobs: | ||
formatting: | ||
if: "!contains(github.event.head_commit.message, 'skip_ci')" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- run: python -m pip install --upgrade tox | ||
- run: tox -e checkformatting | ||
flake8: | ||
if: "!contains(github.event.head_commit.message, 'skip_ci')" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- run: python -m pip install --upgrade tox | ||
- run: tox -e flake8 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Pytest | ||
|
||
on: push | ||
|
||
jobs: | ||
test: | ||
if: "!contains(github.event.head_commit.message, 'skip_ci')" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [3.6, 3.7, 3.8] | ||
|
||
name: Python ${{ matrix.python-version }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- run: python -m pip install --upgrade pip tox | ||
- run: tox -e pytest |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
from io import StringIO | ||
|
||
import numpy as np | ||
import pandas as pd | ||
import pytest | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
h5py>=2.9.0 | ||
ipython>=7.0 | ||
julia>=0.5.1 | ||
numpy>=1.16.0 | ||
pandas>=0.25.3 | ||
scipy>=1.2 | ||
tqdm>=4.29.1 | ||
h5py~=2.10.0 | ||
ipython~=7.0 | ||
julia~=0.5.1 | ||
numpy~=1.18.5 | ||
pandas~=1.1.3 | ||
scipy~=1.2 | ||
tqdm~=4.29.1 | ||
pytest~=6.1.1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[tox] | ||
envlist = pytest, format, flake8 | ||
skipsdist = true | ||
|
||
[testenv] | ||
deps = | ||
pytest: -rrequirements.txt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is actually right (otherwise I'd expect pytest to fail) - docs here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whoa! TIL. |
||
{format,checkformatting}: black | ||
{format,checkformatting}: isort | ||
flake8: flake8 | ||
changedir = pyreisejl | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most of this file was copied from powersimdata but I added the |
||
commands = | ||
pytest: pytest | ||
format: black . | ||
format: isort -m 3 --tc . | ||
checkformatting: black . --check --diff | ||
checkformatting: isort -m 3 --tc --check --diff . | ||
flake8: flake8 | ||
|
||
[flake8] | ||
ignore = E501,E731 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have an easy way to test this but I believe we reference this here (currently L88, below).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you're right. This is an artifact of our previous load shedding strategy: on any infeasible interval, shed 5% of the original demand for that interval and re-run (as many times as necessary), so that a string of
interval_num:shed_amount_...
is enough to specify all load shedding details.Breakthrough-Energy/PowerSimData#219 is related to the need to improve the summarization of load shed results in the new more-flexible load shedding method.