Skip to content

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.

  1. 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

image

  1. Clone your fork locally:

  2. git clone your fork of coastseg onto your local computer

    1
    git clone https://github.com/your-username/CoastSeg.git
    

  3. Create an Anaconda Environment for CoastSeg Development

  4. We will install the CoastSeg package and its development dependencies in this environment.

1
conda create --name coastseg_dev python=3.10 -y
  1. Activate the Conda Environment
1
conda activate coastseg_dev
  1. Change Directory to the CoastSeg

  2. 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
    

  3. Install CoastSeg locally as a pip editable installation

    1
    pip install -e .
    

  4. This command reads the required dependencies from CoastSeg's pyproject.toml file and installs them within your anaconda environment.

  5. Make sure to run this command in the CoastSeg directory that contains the pyproject.toml file otherwise this command will fail because pip won't find the pyproject.toml file
  6. -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.
  7. . means use the current working directory to install

  8. Install Geopandas and JupyterLab Locally

1
conda install -c conda-forge jupyterlab geopandas -y
  1. Install the Development Dependencies

    1
    pip install build pytest black
    

  2. black is a python formater that you can run on the code

  3. pytest is used to automatically run tests on the code

  4. Create a branch for local development:

1
git checkout -b name-of-your-bugfix-or-feature

Now you can make your changes locally.

  1. 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 .
    
  2. 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 the src directory, then to the sub directory coastseg and run the black here. If you were to run black in the main coastseg directory it would not format the code because the code for coastseg is located in directory coastseg>src>coastseg.

1
2
3
4
conda activate coastseg_dev
cd src
cd coastseg
black .
  1. 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
    
  2. Submit a pull request through the GitHub website.