These instructions only need to be completed if you plan on developing new code for this project, but may also be used to run a local copy of the code.
This project uses a forking workflow. https://guides.github.com/activities/forking/
-
Fork this project on Github.
-
Clone your fork
git clone https://github.com/{YOUR_GITHUB_ACCOUNT}/geomag-algorithms.git cd geomag-algorithms git remote add upstream https://github.com/usgs/geomag-algorithms.git -
Use branches to develop new features and submit pull requests.
-
Using
pipenvhttps://pipenv.kennethreitz.org/en/latest/pyenvis also useful for installing specific/multiple versions of pythonpipenv install --dev pipenv shell -
Or, using Miniconda/Anaconda https://conda.io/miniconda.html
conda config --add channels conda-forge conda create --name geomagenv obspy pycurl black pre-commit pytest pytest-cov webtest conda activate geomagenv
This project uses The Black Code Style https://black.readthedocs.io/en/stable/the_black_code_style.html
-
Code Formatting
This project uses the
blackformatter, combined withpre-commit, to automatically format code before it is committed.VSCode ( https://code.visualstudio.com/ ), with the
Pythonextension, can be configured to automatically format usingblackwhen files are saved. TheFormatting Toggleextension is also useful.You can also manually format all files in the project by running
black . -
Unit tests
Run unit tests using PyTest
pytest -
Unit test coverage
pytest --cov=geomagio
-
Pulling new changes
When starting a new branch, or before putting in a pull request, make sure you have the latest changes from the
upstreamrepository.The local master branch should only be used for synchonization with the
upstreamrepository, and we recommend always using the--ff-onlyoption.git checkout master git pull --ff-only upstream master -
Rebase an existing branch
After downloading updates into the master branch, feature branches need to be rebased so they include any already merged changes.
git checkout FEATURE-BRANCH git rebase masterResolve any rebase conflicts. If you have already pushed this branch to your fork, you may need to force push because branch history has changed.