Contributing Guide#

We welcome your contributions! Please see the provided steps below and never hesitate to contact us.

If you are a new user, we recommend checking out the detailed Github Guides.

Setting up a development installation#

In order to make changes to napari-animation, you will need to fork the repository.

If you are not familiar with git, we recommend reading up on this guide.

Clone the forked repository to your local machine and change directories:

git clone https://github.com/your-username/napari-animation.git
cd napari-animation

Set the upstream remote to the base napari repository:

git remote add upstream https://github.com/napari/napari-animation.git

Install the package in editable mode, along with all of the developer tools

pip install -r requirements.txt

We use pre-commit to sort imports with isort, format code with black, and lint with flake8 automatically prior to each commit. To minmize test errors when submitting pull requests, please install pre-commit in your environment as follows:

pre-commit install

Upon committing, your code will be formatted according to our black configuration. To learn more, see black’s documentation.

Code will also be linted to enforce the stylistic and logistical rules specified in our flake8 configuration, which currently ignores E203, E501, W503 and C901. For information on any specific flake8 error code, see the Flake8 Rules. You may also wish to refer to the PEP 8 style guide.

If you wish to tell the linter to ignore a specific line use the # noqa comment along with the specific error code (e.g. import sys  # noqa: E402) but please do not ignore errors lightly.

Translations#

Starting with version 0.4.7, napari codebase include internationalization (i18n) and now offers the possibility of installing language packs, which provide localization (l10n) enabling the user interface to be displayed in different languages.

To learn more about the current languages that are in the process of translation, visit the language packs repository

To make your code translatable (localizable), please use the trans helper provided by the napari utilities.

from napari.utils.translations import trans

some_string = trans._("Localizable string")

To learn more, please see the translations guide.

Making changes#

Create a new feature branch:

git checkout master -b your-branch-name

git will automatically detect changes to a repository. You can view them with:

git status

Add and commit your changed files:

git add my-file-or-directory
git commit -m "my message"

Tests#

We use unit tests and integration tests to ensure that napari-animation works as intended. Writing tests for new code is a critical part of keeping napari-animation maintainable as it grows.

Check out the dedicated documentation on testing over at napari.org that we recommend you read as you’re working on your first contribution.

Help us make sure it’s you#

Each commit you make must have a GitHub-registered email as the author. You can read more here.

To set it, use git config --global user.email your-address@example.com.

Keeping your branches up-to-date#

Switch to the main branch:

git checkout main

Fetch changes and update main:

git pull upstream main --tags

This is shorthand for:

git fetch upstream main --tags
git merge upstream/main

Update your other branches:

git checkout your-branch-name
git merge main

Sharing your changes#

Update your remote branch:

git push -u origin your-branch-name

You can then make a pull-request to napari-animation’s main branch.

Building the docs#

From the project root:

make docs

The docs will be built at docs/_build/html.

Most web browsers will allow you to preview HTML pages. Try entering file:///absolute/path/to/napari-animation/docs/_build/html/index.html in your address bar.

Code of conduct#

napari has a Code of Conduct that should be honored by everyone who participates in the napari community, including napari-animation.

Questions, comments, and feedback#

If you have questions, comments, suggestions for improvement, or any other inquiries regarding the project, feel free to open an issue.

Issues and pull-requests are written in Markdown. You can find a comprehensive guide here.