Python Packages


As the size of a module growth it will be more and more difficult to maintain. It might be eaier if we split it up into multiple files and put those files inside a directory. A 'package' is just that. A bunch of Python modules that belong together and are place in a directory hierarchy. In order to tell Python that you really mean these files to be a package one must add a file called __init__.py in each directory of the project. In the most simple case the file can be empty.

  1. Create package
  2. Internal usage
  3. use module in package
  4. use package (does not work)
  5. package importing (and exporting) module
  6. use package (module) with import
  7. use package with import
  8. Creating an installable Python package
  9. Create tar.gz file
  10. Install Package
  11. Dependencies
  12. Add README file
  13. Add README file (setup.py)
  14. Include executables
  15. Add tests
  16. Add tests calc
  17. Add tests all
  18. setup.py
  19. Packaging applications
  20. Exercise: package