Skip to content

Commit

Permalink
Merged in feature/use-python3.8 (pull request #65)
Browse files Browse the repository at this point in the history
python 3.8 in CI and for development

* set CI pipeline to 3.8, recommend it for development

* upgrade black to 3.8

* better placement of some noqa statements

Approved-by: Felix Claessen
  • Loading branch information
nhoening committed Jul 7, 2020
1 parent 5132b9f commit 2fe9394
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ repos:
rev: stable
hooks:
- id: black
language_version: python3.6
language_version: python3.8
10 changes: 5 additions & 5 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Its purpose is to offer these balancing actions as one aggregated service to ene

### Dependencies

* Make a virtual environment: `python3.6 -m venv bvp-venv` or use a different tool like `mkvirtualenv`. You can also use
an [Anaconda distribution](https://conda.io/docs/user-guide/tasks/manage-environments.html) as base with `conda create -n bvp-venv python=3.6`.
* Make a virtual environment: `python3.8 -m venv bvp-venv` or use a different tool like `mkvirtualenv`. You can also use
an [Anaconda distribution](https://conda.io/docs/user-guide/tasks/manage-environments.html) as base with `conda create -n bvp-venv python=3.8`.
* Activate it, e.g.: `source bvp-venv/bin/activate`
* Install the `bvp` platform and dependencies:

Expand All @@ -32,7 +32,7 @@ Its purpose is to offer these balancing actions as one aggregated service to ene
* Set an env variable to indicate in which environment you are operating (one out of development|testing|staging|production), e.g.:

`echo "FLASK_ENV=development" >> .env`

`export FLASK_ENV=production`
* If you need to customise settings, create `bvp/<development|testing|staging|production>_config.py` and add required settings.
If you're unsure what you need, just continue for now and the app will tell you what it misses.
Expand All @@ -54,7 +54,7 @@ Its purpose is to offer these balancing actions as one aggregated service to ene
If you have a SQL Dump file, you can load that:

psql -U {user_name} -h {host_name} -d {database_name} -f {file_path}

Else, you can populate some standard data, most of which comes from files:

* For meta data, ask someone for `raw_data/assets.json`
Expand Down Expand Up @@ -112,7 +112,7 @@ More information (e.g. for installing on Windows) on [the website](https://proje
Now, to start the web application, you can run:

python bvp/run-local.py

Note that in a production context, you'd not run a script but hand the `app` object to a WSGI process.


Expand Down
8 changes: 4 additions & 4 deletions bitbucket-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ pipelines:
default:
- step:
name: Lint by Flake8
image: python:3.6
image: python:3.8
script:
- pip install flake8-bugbear flake8
- flake8 bvp
- step:
name: Build and Test
image: python:3.6
image: python:3.8
caches:
- pip
script:
Expand All @@ -23,7 +23,7 @@ pipelines:
master:
- step:
name: Build and Test
image: python:3.6
image: python:3.8
script:
- ci/SETUP.sh
- apt-get update
Expand All @@ -48,4 +48,4 @@ definitions:
POSTGRES_DB: a1test
POSTGRES_USER: a1test
POSTGRES_PASSWORD: a1test
DATABASE_URL: postgres://a1test:a1test@127.0.0.1:5432/a1test
DATABASE_URL: postgres://a1test:a1test@127.0.0.1:5432/a1test
4 changes: 2 additions & 2 deletions bvp/api/v1_1/implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ def post_price_data_response(
return already_received_and_successfully_processed()


@type_accepted("PostWeatherDataRequest") # noqa: C901
@type_accepted("PostWeatherDataRequest")
@unit_required
@assets_required("sensor")
@optional_horizon_accepted()
@values_required
@period_required
@resolutions_accepted(timedelta(minutes=15))
def post_weather_data_response(
def post_weather_data_response( # noqa: C901
unit,
generic_asset_name_groups,
horizon,
Expand Down
4 changes: 2 additions & 2 deletions bvp/api/v1_2/implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ def get_device_message_response(generic_asset_name_groups, duration):
return dict(**response, **d), s


@usef_roles_accepted("Prosumer") # noqa: C901
@usef_roles_accepted("Prosumer")
@type_accepted("PostUdiEventRequest")
@units_accepted("State of charge", "kWh", "MWh")
@as_json
def post_udi_event_response(unit):
def post_udi_event_response(unit): # noqa: C901

if not has_assets():
current_app.logger.info("User doesn't seem to have any assets.")
Expand Down
4 changes: 2 additions & 2 deletions bvp/data/scripts/static_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,8 @@ def populate_time_series_data(
click.echo("DB now has %d Weather Measurements" % db.session.query(Weather).count())


@as_transaction # noqa: C901
def populate_time_series_forecasts(
@as_transaction
def populate_time_series_forecasts( # noqa: C901
db: SQLAlchemy,
test_data_set: bool,
generic_asset_type: str = None,
Expand Down
4 changes: 2 additions & 2 deletions bvp/ui/views/portfolio.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
from bvp.ui.utils.view_utils import render_bvp_template


@bvp_ui.route("/portfolio", methods=["GET", "POST"]) # noqa: C901
@bvp_ui.route("/portfolio", methods=["GET", "POST"])
@roles_accepted("admin", "Prosumer")
def portfolio_view():
def portfolio_view(): # noqa: C901
""" Portfolio view.
By default, this page shows live results (production, consumption and market data) from the user's portfolio.
Time windows for which the platform has identified upcoming balancing opportunities are highlighted.
Expand Down

0 comments on commit 2fe9394

Please sign in to comment.