Multiple related programs: one `pyproject.toml`, or multiple projects?

There’s no requirement for the root of a package folder to also be the root of the Git repository, so my thoughts here are to have all programs in one repository containing multiple packages. The repository root will contain a directory for each package, with each of those folders containing all of the project-specific stuff typically found at the root of a repo (such as pyproject.toml). Your CI script or other build process can cd into each folder and build the package, then cd into the next folder and so on.

Shared code can be its own package (and associated directory) on which the programs using it can declare a dependency. The PyPI description should just say that it is an internal package not meant to be installed alone.

So your repository can look something like this:

myprograms
|
+-- common/  <-- shared files go in this project
|   |
|   +-- src/
|   +-- pyproject.toml
|
+-- program1/
|   |
|   +-- src/
|   +-- pyproject.toml
|
+-- program2/
|   |
|   +-- src/
|   +-- pyproject.toml
|
+-- .gitignore
+-- .gitlab-ci.yml (or the CI file for your choice of CI service)
+-- LICENSE.txt
+-- README.md
4 Likes