Framework for controlling ground equipment
Project description
Overview
Show how to structure a Python project.
Requirements
- Python 3.5+
- Works on Linux, Windows, macOS, BSD
Split your code into packages, modules, and functions
- All code should be inside some function (except perhaps if __name__ == '__main__':).
- Split long functions into smaller functions.
- If you need to scroll through a function over several screens, it is probably too long.
- Functions should do one thing and one thing only.
- Hide internals with underscores.
- Organize related functions into modules.
- If modules grow too large, split them.
- Import from other modules under somepackage/ using from .somemodule import something.
- Do file I/O on the “outside” of your code, not deep inside.
Classes vs. functions
- Do not overuse classes.
- Prefer immutable data structures.
- Prefer pure functions.
Naming
- Give the subdirectory the same name as your package.
- Before you name your package, check that the name is not taken on https://pypi.org (you may want to upload your package to PyPI one day).
Interfaces
- In somepackage/__init__.py define what should be visible to the outside.
- Use https://semver.org.
Testing
- Test all non-trivial code. I recommend to use https://pytest.org.
- Use Travis CI: https://docs.travis-ci.com/user/languages/python/.
Dependency management
- Package dependencies for developers should be listed in requirements.txt.
- Alternatively, consider using http://pipenv.readthedocs.io.
- Package dependencies for users of your code (who will probably install via pip) should be listed in setup.py.
Code style
- Follow PEP8: https://www.python.org/dev/peps/pep-0008/
- Use pycodestyle to automatically check for PEP8.
Type checking
- Consider using type hints: https://docs.python.org/3/library/typing.html
- Consider using http://mypy-lang.org.
- Consider verifying type annotations at runtime: https://github.com/RussBaz/enforce
Documentation
I used to recommend reStructuredText for READMEs in contrast to Markdown but PyPI no longer requires reStructuredText. You can use Markdown as noted on https://pypi.org/help/ under “How can I upload a project description in a different format?”.
Example shown here: https://packaging.python.org/tutorials/packaging-projects/#creating-setup-py
Suggestions? Corrections? Pull requests?
Yes please!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size Barracuda-0.0.2-py2.py3-none-any.whl (6.2 kB) | File type Wheel | Python version py2.py3 | Upload date | Hashes View |
Filename, size Barracuda-0.0.2.tar.gz (5.5 kB) | File type Source | Python version None | Upload date | Hashes View |
Close
Hashes for Barracuda-0.0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e195b282b2a41395ee6dd4883251bddd5681d7114adb1c5f85224673fca6ca5 |
|
MD5 | f667d4067b27e41a1e41dae8baade93e |
|
BLAKE2-256 | 1c7159dce8120929105eb7d347367fbab05e93de1c617bb9766bbe3ee872b4b7 |