Contributing to APScheduler¶
If you wish to add a feature or fix a bug in APScheduler, you need to follow certain procedures and rules to get your changes accepted. This is to maintain the high quality of the code base.
Fork the project on Github
Clone the fork to your local machine
Make the changes to the project
Run the test suite with tox (if you changed any code)
Repeat steps 3-4 until the test suite passes
Commit if you haven’t already
Push the changes to your Github fork
Make a pull request on Github
There is no need to update the change log – this will be done prior to the next release at the latest. Should the test suite fail even before your changes (which should be rare), make sure you’re at least not adding to the failures.
To fully run the test suite, you will need at least:
A MongoDB server
A Redis server
A Zookeeper server
For other dependencies, it’s best to look in tox.ini and install what is appropriate for the Python version you’re using.
This project uses PEP 8 rules with its maximum allowed column limit of 99 characters. This limit applies to all text files (source code, tests, documentation). In particular, remember to group the imports correctly (standard library imports first, third party libs second, project libraries third, conditional imports last). The PEP 8 checker does not check for this. If in doubt, just follow the surrounding code style as closely as possible.
Running the test suite is done using the tox utility. This will test the code base against all supported Python versions and performs some code quality checks using flake8 as well.
Some tests require the presence of external services (in practice, database servers). To help with
that, there is a docker-compose configuration included. Running
docker-compose up -d will
start all the necessary services for the tests to work.
Any nontrivial code changes must be accompanied with the appropriate tests. The tests should not only maintain the coverage, but should test any new functionality or bug fixes reasonably well. If you’re fixing a bug, first make sure you have a test which fails against the unpatched codebase and succeeds against the fixed version. Naturally, the test suite has to pass on every Python version. If setting up all the required Python interpreters seems like too much trouble, make sure that it at least passes on the lowest supported versions of both Python 2 and 3. The full test suite is always run against each pull request, but it’s a good idea to run the tests locally first.