6
votes

I recently started work on an application that involves both Python and Java components independent of each other. What is the best way to structure the folder hierarchy for the project, in particular the source files?

Right now the structure looks like this:

/src
 -- java packages here
/test
 -- jUnit test packages here
/deployment
 -- Ant scripts here
/bin
/lib
/etc
.gitignore

A possible solution would be to have src/java and src/python (as in, subdirectories under the src folder). Another solution would be to have two separate directories in the project for instance src_java and src_python. anyone worked on a project like this? Is there a de facto convention that should be used?

I've read the answers to this question What is the best project structure for a Python application? but the 6th point wasn't discussed much regarding the non-Python sources.

1

1 Answers

3
votes

In Gradle projects, it is recommended to structure the folders like this:

src
  main
    java
    python
  test
    java
    python
build
libs
...
.gitignore
README.md

Maven recommends a similar structure.

Python has different recommendations, but since the Java build tools usually are more sophisticated (due to requiring compilation and output directories for that), I'd go with the Gradle or Maven structure.