After creating a fork of the HPC Client repo and cloning it locally, perform the steps below in the command line.
- Install a python 3 environment (e.g., with
miniconda
). Python 3.8 is recommended. - Install pipenv in the source Python environment with
python -m pip install pipenv
- Change the directory with
cd src
- Install the pipenv developer virtual environment with
python -m pipenv install -d
- Activate the virtual environment with
You check the path to the python execute file with
pipenv shell
. It should print something like the following:which python
/Users/<user>/.local/share/virtualenvs/src_code-LEKyUmPy/bin/python
- Check that pytest was successfully installed by running pytest with and install pre-commit
cd .. pytest pre-commit install
If using Pycharm as your IDE, follow these additional instructions to reference the python environment you just created.
- Update interpreter.
- Copy path to python executable you printed with
which python
. - Go to
Settings -> Project -> Python Interpreter -> Settings Gear Icon -> Add... -> Virtualenv Environment -> Existing Environment -> ...
- Paste the python executable path in the folders textbox.
- Click
OK -> OK
to apply settings.
- Copy path to python executable you printed with
- Set source root so that module references work correctly.
- Go to
Settings -> Project -> Project Structure
- Click
src
folder. Near the top, mark asSources
folder. Click OK.
- Go to
This gear uses pipenv
to manage dependencies and
develop.
Dependencies are listed in the src/Pipfile
.
After activating the shel environment, you can use the commands below to manage packages.
To use these commands, the working directory should be src
(i.e., cd src
).
- Adding: Use
pipenv install <package_name> [-d]
(optional:-d
is for dev) - Removing: Use
pipenv uninstall <package_name> [-d]
- Updating: Use
pipenv update <package_name>
orpipenv update
to update all deps.- Update dry run:
--dry-run
- Update dry run:
Local linting and testing scripts are managed through
pre-commit
. Pre-commit allows running hooks which
can be defined locally, or in other repositories. Default hooks to run on each
commit:
- flake8: Style guide enforcement
- pytest: Runs pytest and requires coverage
These hooks will all run automatically on commit, but can also be run manually or just be disabled.
- Run hooks manually:
- Run on all files:
pre-commit run -a
- Run on certain files:
pre-commit run --files test/*
- Run on all files:
- Update (e.g. clean and install) hooks:
pre-commit clean && pre-commit install
- Disable all hooks:
pre-commit uninstall
- Enable all hooks:
pre-commit install
- Skip a hook on commit:
SKIP=<hook-name> git commit
- Skip all hooks on commit:
git commit --no-verify
Every contribution should be associated with a ticket on the GEAR JIRA board, or be a
hotfix (for Flywheel internal development). You should contribute by creating a branch
titled with either hotfix-<hotfix_name
or GEAR-<gear_num>-<description>
. For now,
other branch names will be accepted, but soon branch names will be rejected if they
don't follow this pattern.
After pushing local changes to your forked repo, you can create a pull request back to the HPC Client repo through the github UI.
The merge request should contain at least two things:
- Your relevant change
- Update the corresponding entry under
docs/release_notes.md
Adding the release notes does two things:
- It makes it easier for the reviewer to identify what relevant changes they should expect and look for in the MR, and
- It makes it easier to create a release.
For example, if the cocde is currently on version 0.2.1
and you are working on a
bugfix under the branch GEAR-999-my-bugfix. When you create a merge request against
main
, you should add a section to doc/release_notes.md
such as the following:
## 0.2.2
__FIX__:
* Fixed my-bug, see [GEAR-999](https://flywheelio.atlassian.net/browse/GEAR-999)
Where the rest of the file contains release notes for previous versions.