Skip to main content

get python root directory easily

Project description

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.

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

rootdir-0.1.3.tar.gz (1.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rootdir-0.1.3-py3-none-any.whl (1.9 kB view details)

Uploaded Python 3

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

Hashes for rootdir-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f848051f815466287e91a0e33677346ac8c837dc4b2f5c10884257e5c58af94b
MD5 b34b910a2180bb81c332d753fbad39a8
BLAKE2b-256 58813d119afa5e0a1b23f8962d6b7f286f367a471ffb9db859852c7c2003a7c8

See more details on using hashes here.

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

Hashes for rootdir-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 55c53c5709c574b666970e86e798ecb08bfb1087dfa0c2001246b0595f910e51
MD5 27849e7e31023fbb4a5064aeed7ce130
BLAKE2b-256 bcd1f3d44ca25d468c5f5b874a951999e3d1ec76ee9d3f1d17947c0f81a25c0d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page