Find project root by anchor directory name and insert it into sys.path.
Project description
waypin
A tiny utility to locate a project root by an anchor directory name (default: scripts) and optionally
patch sys.path so absolute imports like from scripts... work in script/main execution and notebooks.
Install
pip install waypin
Usage
from waypin import *
print(ROOT_DIR) # the very upper parant directory of "scripts". you can modify source code from "scripts" to other desired src folder name.
print(NOTEBOOK) # True if upper import statement called within .ipynb file else False
Behavior
- Searches upward from the executing context (caller
__file__, or notebook path if available) to find a directory namedanchor_dirname. - Returns the parent of that directory as
ROOT_DIR. - appends
ROOT_DIRtosys.path.
License
MIT
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
waypin-0.1.3.tar.gz
(3.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file waypin-0.1.3.tar.gz.
File metadata
- Download URL: waypin-0.1.3.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22a45aebc1245011067803f2e0729c9501cdd82981c2f8b401c5f59455b5c271
|
|
| MD5 |
d3aed799dc2b28699ecd2f2845ffecd0
|
|
| BLAKE2b-256 |
70416367881970fcb862ccf0c029e627a5be2632231c95da9b5a93b7698f03e0
|
File details
Details for the file waypin-0.1.3-py3-none-any.whl.
File metadata
- Download URL: waypin-0.1.3-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02c09fd8ee1cba9f19d48cb44f0b134536001f341f6733312b15f1f9e1cb8fbe
|
|
| MD5 |
f0a91d4116c9deea97499d9625e368fa
|
|
| BLAKE2b-256 |
b8f0a52b02c08cd373b8fb97853270c75dc18c91471642aa3d0febd1c5e3de2a
|