Forget about working directory errors
Project description
Motivation
TODO
Usage guide
You can execute the code below from any script of your project, no matter how deep it is located.
The library automatically detects the project root. When from_root
is called,
all the folders in traceback are looked through in order to find .git
directory or
.project-root
file (might be empty; you have to create it on your own).
The first one that contains at least one of them are considered as root directory
There is a special case. If your package was installed by someone else using, for example, pip
, the root directory is
the one that is next to site-packages
directory.
The information about from_root
parameters can be found in its docstring (from_root.__doc__
)
from from_root import from_root
path = from_root('a', 'b', 'c', 'file.txt', create_parent_dirs=True, pathlib=True)
with path.open('w') as file:
file.write('from-root')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for from_root-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abe6d8b90eda4cb3504ff9f94e72f457ec627e8f4e882ccdc90cf275a412a0cb |
|
MD5 | 19695c891020390e0e24282d00151b29 |
|
BLAKE2b-256 | b451d6200be40363f95c65d1cced651384f5a88701166804095aea4c7ff81e3a |