Are there any tools which generate a project layout for python specific projects, much similar to what maven accomplishes with mvn archetype:generate
for java projects.
Python doesn't have a distinction between /src , /lib , and /bin like Java or C has. Since a top-level /src directory is seen by some as meaningless, your top-level directory can be the top-level architecture of your application. I recommend putting all of this under the "name-of-my-product" directory.
maven-project/src/main – contains source code and resources that become part of the artifact. maven-project/src/test – holds all the test code and resources. maven-project/src/it – usually reserved for integration tests used by the Maven Failsafe Plugin.
You can use maven-exec-plugin to execute python script using maven.
It is the good news: you do not need any tool. You can organise your source code in any way you want.
Let recap why we need tools in the java world:
In java you want to generate directories upfront because the namespace system dictates that each class must live in one file in a directory structure that reflects that package hierarchy. As a consequence you have a deep folder structure. Maven enforces an additional set of convention for file location. You want to have tools to automate this.
Secondly, different artefacts require use of different goals and even additional maven projects (e.g. a ear project requires a few jars and war artefacts). There are so many files to create you want to have tools to automate this.
The complexity makes tools like mvn archetype:generate
not just helpful. It is almost indispensable.
In python land, we just do not have these complexity in the language.
If my project is small, I can put all my classes and functions in a single file (if it makes sense)
If my project is of a bigger size (LOC or team size), it makes sense to group .py
files into modules in whatever way makes sense to you and your peers.
At the end of the days, it is about striking a balance between ease of maintenance and readability.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With