root_directory
Tired of the Python "Importing files from different folder" mess?
This is a no-nonsense utility for importing relative to root. So for a directory structure like that:
* your_lib
* lib.py
* your_main
* main.py
* .root_directory
You can now import lib.py from main.py with the following:
import root_directory # This must be before imports relative to root
from your_lib import lib
This works as long as the root directory is a git repository or contains .root_directory in the root.
As a bonus, you can find out your root path with root_directory.get_root() (this returns a pathlib.Path object).
Why another library?
There are several libraries that do something similar, however as far as I know, they either 1) only find the path, but don't help with importing, or 2) add many unnecessary and heavyweight dependencies.
This project has no dependencies.
Installation
Run pip install root_directory, python 3.4+ is supported.
Metadata
Release files for root-directory 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| root_directory-0.1.4.tar.gz | 3.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| root_directory-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.1 kB
Release files / root_directory-0.1.4.tar.gz
| Download URL | root_directory-0.1.4.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
282e5c5d43b6bf3f50c9f6b69caddf96493bcd5a1a292d5d454112f34d28f8ab
|
|
BLAKE2b-256 checksum How to use checksums |
9de85d20472ca0193afebcf788415e409017cc89c876075b97a48a68366d7a54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Release files / root_directory-0.1.4-py3-none-any.whl
| Download URL | root_directory-0.1.4-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5792d83fdefab480b151d59c76a107c14cbb895a7a30fbc49c068a9ec6fd1a12
|
|
BLAKE2b-256 checksum How to use checksums |
31f6d6422f93b241b76e01c4b406440511bcb8fe7a8595bfac2c052cda7599b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Security for root-directory 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.