This page explains how you can contribute to the development of scikit-survival. There are a lot of ways you can contribute:
Writing new code, e.g. implementations of new algorithms, or examples.
Reviewing open pull requests.
scikit-survival is developed on GitHub using the Git version control system. The preferred way to contribute to scikit-survival is to fork the main repository on GitHub, then submit a pull request (PR).
Creating a fork¶
These are the steps you need to take to create a copy of the scikit-survival repository on your computer.
Create an account on GitHub if you do not already have one.
Clone your fork of the scikit-survival repository from your GitHub account to your local disk. You have to execute from the command line:
git clone --recurse-submodules firstname.lastname@example.org:YourLogin/scikit-survival.git cd scikit-survival
Setting up a Development Environment¶
After you created a copy of our main repository on GitHub, your need to setup a local development environment. We strongly recommend to use conda to create a separate virtual environment containing all dependencies. These are the steps you need to take.
Install conda for your operating system if you haven’t already.
Create a new environment, named
python ci/list-requirements.py requirements/dev.txt > dev-requirements.txt conda create -n sksurv -c sebp python=3 --file dev-requirements.txt
Activate the newly created environment:
conda activate sksurv
Compile the C/C++ extensions and install scikit-survival in development mode:
pip install --no-build-isolation -e .
Making Changes to the Code¶
For a pull request to be accepted, your changes must meet the below requirements.
All changes related to one feature must belong to one branch. Each branch must be self-contained, with a single new feature or bugfix. Create a new feature branch by executing:
git checkout -b my-new-feature
tox -e py38-flake8
Each function, class, method, and attribute needs to be documented using docstrings. scikit-survival conforms to the numpy docstring standard.
Code submissions must always include unit tests. We are using pytest. All tests must be part of the
testsdirectory. You can run the test suite locally by executing:
Tests will also be executed automatically once you submit a pull request.
The contributed code will be licensed under the GNU General Public License v3.0. If you did not write the code yourself, you must ensure the existing license is compatible and include the license information in the contributed files, or obtain a permission from the original author to relicense the contributed code.
Submitting a Pull Request¶
When you are done coding in your feature branch, add changed or new files:
git add path/to/modified_file
Create a commit message describing what you changed. Commit messages should be clear and concise. The first line should contain the subject of the commit and not exceed 80 characters in length. If necessary, add a blank line after the subject followed by a commit message body with more details:
Push the changes to GitHub:
git push -u origin my_feature
Building the Documentation¶
The documentation resides in the
doc/ folder and is written in
reStructuredText. HTML files of the documentation can be generated using Sphinx.
The easiest way to build the documentation is to install tox and run:
tox -e py38-docs
Generated files will be located in
doc/_build/html. To open the main page
of the documentation, run: