Contribute to PlasmaPy

Contributing to PlasmaPy

There are numerous ways to contribute to PlasmaPy, including by providing code and documentation, suggesting and discussing ideas, submitting issues and bug reports, and engaging the broader plasma physics community.

Imposter syndrome disclaimer: We want your help. No, really.

There may be a little voice inside your head that is telling you that you're not ready to be an open source contributor; that your skills aren't nearly good enough to contribute. What could you possibly offer a project like this one?

We assure you - the little voice in your head is wrong. If you can write code at all, you can contribute code to open source. Contributing to open source projects is a fantastic way to advance one's coding skills. Writing perfect code isn't the measure of a good developer (that would disqualify all of us!); it's trying to create something, making mistakes, and learning from those mistakes. That's how we all improve, and we are happy to help others learn.

Being an open source contributor doesn't just mean writing code, either. You can help out by writing documentation, tests, or even giving feedback about the project (and yes - that includes giving feedback about the contribution process). Some of these contributions may be the most valuable to the project as a whole, because you're coming to the project with fresh eyes, so you can see the errors and assumptions that seasoned contributors have glossed over.

This disclaimer was originally written by Adrienne Lowe for a PyCon talk, and was adapted by yt in their README file based on its use in the README file for the MetPy project. It was then adapted by PlasmaPy.

Sharing ideas

There are several methods of communication that are being used in the early stages of PlasmaPy development:

Contributing code or documentation to PlasmaPy

If you see something you'd like to work on amongst our issues, start hacking away on that! However, please announce your intent first in the relevant issue to make sure there is no work duplication.

Please note that PlasmaPy has a Code of Conduct.

Issues marked by the community as help wanted mean just that - either they're good contributions for outsiders or there's an issue in the ongoing work that requires a second opinion. Please consider these first!

Preliminaries

Work on PlasmaPy is done via GitHub, so you'll need a (free) account. If you are new to git, helpful resources include documentation on git basics and an interactive git tutorial. You must also install git locally on your computer. We highly recommend getting familiar with git by going through these tutorials or a Software Carpentry workshop prior to making code contributions.

Forking and cloning PlasmaPy

After creating your GitHub account, go to the main repository and fork a copy of PlasmaPy to your account.

Next you must clone your fork to your computer. Go to the directory that will host your PlasmaPy directory, and run one of the following commands (after changing your-username to your username). If you would like to use HTTPS (which is the default and easier to set up), then run:

git clone https://github.com/your-username/PlasmaPy.git

SSH is a more secure option, but requires you to set up an SSH key beforehand. The equivalent SSH command is:

git clone git@github.com:your-username/PlasmaPy.git

After cloning, we must tell git where the development version of PlasmaPy is by running:

git remote add upstream git://github.com/PlasmaPy/PlasmaPy.git

To check on which remotes exist, run git remote -v. You should get something like this:

origin      git@github.com:namurphy/PlasmaPy.git (fetch)
origin      git@github.com:namurphy/PlasmaPy.git (push)
upstream    git@github.com:PlasmaPy/PlasmaPy.git (fetch)
upstream    git@github.com:PlasmaPy/PlasmaPy.git (push)

Branches, commits, and pull requests

Before making any changes, it is prudent to update your local repository with the most recent changes from the development repository:

git fetch upstream

Changes to PlasmaPy should be made using branches. It is usually best to avoid making changes on your master branch so that it can be kept consistent with the upstream repository. Instead we can create a new branch for the specific feature that you would like to work on:

git branch *your-new-feature*

Descriptive branch names such as grad-shafranov or adding-eigenfunction-poetry are helpful, while vague names like edits are considered harmful. After creating your branch locally, let your fork of PlasmaPy know about it by running:

git push --set-upstream origin *your-new-feature*

It is also useful to configure git so that only the branch you are working on gets pushed to GitHub:

git config --global push.default simple

Once you have set up your fork and created a branch, you are ready to make edits to PlasmaPy. Switch to your new branch by running:

git checkout *your-new-feature*

Go ahead and modify files with your favorite text editor. Be sure to include tests and documentation with any new functionality. We also recommend reading about best practices for scientific computing. PlasmaPy uses the PEP 8 style guide for Python code and the numpydoc format for docstrings to maintain consistency and readability. New contributors should not worry too much about precisely matching these styles when first submitting a pull request, as the PEP8 Speaks GitHub integration will check pull requests for PEP 8 compatibility, and further changes to the style can be suggested during code review.

You may periodically commit changes to your branch by running

git add filename.py
git commit -m "*brief description of changes*"

Committed changes may be pushed to the corresponding branch on your GitHub fork of PlasmaPy using

git push origin *your-new-feature* 

or, more simply,

git push

Once you have completed your changes and pushed them to the branch on GitHub, you are ready to make a pull request. Go to your fork of PlasmaPy in GitHub. Select "Compare and pull request". Add a descriptive title and some details about your changes. Then select "Create pull request". Other contributors will then have a chance to review the code and offer contructive suggestions. You can continue to edit the pull request by changing the corresponding branch on your PlasmaPy fork on GitHub. After a pull request is merged into the code, you may delete the branch you created for that pull request.