Simple package for easy project root setup
Low maintenance activity. Last release over 3 years ago, commits in 0 of the last 26 weeks. Weaker on commit activity and recent releases.
pip install rootutilsrootutils
A simple python package to solve all your problems with pythonpath, working directory, file paths, module imports and environment variables.
Why rootutils?
Problem: I would like to be able to:
- Run my python scripts from anywhere
- Always import python modules relatively to the project root directory
- Always access files relatively to the project root so I don't have to specify a series of
../to get to the data - Always have access to environment variables from
.envfile without having to load them manually - Have all the above benefits in notebooks even if they're nested in subdirectories
Solution: The rootutils package provides a flexible way to setup the python project with a simple one-liner. It finds the project root based on the location of specified file name, e.g. .project-root or .git.
The package is tiny and continuosly maintained.
Setup
pip install rootutils