Contributing to stellarphot#
Installation for one-time testing#
If you are testing a pre-release version of stellarphot we recommend setting up a virtual environment and installing stellarphot in this environment.
Only use one of the methods below for making a virtual environment.
Creating an environment with conda or mamba (use whichever one you have installed):
mamba create -n stellarphot-test python=3.11
mamba activate stellarphot-test
pip install git+https://github.com/mwcraig/stellarphot.git@update-docs
Creating an environment with virtualenv:
python3 -m venv stellarphot-test
source stellarphot-test/bin/activate
pip install git+https://github.com/mwcraig/stellarphot.git@update-docs
Setup#
These steps typically only need to be done once.
To setup
stellarphotfor development, first create your own copy in GitHub by forking the repository.Clone your fork to your local machine.
Add the main
stellarphotrepository as a remote calledupstream.
Make a development environment#
These steps typically only need to be done once. If something goes wrong with the dev environment, you may need to delete it and start over.
Create a new conda environment for
stellarphot. You can call it whatever you want. For example, you might call itstellarphot-dev. The command to create the environment would be:# The couple of packages listed below take care of some dependencies # that would otherwise need to be compiled. mamba create -n stellarphot-dev python=3.11 ccdproc batman-package
Activate the environment:
mamba activate stellarphot-dev
Change directory into the folder with your clone of
stellarphot. Installstellarphotin development mode with the dependencies needed for testing:pip install -e .[test]
Install the pre-commit hooks – these are checks run before every commit:
pre-commit install
Steps when Contributing#
These typically need to be done every time you make a contribution.
Create a new branch for your contribution that is based on the branch
upstream/main. Give the branch a descriptive name. For example, if you are adding a new feature, you might call the branchadd-new-feature. These git command to do this would begit checkout -b add-new-feature upstream/main.Write a test for your contribution. This should be a new test in the appropriate
testsdirectory. If you are adding a new feature, you should add a new test file. If you are fixing a bug, you should add a new test to an existing test file. The test should be written using thepytestframework. See thetestsdirectories for examples. Make sure your test fails before you make your contribution.Make your contribution. This could be a new feature, a bug fix, or a documentation update. Make sure your test passes after you make your contribution.
Commit your contribution to your branch. Your commit message should be short but descriptive. For example, if you are adding a new feature, you might use a commit message like
Add new feature to do X.Push your branch to your fork on GitHub.
Create a pull request from your branch to the
mainbranch of the mainstellarphotrepository. Give the pull request a descriptive name and description. If your pull request fixes an issue, reference the issue in the description using the#symbol. For example, if your pull request fixes issue 123, you would writeFixes #123in the description.Wait for your pull request to be reviewed. If there are any issues, you may need to make additional commits to your branch to address them. If you need to make additional commits, make sure you push them to your fork on GitHub. The pull request will be updated automatically.