AIMLAC Coding Challenge
Currently, only building and installing from source is available.
The conda environment is defined in environment.yml
conda env create ./environment.yml
sjautobidder
environment.conda activate sjautobidder
conda env remove -n envname
For details about the frontend, see webpage/README.md
This would be used for deployment, but does not have a use while developing. Infact, installing the module might break testing with conflicted imported modules.
"conda activate sjautobidder;",
"python -m build .;",
# Optionally install with pip. --force-reinstall ensures it is installed
# even if the version has not been bumped.
"python -m pip install .\\dist\\sjautobidder-0.0.1-py3-none-any.whl --force-reinstall",
The distributable module is outputted to the dist/
folder, in both
pip-installable .whl
format and as a compressed .tar.gz
folder.
To start the docker container, make sure you have run the steps under Installing the package, then navigate to the root of the project and run:
docker build -t codingchallenge .
docker run -dp 80:80 codingchallenge
To lint the project:
conda activate sjautobidder
prospector . -s high
pydocstyle
To test the project:
conda activate sjautobidder
pytest .
To generate a coverage report:
For a terminal coverage report:
Use pytest . --cov-report term --cov=sjautobidder tests/
----------- coverage: platform win32, python 3.8.8-final-0 -----------
Name Stmts Miss Cover
----------------------------------------------------------------------
sjautobidder\building_demand\__init__.py 0 0 100%
sjautobidder\building_demand\energy_demand.py 31 13 58%
sjautobidder\building_demand\energy_utils.py 24 0 100%
sjautobidder\met_office_api\__init__.py 0 0 100%
sjautobidder\met_office_api\api_interpolation.py 11 11 0%
sjautobidder\met_office_api\api_utils.py 114 114 0%
sjautobidder\solar_power\__init__.py 0 0 100%
sjautobidder\solar_power\solar_power.py 44 44 0%
sjautobidder\solar_power\solar_utils.py 27 18 33%
----------------------------------------------------------------------
TOTAL 251 200 20%
To generate a cov.xml for IDE extensions:
pytest --cov-report xml:cov.xml --cov=sjautobidder tests/
When committing code that may effect more than just your owned files, please open a pull request instead and tag the writer of the code you changed.
We use black as our formatting guide, and is recommended you run the formatter on your code before committing.
For doc comments, each function must be commented alongside a top-level module comment. The standard we have adopted is the Google Standard. Note that incorrect docs will be picked up as the linter and reported as errors. Please run the linter before committing!
Github actions will run pytest and linting on pull requests and commits, so pleasure be sure that your code conforms!