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.
In order to make changes to napari-metadata, 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-metadata.git
cd napari-metadataSet the upstream remote to the base napari-metadata repository:
git remote add upstream https://github.com/napari/napari-metadata.gitInstall the package in editable mode, along with all of the developer tools
using uv:
uv pip install -e . --group devOr equivalently with pip:
pip install -e . --group devWe use pre-commit hooks to format and lint code automatically prior to each
commit. The hooks are configured in .pre-commit-config.yaml and run ruff
for formatting and linting, among other checks.
We recommend using prek, a faster
drop-in replacement for pre-commit written in Rust with no Python runtime
dependency. prek is included with the development dependencies.
Register the git hooks with:
prek installUpon committing, your code will be formatted and linted according to our
ruff configuration.
To learn more, see ruff's documentation.
You can run all hooks against the entire codebase at any time:
prek run --all-filesIf 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.
Create a new feature branch:
git checkout main -b your-branch-namegit will automatically detect changes to a repository.
You can view them with:
git statusAdd and commit your changed files:
git add my-file-or-directory
git commit -m "my message"We use unit tests to ensure that napari-metadata works as intended. Writing tests for new code is a critical part of keeping napari-metadata maintainable as it grows.
Run tests using tox (which uses uv under the hood via tox-uv):
uvx --with tox-gh-actions toxOr run pytest directly after installing development dependencies:
pytestEach 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.
Switch to the main branch:
git checkout mainFetch changes and update main:
git pull upstream main --tagsThis is shorthand for:
git fetch upstream main --tags
git merge upstream/mainUpdate your other branches:
git checkout your-branch-name
git merge mainUpdate your remote branch:
git push -u origin your-branch-nameYou can then make a pull-request to napari-metadata's main branch.
Install pixi, then from the project root:
pixi run docs-buildThe docs will be built at docs/_build.
Most web browsers will also allow you to preview HTML pages directly.
Try entering file:///absolute/path/to/napari-metadata/docs/_build/index.html in your address bar.
You can preview with a live-reloading server that opens automatically:
pixi run docs-livenapari has a Code of Conduct that should be honored by everyone who participates in the napari community, including napari-metadata.
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.