-
Notifications
You must be signed in to change notification settings - Fork 238
General Coding Standards
Andrew Lee edited this page Apr 6, 2022
·
3 revisions
The following general standards apply to all IDAES Code:
- All code in IDAES repositories must begin with the IDAES Copyright header.
- Code should follow PEP-8 Style Guide: https://www.python.org/dev/peps/pep-0008/.
black
andpylint
are used as part of the automated testing procedure and code must pass these test. Developers are strongly encouraged to usepylint
or another linter when developing code and to runblack
before commiting. - Docstrings should use Google style formatting: https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html.
- Commenting of code is strongly encouraged.
- Class and variable names should be descriptive, and use of Pyomo docstrings on all components is encouraged. Aliases may be used within the code to shorten long names (fully-qualified names of IDAES components end up being very long), but these should generally be descriptive as well.
- All code must be accompanied by documentation and tests. More details on the expectations for these is provided elsewhere in the testing standards.
- Set up pre-commit
- Run pytest with coverage report
- Run Pylint locally
- Update the Pyomo version
- Install Pyomo from a local Git clone
- Set up GitHub authentication with GCM
- Handle warnings in pytest