entens.net The less one forgets, the less one can remember.

Filesystem structure of a Python project

Doesn't too much matter. Whatever makes you happy will work. There aren't a lot of silly rules because Python projects can be simple.

  • /scripts or /bin for that kind of command-line interface stuff
  • /tests for your tests
  • /lib for your C-language libraries
  • /doc for most documentation
  • /apidoc for the API docs.
  • A README file to explain your app.

    Don't:

    • put your source in a directory called src or lib. This makes it hard to run without installing.
    • put your tests outside of your Python package. This makes it hard to run the tests against an installed version.
    • create a package that only has a __init__.py and then put all your code into __init__.py. Just make a module instead of a package, it's simpler.
    • try to come up with magical hacks to make Python able to import your module or package without having the user add the directory containing it to their import path (either via PYTHONPATH or some other mechanism). You will not correctly handle all cases and users will get angry at you when your software doesn't work in their environment.

    sources:

    Comments (0) Trackbacks (0)

    No comments yet.


    Leave a comment


    No trackbacks yet.