We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
- Reporting a bug
- Discussing the current state of the code
- Submitting a fix
- Proposing new features
Pull requests are the best way to propose changes to the project. We actively welcome your pull requests.
- Fork the repo and create a new
branch from
master
. - If you've added code that should be tested, add tests.
- If you've changed APIs, update the documentation.
- Ensure the test suite passes.
- Issue that pull request!
Working on your first Pull Request? Here are a couple of resources to get you started:
- Github Help: Creating a pull request
- How to Contribute to an Open Source Project on GitHub
- The FirstTimersOnly Movement
- Avoid changes to the project's configuration or meta-data such as
- Version Information
- Packaging Configuration
- Testing / Deployment Configuration
- Try to avoid making large sets of changes if they could be broken into smaller ones. Instead, split them into separate pull requests.
While this project does not fully (probably not even partially) adhere to PEP8, the existing code-base does maintain a certain level of consistency. Please try to follow the style if possible. Don't worry about it too much though, there's no flakes or lint here.
- 4 spaces for indentation, not tabs.
- Avoid trailing whitespace.
- Prefer readability and clarity over complicated/complex: see the Zen of Python
- No dependencies should ever be introduced.
- Keep things simple and light-weight.
- Avoid adding public methods/attributes to the
Dispatcher
class, especially if the method/attribute names are common.- Since
Dispatcher
is meant to be subclassed by users of this project, it needs to stay out of a developer's way as much as possible.
- Since
- Ensure compatibility across all conceivable platforms and Python versions. (currently 2.7, 3.4, 3.5, 3.6, 3.7)
git clone https://github.com/<gh-user-name>/python-dispatch.git
cd python-dispatch
It's recommended to use a virtual environment for development and testing. See https://virtualenv.pypa.io/en/latest/ or https://docs.python.org/3.7/library/venv.html for details.
Create a new environment at the root of your working tree and activate it:
python -m venv venv
source venv/bin/activate
Install the project in 'editable' mode:
pip install -e .
Currently, the only dependency for testing is pytest, but to make tests run faster, it's a good idea to install pytest-xdist:
pip install pytest pytest-xdist
To run the entire test suite:
py.test -n auto
# -n auto will use all available CPU cores
For other invocation methods, see the pytest docs
There is a test in the suite that will take an extremely long time: tests/test_subclass_init.py
. To avoid having to wait for it every time, you can make
a change to it, make sure to revert it before committing.
tests/test_subclass_init.py
line 83:
for i in range(40000): # <--- change this to something like 4000
before_init = time.time()
By contributing, you agree that your contributions will be licensed under project's (MIT) license.
This document was adapted from the open-source contribution guidelines for Facebook's Draft