-
Notifications
You must be signed in to change notification settings - Fork 34
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
Do not run Python code in top-level of modules #35
Comments
We should try to get a list of such files, possibly using pylint? |
@dangunter, says he'll look into trying |
There is a test to do this in a PR in the idaes-pse (main IDAES) repo, although that one may take a while to get merged since there seem to be some opinions on how to do it: IDAES/idaes-pse#396 |
@jghouse88 will look into, at least for the thermal_oil/discharge_heat_exchanger.py file, moving this into a separate test. |
is this an issue. The file dispatches/models/fossil_case/thermal_oil/discharge_heat_exchanger.py doesn't exist in current branches or the main file tree. At least not that I see. It points to an old branch for this model. |
The original file To ensure that the DISPATCHES codebase is checked to avoid similar issues going forward, we're finalizing a tool to systematically run and analyze module imports, which will be integrated with the pytest test suite and run as part of the CI checks. |
Bumping the priority down until after the upcoming internal release. Until we have an an automatic way to check for this, we can perform this check "manually" when reviewing a PR to make sure that only expected code (imports, functions/classes/constants definition) is executed at import time. |
Modules like dispatches/models/fossil_case/thermal_oil/discharge_heat_exchanger.py will run code on import. This is generally accepted as bad practice, and can break many different things.
EDIT @lbianchi-lbl Jul 19: added list
List of files where this happens (feel free to add or check off items if they change):
dispatches/models/fossil_case/thermal_oil/discharge_heat_exchanger.py
The text was updated successfully, but these errors were encountered: