Metadata-Version: 2.1
Name: root-directory
Version: 0.1.1
Summary: A no-nonsense utility for importing relative to root
Author-email: Kristjan Kongas <kongaskristjan@gmail.com>
License: This is free and unencumbered software released into the public domain.        
        Anyone is free to copy, modify, publish, use, compile, sell, or
        distribute this software, either in source code form or as a compiled
        binary, for any purpose, commercial or non-commercial, and by any
        means.        
        In jurisdictions that recognize copyright laws, the author or authors
        of this software dedicate any and all copyright interest in the
        software to the public domain. We make this dedication for the benefit
        of the public at large and to the detriment of our heirs and
        successors. We intend this dedication to be an overt act of
        relinquishment in perpetuity of all present and future rights to this
        software under copyright law.        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
        IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
        OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
        ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
        OTHER DEALINGS IN THE SOFTWARE.        
        For more information, please refer to <https://unlicense.org>        
Project-URL: Homepage, https://github.com/kongaskristjan/root_directory
Project-URL: Bug Tracker, https://github.com/kongaskristjan/root_directory/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: The Unlicense (Unlicense)
Classifier: Operating System :: OS Independent
Requires-Python: >=3.4
Description-Content-Type: text/markdown
License-File: LICENSE

# root_directory

Tired of the Python ["Importing files from different folder"](https://stackoverflow.com/q/4383571/6865804) 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.
