Hello again.

I have never written major projects, and now I have before me the question of how the structure of files and directories in a project should look like, what to put and what to invest in. Googling was very difficult for me, so I walked through the repositories of large projects on the githaba and got some intersection of folders:

  • src - as I understand it, the main source code of the product is what we install, connect, etc .;
  • test - unit tests and, probably, all the others;
  • docs - project documentation and its source code;
  • examples are examples, I'm sure of that; :)
  • Bin is a folder that is everywhere, but its contents are incomprehensible.

Actually, having this list, I want to ask you if I understood everything correctly and what other rules and regulations are there about this.

I am also interested in a specific case: I have files in the project that are not used directly in the project code, but are needed during the development process (for example, I communicate with third-party sites and experiment with how to analyze third-party information, output metadata about this information, etc., this file is not related to the main code, but it greatly simplifies the development, and I would like to have it in the repository) - in which directory to put them?

UPDATE - I write in python, without being tied to frameworks like django.

  • Java project? - Xyanight
  • @Xyanight, no, in python. Updated the question. - zesudageg
  • @zesudageg; If you are given an exhaustive answer, mark it as correct (click on the check mark next to the selected answer). - Nicolas Chabanovsky

2 answers 2

Post old, but decided to be noted:

  1. The structure is as close as possible to the directory structure in Linux. The main reason: the creation of dep / rpm / ... packages, which must meet the requirements of the OS during installation.
  2. the directory structure copies the Linux structure, but since the application runs in an isolated environment (virtualenv, Docker), it is all located in its own isolated environment.

From here there is:

  • bin - executable scripts;
  • lib - libraries;
  • etc - configs, settings;
  • var - variable data;
    • var / log - logs of work;
  • share - some shared data, never used, usually do not create.

Ideally, I even try to make an isolated project so that it can be used to make a system package or at least a package for installing pip.

    alt text

    Everyone decides for himself. I am writing in Python as well, and I have already decided on my own directory structure in projects. I wrote a small one for automatic generation of directories when creating a new project.

    So, in the root directory of the project are folders and files:

    [data] - the folder contains the required subdirectories image, language, I also store everything else in it, such as files that you don’t know what to do;
    __________ [image] - project graphics;
    __________ [language] - language localization files;
    _______________ language_rus.txt
    [libs] - modules and additional libraries of the project;
    [LISENSE] - text license files;
    [Plugins] - directory for project plugins;
    setting.ini - project settings file;
    nameProject.py is the code that launches loadplugin.py and program.py, in case of an error, writes a log and displays a window with its text, a kind of a starter;
    loadplugin.py - loads plugins before executing program code in program.py;
    program.py - in fact, the program code of the project itself;

    The result is this:

    alt text

    Pure and clear!

    As you can see, everything is simple. Sooner or later, you should have come to the question of structuring the directories of your project!

    • It turns out that there are no norms and everyone organizes the structure of the project as he wants (or, as much as is logical in his opinion)? - zesudageg
    • Yes. At least in Python. For example, I have been following my directory structure for a couple of years now. Such a structure of the project is expandable; it is enough to add the necessary functionality to the Plugins folder, it is simple and insured against errors. - Xyanight