Contributing Guide
Happy baking!
Set up development environment
git clone https://github.com/font-bakers/knead.git
cd knead/
make develop
source venv/bin/activate
# Do your work...
deactivate
Before committing
make check
This will both lint the knead/ directory (with black and pylint), and run
test scripts. You may lint and test separately with make lint and make test,
respectively.
Make sure that all checks pass before committing: you should get several blue success messages as each check passes.
Note that knead uses a pre-commit git
hook to
format staged Python files in-place using black.
Packaging and releasing knead
First, ensure that the version number has been bumped appropriately:knead
adopts the Semantic Versioning
2.0.0 specification. This can be
done either by running
bumpversion --current-version CURRENT_VERSION PART knead/__init__.py
or by directly editing the __version__ variable in knead/__init__.py (the
latter method is simpler and recommended for such a simple project as knead).
For more information, see the bumpversion
documentation.
Then, run make package. It will package knead and validate the resulting
source archive and
built
distribution.
Finally, upload the source archive and build distribution to PyPI. You will be asked for a username and password for PyPI.
twine upload dist/*
For more information, refer to the Python packaging documentation.
Miscellaneous development details
-
kneadadopts the Semantic Versioning 2.0.0 specification. -
kneadtargets Python 3.5+ (specifically, 3.5.2+) compatibility. -
kneadusesblackandpylintto format and lint code, respectively. -
However,
blackrequires Python 3.6+ to run. Thus, we test in Python 3.5 but lint in Python 3.6. See our Travis configuration for more details. -
kneadcontains integration tests in the form of thetest.shscript.kneadis currently not unit tested. - Briefly,
test.shfirst hashes thedata/directory (using theshasumcommand line tool). It then runs the entire data pipeline, conversion by conversion, on one font (Georgia.ttf). After every conversion, thedata/directory is hashed again. If the hash differs from the initial hash, the test fails. In this way, we test thekneadoutput for correctness. -
This is not possible for
.pbfiles, which change after every write. Thus, we merely count the number of.pbfiles that are generated. -
The
kneaddocumentation is generated usingmkdocs. See themkdocs.ymlconfiguration for more details.