🎉 Thanks for taking the time to contribute! 🎉
The following is a set of guidelines for contributing to syrupy.
These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document.
What should I know before I get started?
This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code.
- Python typing and hints: typing
- Javascript snapshot testing jest
- Semantic versioning: semver
Before diving into writing code, please take a look at the following.
When attempting to fix a bug, create an issue using the "Bug report" template.
Give as much information in this issue as it allows for discussions and documentation about the decisions reached for any bugs that have been encounted.
Have an idea? Create an issue using the "Feature request" template.
Detailing in there as much as possible, the idea and any potential solutions to it, before suggesting a pull request.
Have an issue to submit code changes for? See below.
- Clone the repository
- Run
. script/bootstrap
to ensure you're working from the correct environment - Run
inv test
to verify enviroment is correctly setup - Checkout a new branch and add code changes
- Add tests to verify code changes and rerun
inv test
- See submitting pull requests
Creating a pull request uses our template using the GitHub web interface.
Fill in the relevant sections, clearly linking the issue the change is attemping to resolve.
debugpy
is installed in local development. A VSCode launch config is provided. Run inv test -v -d
to enable the debugger (-d
for debug). It'll then wait for you to attach your VSCode debugging client.
You can run inv benchmark
to run the full benchmark suite. Alternatively, write a test file, e.g.:
# test_performance.py
import pytest
import os
SIZE = int(os.environ.get("SIZE", 1000))
@pytest.mark.parametrize("x", range(SIZE))
def test_performance(x, snapshot):
assert x == snapshot
and then run:
SIZE=1000 python -m cProfile -s cumtime -m pytest test_performance.py --snapshot-update -s > profile.log
See the cProfile docs for metric sorting options.
Provide semantic commit messages following this convention. This informs the semantic versioning we use to control our releases.
A linter is available to catch most of our styling concerns. This is provided in a pre-commit hook when setting up local development.
You can also run inv lint --fix
to see and solve what issues it can.
pathlib
is the preferred library when dealing with path operations. Some documentation is available to help translate os.path
-type calls to pathlib
calls. Documentation on pathlib
's API is also available on the same page.
Please tag issues and pull requests according to the relevant github labels.