MontyCarleau
MontyCarleau2w ago

How can we define a project's root directory?

For example, given
src/my_proj/processors/simple_processor.py
notebooks/nb1.py
src/my_proj/processors/simple_processor.py
notebooks/nb1.py
I'd like to set the project root as src/proj and, from notebook nb1.py, import
from processors.simple_processor import SimpleProcessor
from processors.simple_processor import SimpleProcessor
5 Replies
Hall
Hall2w ago
Someone will reply to you shortly. In the meantime, this might help:
MontyCarleau
MontyCarleauOP2w ago
If the answer is to modify sys.path at the beginning of every notebook, that's fine, but some tools expect/allow base directories to be specified in pyproject.toml
Akshay
Akshay2w ago
The answer is modify sys.path, if that's your project structure. I personally would make processors a package and do an editable install of it, so I didn't need to modify sys.path. But I understand you may have other constraints. What tools are you thinking of that expect/allow base directories to be specified in the toml file?
MontyCarleau
MontyCarleauOP2w ago
I'd have to look at some old pyproject.tomls to find reasonable examples – In general, other projects are installed as editable, but I would just point out, I wouldn't be surprised if there's a much larger cohort of users (compared to jupyter users, for example) who are interested in integrating marimo notebooks deeper into their workflows, such that the notebook is a component rather than a customer or a view. For example, a data ingestion process that runs silently, when all is well, but still contains the narrative (visualizations, validations, etc.) somewhat frozen in time, which can be difficult to recreate in a comment block, especially with regard to statistics driven processes, which are subject to drift, etc.
Akshay
Akshay2w ago
Makes sense — enabling those types of workflows is a goal of ours. If you have a suggestion of how you’d like to specify paths, all ears.

Did you find this page helpful?