Getting Started to Contribute
Getting Started Guide for Contributors¶
Ready to contribute? Here's how to set up CoastSeg for local development. This guide will walk you through the installation process, testing procedures, and best practices for contributing to CoastSeg.
- Make a Fork
Click the fork
button located at the top right of the coastseg repository. This will create a fork copy of the coastseg repository that you can edit on your GitHub account. Learn How to Fork from GitHub Docs
-
Clone your fork locally:
-
git clone your fork of coastseg onto your local computer
1
git clone https://github.com/your-username/CoastSeg.git
-
Create an Anaconda Environment for CoastSeg Development
-
We will install the CoastSeg package and its development dependencies in this environment.
1 |
|
- Activate the Conda Environment
1 |
|
-
Change Directory to the CoastSeg
-
Go to the location where CoastSeg was installed on your computer.
cd <directory where you have coastseg source code installed>
Example:cd c:\users\CoastSeg
1
cd CoastSeg
-
Install CoastSeg locally as a pip editable installation
1
pip install -e .
-
This command reads the required dependencies from CoastSeg's
pyproject.toml
file and installs them within your anaconda environment. - Make sure to run this command in the
CoastSeg
directory that contains thepyproject.toml
file otherwise this command will fail because pip won't find thepyproject.toml
file -e
means create an editable install of the package. This will add the files to the python path on your computer making it possible to find the sub directories of the package.See the official documentation.-
.
means use the current working directory to install -
Install Geopandas and JupyterLab Locally
1 |
|
-
Install the Development Dependencies
1
pip install build pytest black
-
black
is a python formater that you can run on the code -
pytest
is used to automatically run tests on the code -
Create a branch for local development:
1 |
|
Now you can make your changes locally.
-
When you're done making changes, use
pytest
to check that your changes pass the tests.1 2 3 4
conda activate coastseg_dev cd CoastSeg cd tests pytest .
-
Format the code using Black To make your code adhere to python style standards use the
black
code formatter to automatically format the code. You'll need to change directories to thesrc
directory, then to the sub directorycoastseg
and run theblack
here. If you were to runblack
in the main coastseg directory it would not format the code because the code for coastseg is located in directorycoastseg>src>coastseg
.
1 2 3 4 |
|
-
Commit your changes and push your branch to GitHub:
1
git add .
1
git commit -m "Your detailed description of your changes."
1
git push origin name-of-your-bugfix-or-feature
-
Submit a pull request through the GitHub website.