Metadata-Version: 2.1
Name: py-repo-root
Version: 0.2.0
Summary: Python utility for cleaner handling of paths
Home-page: https://github.com/microsoft/project-root
Author: Pashmina Cameron, Henry Jackson Flux
Author-email: pashabhi@yahoo.com
License: MIT
Platform: UNKNOWN
Requires-Python: >=3.7.0
Description-Content-Type: text/markdown
Requires-Dist: pathlib
Requires-Dist: typing-extensions

# Introduction 

his package standardizes the handling of paths in a Python project by 
allowing all paths to be relative to the project repo root. 
The package also helps discover the project root automatically 
based on the location of the file that invokes it and a user-specified
 (or commonly used) project root indicator files such as `requirements.txt`. 

This package was heavily inspired by [pyprojroot](https://github.com/chendaniely/pyprojroot). 
Our version fixes some of the issues in the original. 

## Usage

Installation:
```
pip install py-repo-root
```

## Usage

Get project root
```
from projectroot import project_root
project_root_dir = project_root(Path(__file__), root_files='requirements.txt')
```

Another common usage pattern may be to add the project_root to PYTHONPATH for the purposes 
of running some scripts. 

```
import sys
from projectroot import project_root
sys,path.insert(0, str(project_root(Path(__file__), root_files='requirements.txt')))
```
Getting a relative path from the project root for a file:

```
from projectroot import project_root
path_to_file_from_project_root = project_root(Path(__file__), root_files='requirements.txt').joinpath('/path/to/file.txt')
```





