For my HPC work, I'd like to make a command line tool to make organizing computational experiments and saving data a bit easier. The actual logic of the tool itself is pretty straightforward; I've implemented most of the logic for my daily workflow in Python already. As I've done quite a lot of work in Rust, I'm envisioning something to Cargo where I have commands like cargo run that act independently of my current location in the project directory.
How do I make the tool executable within any subdirectory of a project? For instance, let's say my project tree is
project/
src/
main.py
module1/
helper1.py
data/
I'd like to be able to run the tool from any directory (say, module1), and still have the tool save data to the data folder. I'm specifically thinking of something like what Cargo does for Rust, where I can run cargo run from any folder and the command somehow ensures that the directory paths all stay consistent. Cargo somehow does this with only a single toml file at the root node, which is what I'd like to achieve.
The easiest solution seems to be to just have a configuration file at the root, and have the command start searching for the configuration file by traversing up the directories. But as I'm very new to CLI, I want to be sure that there isn't a standard practice I'm unaware of.