This package simply finds the root of a project based on a filename.
Usage
- Create a hidden file in the root directory of your project.
vim .my_hidden_root_file
Tip: Use project-specific name not a generic .root or even rely on .git. Get creative.
- Install
groo
pip install groo-ozika
Tip: use conda and make sure to activate the right environment to install into.
- Import to your code and use
from groo.groo import get_root
root_folder = get_root(".my_hidden_root_file")
Tip: Always use os.path.join() to declare paths. It will make your code run across platforms and you won't get any strange erorrs (e.g., extra /).
Optional
If you want to provide a time limit to the search for the root you can do so by using the timelim flag (in seconds).
root_folder = get_root(".my_hidden_root_file", timelim=10)
Example usage
Let's say that wee want to keep all project-related files in a specific folder (which can be anywhere on your computer). Let's call this project_folder.
Then, within it we want to have some data mydata.csv in a data folder and some scripts in a scripts folder runscript.py.
To let groo identify the root folder we need to create a file there. I usually prefer to use a dot file because it will remain hidden, however, it can be anything. In this example we will create .my_hidden_root_file in the project_folder.
Once the hidden file is created, one might want to load it in their python script (or a jupyter ntbk). Here we want to load data/mydata.csv within the scripts/runscript.py.
To do that, we can use this example:
from groo.groo import get_root
root_folder = get_root(".my_hidden_root_file")
import pandas as pd
df = pd.read_csv(os.path.join(root_folder, "data", "mydata.csv"))
Note that the same code will work for any script that is anywhere whithin the project_folder.
Enjoy!
Release Notes
New in version 0.1.0
1/ Fixed bug from 0.0.9
2/ Added verbose option, if verbose=True groo will print out the directories that it's searching
Added "quick search" which scans directories above in the hierarchy before performing a more comprehensive search.
New in version 0.0.9
Added "quick search" which scans directories above in the hierarchy before performing a more comprehensive search.
New in version 0.0.8
Removed bug which was displaying path.
New in version 0.0.7
- Previous versions of
groocould only search for the root flag above in the directory hierarchy. Starting0.0.7, the flag can be in theory anywhere on the computer. The search algorithm starts from the location of the file and on each iteration moves a level up, performs a full search. - Since full search can sometimes be unpractical,
groonow allows users to specify maximum time limit using thetimelimflagget_root(".my_hidden_root_file", timelim=10).
Logo by AbtoCreative ❤️
Metadata
Release files for groo-ozika 0.1.1
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 | |
|---|---|---|---|---|
| groo-ozika-0.1.1.tar.gz | 4.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| groo_ozika-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.3 kB
Release files / groo-ozika-0.1.1.tar.gz
| Download URL | groo-ozika-0.1.1.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f15bb956f8dcdfb0b77a77ec36dece82ca3300ca5f2ed4f71a18996609cfc61
|
|
BLAKE2b-256 checksum How to use checksums |
a90ee55074b376e0e169d1284dca7cc8be45874f0b372510c4318f88700318af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.5
|
Release files / groo_ozika-0.1.1-py3-none-any.whl
| Download URL | groo_ozika-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3f0102aaf43cfdb2688a575006f3a8c4990fe0fd14f909b15bfd34fe5c2f9ae9
|
|
BLAKE2b-256 checksum How to use checksums |
37195ec2c76af8580ff5fb59fa3455ab1f51edc7db313c7b65e8587b72a05bdf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.5
|
Security for groo-ozika 0.1.1
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.