Skip to main content

Locate a project root by anchor directory name and optionally patch 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 named anchor_dirname.
  • Returns the parent of that directory as ROOT_DIR.
  • appends ROOT_DIR to sys.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.2.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

waypin-0.1.2-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file waypin-0.1.2.tar.gz.

File metadata

  • Download URL: waypin-0.1.2.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for waypin-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2239045eee24577d3fe7a879944f5cca2c62c1c18cf03fb813d97c1ab6973365
MD5 aac7876d22dae64d4247b706b21e2910
BLAKE2b-256 7d4b7fe23de7bcb4aee1dc40d87586fa7377c7a3b5e36f1e9feb8764833e8109

See more details on using hashes here.

File details

Details for the file waypin-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: waypin-0.1.2-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

Hashes for waypin-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1630f4e101eb1b9890cf6dbd32ba54878b57380e162c9b9c04f0c46b5bacc7dc
MD5 a01be1d8f27fefa74bdc18c0effe7f19
BLAKE2b-256 53f839a23d68a54fcb52c57924369eb6b91e618e1b4ae7bf1a806341b0464fdd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page