This PR looks quite big since a lot of files have been touched but the changes are all related to usability and moving to Python 3 (apart from the initial performance improvement mentioned below). I think it's worth getting these changes in before moving onto the automated testing / refactoring since they'll benefit of the next stages of development.
Future PRs will be much smaller I promise!
Changes included in this PR are:
Upgraded to python 3.10.
Using venv and pip for environment management rather than anaconda.
Use the logging library rather than print statements. There are two log handlers: a file (writes to pylesa.log) and a console logger which writes to the terminal (e.g. like print).
Deleted lots of commented out print statements and code. Suggest using LOG.debug in the future rather than print to make it easy to switch these on\off if it's important to have them. These can always be retrieved using git. I'm using vscode for dev work which makes it easy to run a python debugger (assuming that's what the print statements were in there for).
Shuffled files around into a package / sub-packages for clarity. Changed the package name to pylesa (lowercase) to conform with PEP8 coding standards.
Moved the data directory into the pylesa package. This is more aligned with python coding standards and needs to be done if pylesa gets published as a package in the future, and still requires access to underlying data libraries.
Changed entry point. See README.md. Uses the typer library to auto generate a command line interface.
User defines the path to their chosen input file and a directory to write output to. This is more flexible and batch-run compatible than hard-coding the input/output directories and waiting for user input via terminal prompts.
Had a quick look at where the bulk of the runtime was being spent running the input "WWHC_FOC_WM.xlsx" using cProfile / snakeviz. Made a small change to the hot_water_tank.py file by caching specific heat values, which reduced the 15min runtime to about 6min.
I've checked that the a few of the results in the KPI output CSV files that are committed in the repo (WWHC_FOC_WM) match outputs produced by the version of pylesa in this PR. The economic/technical/outputs csv values are within 0.5% of each other (apart from "local_RES_used" which is within 1%). I assume this difference is due to the move to python 3 and the resulting changes in all the imported libraries. Hard to dig any deeper into this given there isn't any proper testing yet.
Hope the changes seem reasonable.
I've set this PR to merge into master but happy to merge into a "develop" branch if you want to keep master clean for "released" versions.
Hi @andrewlyden,
This PR looks quite big since a lot of files have been touched but the changes are all related to usability and moving to Python 3 (apart from the initial performance improvement mentioned below). I think it's worth getting these changes in before moving onto the automated testing / refactoring since they'll benefit of the next stages of development.
Future PRs will be much smaller I promise!
Changes included in this PR are:
pylesa
(lowercase) to conform with PEP8 coding standards.typer
library to auto generate a command line interface.hot_water_tank.py
file by caching specific heat values, which reduced the 15min runtime to about 6min.I've checked that the a few of the results in the KPI output CSV files that are committed in the repo (WWHC_FOC_WM) match outputs produced by the version of pylesa in this PR. The economic/technical/outputs csv values are within 0.5% of each other (apart from "local_RES_used" which is within 1%). I assume this difference is due to the move to python 3 and the resulting changes in all the imported libraries. Hard to dig any deeper into this given there isn't any proper testing yet.
Hope the changes seem reasonable.
I've set this PR to merge into master but happy to merge into a "develop" branch if you want to keep master clean for "released" versions.
Thanks,
Ben