jwst is an open source package written in Python.
The source code is available in the JWST Github repository.
New contributions and contributors are very welcome!
Do not hesitate to reach out to the package maintainers if you are new to open-source development or if you have any questions/concerns.
We only ask that all contributors adhere to the Space Telescope Code of Conduct.
Tip
The jwst public API and deprecation policy is at https://jwst.readthedocs.io/en/latest/jwst/user_documentation/more_information.html#api-public-vs-private
If you have encountered a bug when running the pipeline, or wish to request a new feature, open an issue or contact the JWST Help Desk.
Tip
If you are new to GitHub, to git, or to version-control systems in general, refer to the GitHub tutorial and / or to the git reference manual.
To suggest a specific code change, or to contribute new code:
-
Clone your fork to your local machine:
git clone https://github.com/YOUR_USERNAME/jwst cd jwst/ -
Add the
upstreamrepository, as a remote, to your local clone:git remote add upstream https://github.com/spacetelescope/jwst
Tip
When making changes, create a new "branch" for each new feature or bug fix.
We recommend naming your new branch something like feature/cool_new_feature, fix/thing_that_was_fixed, docs/updated_description_of_feature, etc:
git fetch upstream --tags
git checkout upstream/main -b docs/update_contributing_instructions- Install
pre-committo automatically check your changes for formatting issues:pip install pre-commit pre-commit install
Tip
To run pre-commit checks manually, do pre-commit run --all.
- Install
jwstto your development environment. - Make your changes using your editor of choice.
- Commit and push your changes to your fork as a new branch:
The
git add changed_file.py git commit -m "description of changes" git pushgitreference manual has details on what these commands do. - Open a new Pull Request requesting that your changes be merged into the
mainbranch of this repository. - Ensure that your change passes automated testing (see
TESTING.mdfor details). - Complete the items in the Tasks checklist (created when you open the pull request) to the best of your ability.
Once your pull request is created, it will need to be reviewed and approved by the code maintainer team. They may require changes from you before your code can be merged, in which case go back and make those changes, run tests again, and push the changes to the branch you made earlier.
As jwst is constantly evolving, you will often encounter the situation where you've made changes to your branch, but in that time there are new commits on upstream/main from other developers.
Incorporate those changes into your branch, either automatically with the button on the GitHub pull request webpage, or manually with git rebase.
Usually, GitHub can rebase a branch automatically. If you see "This branch is out-of-date with the base branch", you will have the option to "Update with merge commit" or "Update with rebase". Updating with a merge commit is usually safer.
However, if the changes to main touch the same lines as your changes, you will see "This branch has conflicts that must be resolved". You will need to manually resolve these conflicts yourself; follow the steps described on the page.
Rebase your current branch onto upstream/main to apply any new changes on top of yours:
git fetch --all
git rebase -i upstream/mainFor more information on how to use git rebase, see the git rebase documentation or Atlassian's tutorial on rebasing.
Once you've completed your rebase, you will need to "force push" your branch to overwrite your branch on GitHub:
git push -u origin -f feature/cool_new_featureWhen developing jwst (or any other Python package), you should install the package locally to a development environment.
Tip
Python "environments" are isolated Python installations, confined to a single directory, where you can install packages, dependencies, and tools without cluttering your system Python libraries.
You can create a development environment with mamba / conda:
mamba create -n jwst_dev_env python=3.13
mamba activate jwst_dev_env
pip install -e .
hx .Breaking down what these lines do:
- Create a new empty environment called
jwst_dev_env:mamba create -n jwst_dev_env python=3.13
- "Activate" the environment (change shell variables in the current session to point to the isolated Python installation):
mamba activate jwst_dev_env
- Install the local package (
jwst) to your environment in "editable mode", so that any code changes will be instantly reflected in the installed package (useful for testing):pip install -e . - Run your editor of choice (in this example I use Helix
hx):hx .
If you need to make a change in jwst that requires a simultaneous change to one of its dependencies (stcal, stdatamodels, stpipe, etc.), also install that dependency from your local machine to your development environment.
For instance, assuming you've cloned the source code for both jwst and stcal, you can do the following from the jwst/ directory:
cd jwst/
pip install -e .
pip install -e ../stcalTip
It might be easier to use a separate Python environment (mamba / conda, virtualenv, uv, etc.) for this work:
mamba create -n jwst_stcal_dev_env python=3.13
mamba activate jwst_stcal_dev_envSince we do not use a single repository (sometimes called a "monorepo") for these coupled packages, when making a change like this, you will need to make two pull requests: one in the jwst repository, and one in the dependency's repository.
However, unit tests will not automatically pass because the pyproject.toml file in jwst points to the last released version of stcal, which does not incorporate your changes.
To resolve this (temporarily, for testing) modify the pyproject.toml files in jwst to point to your branch, to demonstrate that unit tests pass.
# jwst/pyproject.toml
[project]
...
dependencies = [
...
"stcal @ git+https://github.com/YOUR_USERNAME/stcal.git@YOUR_BRANCH",
...
]Warning
REMEMBER TO REVERT THE CHANGES TO pyproject.toml BEFORE YOUR BRANCH IS MERGED INTO main.
We use pre-commit to enforce uniform code style and standards.
pip install pre-commit
pre-commit runYou can also install pre-commit locally, to run checks before every git commit action:
pre-commit installThe full configuration for pre-commit checks can be found in .pre-commit-config.yaml.
The code style for the jwst repository generally conforms to PEP8, enforced using ruff.
ruff will automatically pick up the appropriate configuration from .ruff.toml and perform only the checks that are turned on for our repository.
Docstrings in jwst conform to the Numpy style guide, enforced with numpydoc-validation.
We use Codespell to check for common misspellings in both our codebase and documentation.
The majority of the jwst repository does not have type hints, and type hints are not required for contributions. If type hints are used, though, their compliance with PEP-484 is enforced with mypy.
See docs/README.md for instructions.