Contribute¶
Please contribute to the ASSET Lab Resource Adequacy Package! The guidelines below are intended for contributors with a wide range of open-source development experience.
Setup¶
Setup GitHub Authentication. Either:
Fork
assetraon GitHub.This creates your own version of the
assetrarepository. You will make changes to your fork and submit them for review to be added to the mainassetrarepository.
Clone your Fork Locally.
Navitage to the directory where you would like your clone to live.:
git clone https://github.com/<your username>/assetra.git
Setup Poetry
Poetry is used to (1) manage virtual environments used to test development code, (2) maintain the
pyproject.tomlfile which defines package dependencies to be installed withassetraby end-users, and (3) automate the process of building theassetrapackage and publishing to pypi. When a contributor updates their environment (i.e. they install new or upgrade existing dependencies that need to be shipped withassetra), they should commit their modifications to thepyproject.tomlandpoetry.lockfiles. Other contributors should then runpoetry installto remain in sync.
Install pipx:
python3 -m pip install pipx
Install Poetry:
pipx install poetry
Create a Virtual Environment:
python3 -m venv env
Activate the Virtual Environment:
source env/bin/activate # linux env/Scripts/activate # windows
Install Dependencies:
poetry install
Test Installation:
poetry run python -m unittest
Contributor Workflow¶
Identify an existing issue or open a new one in GitHub.
Create a branch in your fork to work on your contributions.
Modify files. Follow these guidelines when contributing:
For every function added or modified:
Add at least one unit test.
For every new EnergyUnit added:
usage.rstAdd an example in the
examplesfolder. Include all data needed to run a working example, but be mindful of the file sizes.Update
docs/reference.rstto help others understand what you are modeling and what assumptions you make in your implementation.
Run all unit tests. Ensure they run successfully.
poetry run python -m unittest
Commit changes:
git status # show files modified git add <files> # space-separated list of files modified to be committed. git commit # will open a text editor for you to describe your changes.
Push local changes back to your fork on GitHub:
git push
Open a pull request to
ijbd/assetrato submit your modifications for review.
Reviewer Workflow¶
Review code modifications.
Review new/modified unit tests.
Review new/modified examples.
Run all unit tests.
Run new/modified examples.
Request changes, if needed.
Confirm pull request will close relevant issues.
Accept the pull request.
Release the new code:
Bump the code version in
assetra/__init__.pyandpyproject.toml. Commit these changes.Build the package:
poetry build
Publish package to pypi (requires pypi token):
poetry publish --build