1 * Python Library - library/name/__init__.py
2 * At least *one* test - library/tests/test_setup.py
7 To get started, copy the contents of this repository (excluding the .git directory) and run `_bootstrap.sh` to highlight substitutions you need to make.
9 Be careful to copy *all* files, including those starting with a . such as `.travis.yml`.
11 A Makefile is provided to automate some tests, checks and package building. You should use it!
17 Libraries should be singleton if they pertain to a HAT or pHAT and class-based if they are for breakouts with selectable addresses.
19 A singleton library would work like this:
24 library.do_something()
27 Whereas a class-based library requires an instance of its class:
32 device = library.Library()
39 You should ensure you either run `flake8` while writing the library, or use an IDE/Editor with linting.
41 All libraries (and example code) should stick to PEP8 style guides, although you can ignore long line warnings (E501) if you feel they're unwarranted.
45 At least one test script should be used to prevent obvious errors and omissions from creeping into the library.
47 You should use `tox` to run the test scripts:
57 Examples should use hyphens and short, descriptive names, ie: `rainbow-larson.py`
59 Examples should include a `print()` front-matter introducing them, ie:
62 print("""rainbow-larson.py - Display a larson scanning rainbow
71 Before deploying you should `make python-testdeploy` and verify that the package looks good and is installable from test PyPi.
73 You should also `make check` to catch common errors, including mismatched version numbers, trailing whitespace and DOS line-endings.
75 Subsequent to deployment you should `git tag -a "vX.X.X" -m "Version X.X.X"` and `git push origin master --follow-tags` to tag a release on GitHub that matches the deployed code.