Skip to content

meansoup/rootdir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Find root directory simply

You can find the root directory intuitively, quickly and simply.

Usage

  1. Install by pip install rootdir
  2. Add __root__.py to your root path.
  3. import rootdir
  4. 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages