Python GitHub project-structure convention?

Is there a convention(or even a PEP) on how to structure a python project on GitHub? More specifically python-specific files(I know about the, licence, .gitignore-files).

I’ve googled the whole morning and found different approaches. Most of them use:

  • a requirements.txt file
  • a file

One used a makefile some other added a .travis.yml for travis and so on… .
And they split their project directories in different folders like data and APP.

My Questions:

  1. What files should I include in a python-project? What files would be nice to have?
  2. Is there a convention how I should arrange different folders like data and APP or is it up to me how I want to split, name and organize the different parts of my program?

Thank you in advance for your help

>Solution :

This is likely dependent on what you are building. The article I linked in my comment breaks out different layouts like so:

CLI Layouts:

  • One-Off Script
  • Installable Single Package
  • Application with Internal Packages

Web App Layouts:

  • Django
  • Flask

While link only answers are discouraged here, I think its counter productive to rehash the whole article but the "Installable Single Package" layout has worked for me and looks like this (borrowed from the same article):

├── helloworld/
│   ├──
│   ├──
│   └──
├── tests/
│   ├──
│   └──
├── .gitignore
├── requirements.txt

NOTE: If you have a data directory, I would put it at the same level as tests

Leave a Reply