Description
Hi,
In Clojure, it is typical for source code to reside in a subdirectory of the project root, such as the src
directory. However, it is not immediately clear how to achieve this in Basilisp.
The section Using Basilisp in a Project of the documentation, suggests placing source code in the src
directory and tests in the tests
directory, and defers to Python dependency tools for handling this setup.
However, users coming from a Clojure background might not be familiar with Python project tools or how to use them. They may be primarily interested in Python interop, and picking up a Python project management tool just to write some Basilisp/Clojure code can be a steep learning curve.
Alternatively, we could adopt a more familiar approach for Clojure users by using a project file similar to deps.edn
, as outlined in the basilisp.edn ticket.
I suggest introducing :paths
key in basilisp.edn
, similar to the :paths key in deps.edn. This key would allow the REPL (and nREPL) to add the listed paths to the sys.path
list of directories that the Python interpreter searches for source code.
For example, given a directory structure
<project root>
|-- basilisp.edn
|-- src dir
|-- other-sources dir
and a basilisp.edn
file
{:paths ["src-dir" "other-sources"]}
The REPL would add the src
and other-sources
directories to the sys.path
variable at startup. I assume, advanced users who prefer to use a Python management tool would need to include the same paths in their project configuration file.
Thanks