Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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 README.md, licence, .gitignore-files).

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

  • a requirements.txt file
  • a setup.py 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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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/
│
├── helloworld/
│   ├── __init__.py
│   ├── helloworld.py
│   └── helpers.py
│
├── tests/
│   ├── helloworld_tests.py
│   └── helpers_tests.py
│
├── .gitignore
├── LICENSE
├── README.md
├── requirements.txt
└── setup.py

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading