Contributing to SNEWPY

Development of SNEWPY happens in our repository on GitHub. If you already use GitHub, everything works as you’re used to; if you don’t, check out GitHub’s documentation if anything in this section is unclear.

Feedback or Problems

The best way to give feedback, request features or report problems is to open an issue.

Contribute Code or Documentation

Your contributions to SNEWPY are welcome!

To contribute, please create your own fork of the SNEWPY repository [1], then clone it:

git clone git@github.com:<YOUR-USERNAME>/snewpy.git
cd snewpy/

Next, make your changes and try them out. Where relevant, run tests or build documentation as described in the following subsections. Once you’re happy with your changes, please create a pull request. If you plan larger changes, it’s probably a good idea to open an issue first to coordinate our work.

Running Tests

SNEWPY uses the pytest package for automated testing. First, to install the necessary packages, use:

pip install ".[dev]"

You can then run the tests using the

pytest

command in the SNEWPY root directory. To skip integration tests which depend on SNOwGLoBES (or to run only those tests) you can use one of:

pytest -m 'snowglobes'  # only run tests that depend on SNOwGLoBES
pytest -m 'not snowglobes'

Normally, integration tests use the release version of SNOwGLoBES that was installed as a dependency of SNEWPY. To use custom data files, set the $SNOWGLOBES environment variable to the path of your SNOwGLoBES directory.

Building Documentation

SNEWPY uses Sphinx for documentation. See the Sphinx website for an overview over the markup syntax. First, to install the necessary packages, use:

pip install ".[docs]"
cd doc/

You can then build the documentation and view it in your browser:

make html
open build/index.html

Contribute Supernova Models

If you are a supernova modeler and want to allow us to use your models in SNEWPY, we are happy to hear from you! Please open an issue to discuss your contribution or simply submit a pull request with your model files.

Ideally, your pull request should include a customized SupernovaModel subclass to read in your model files. See the code of existing models for examples or let us know in your issue or pull request if you need help.

Footnotes