get python root directory easily
Project description
Find root directory simply
You can find the root directory intuitively, quickly and simply.
Usage
- Install by
pip install rootdir - Add
__root__.pyto your root path. import rootdir- use as
rootdit.root_dir(__file__)
example 1
If you need root directory, you could get it simply.
import rootdir
if __name__ == "__main__":
print(rootdir.root_dir(__file__))
example 2
If you've found a directory for Python dependencies, you can solve it all at once with the following function.
import rootdir
rootdir.root_dependency(__file__)
Now you can import Python dependencies from root directory.
sample
You can see the sample code implemented as shown below.
.
└── example/
├── a/
│ └── a_1.py
├── b/
│ ├── b_1/
│ │ ├── b_1_1/
│ │ │ └── b_1_1_1.py
│ │ └── b_1_2.py
│ └── b_2.py
├── main.py
└── __root__.py
import rootdir
rootdir.root_dependency(__file__)
if __name__ == "__main__":
print(rootdir.root_dir(__file__))
You can use upper code in any python file.
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rootdir-0.1.3.tar.gz.
File metadata
- Download URL: rootdir-0.1.3.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.8.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f848051f815466287e91a0e33677346ac8c837dc4b2f5c10884257e5c58af94b
|
|
| MD5 |
b34b910a2180bb81c332d753fbad39a8
|
|
| BLAKE2b-256 |
58813d119afa5e0a1b23f8962d6b7f286f367a471ffb9db859852c7c2003a7c8
|
File details
Details for the file rootdir-0.1.3-py3-none-any.whl.
File metadata
- Download URL: rootdir-0.1.3-py3-none-any.whl
- Upload date:
- Size: 1.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.8.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55c53c5709c574b666970e86e798ecb08bfb1087dfa0c2001246b0595f910e51
|
|
| MD5 |
27849e7e31023fbb4a5064aeed7ce130
|
|
| BLAKE2b-256 |
bcd1f3d44ca25d468c5f5b874a951999e3d1ec76ee9d3f1d17947c0f81a25c0d
|