Lightweight project root discovery for Python projects and CLI workflows
Project description
rootscope-finder
A lightweight, dependency-free project root finder for Python and CLI usage.
Why
This package discovers a project root by walking upward from a start path and matching common project marker files/directories (for example .git, pyproject.toml, package.json).
Install
From PyPI
pip install rootscope-finder
From GitHub
pip install "git+https://github.com/LoganJinDev/rootscope-finder.git"
CLI
find-root
find-root /path/to/any/subdir
find-root /tmp --strict
find-root --json
Python API
from rootscope_finder import find_project_root, require_project_root
root = find_project_root()
# or
root = require_project_root()
Python Usage Examples
from rootscope_finder import find_project_root
# Find from current dir
root = find_project_root()
# Start from a specific path
root = find_project_root(path="assets/images")
# Limit search depth
root = find_project_root(max_depth=3)
# Use custom markers
root = find_project_root(markers=[".git", "pyproject.toml", "requirements.txt"])
# Combine options
root = find_project_root(
path="src",
max_depth=5,
markers=["manifest.json"],
)
# Priority search by project name (searches only in provided workspace roots)
root = find_project_root(
project_name="TestProject",
workspace_roots=["/Users/xxx/Desktop/LoganJinDev"],
)
Behavior
PROJECT_ROOTenv var can override detection (default enabled).--no-envdisables env override.--markercan add custom markers.--strictreturns exit code1when not found.
CLI Usage Examples
# Find from current dir
find-root
# Start from specific path
find-root assets/images
# Limit search depth
find-root --max-depth 3
# Add custom markers (repeat --marker)
find-root --marker .git --marker pyproject.toml --marker requirements.txt
# Combine options
find-root src --max-depth 5 --marker manifest.json
# Priority search by project name (no full-disk scan)
find-root --project-name TestProject --workspace-root /Users/xxx/Desktop/LoganJinDev
Development
python -m pip install -e .
pytest
python -m build
License
MIT
Copyright © 2026 https://github.com/LoganJinDev
Publish to PyPI
This repository includes .github/workflows/publish-pypi.yml.
- In PyPI, create project
rootscope-finderand configure Trusted Publisher for this GitHub repo. - Create and push a version tag:
git tag v0.1.1
git push origin v0.1.1
- After workflow success, users can install directly:
pip install rootscope-finder
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 rootscope_finder-0.2.0.tar.gz.
File metadata
- Download URL: rootscope_finder-0.2.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
585b5432fba1ef19cd5f6ecbb677a6adeebe1858bc53508041aa2d57cd374559
|
|
| MD5 |
65ad7289cb285dc06ca57bc297befa5a
|
|
| BLAKE2b-256 |
5f3275a634cfa2b075991bc7ad62d1c71c147f1aa466f053b928582fc441682b
|
File details
Details for the file rootscope_finder-0.2.0-py3-none-any.whl.
File metadata
- Download URL: rootscope_finder-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70b2ed275fc16a3b3f95c4aea3c5d3f18e144c3c9807d7c9e62e52fccb7945ba
|
|
| MD5 |
334aeea9f7299bbc3db4fadb49e633e9
|
|
| BLAKE2b-256 |
99e4b67e253c8e022f3b4bf7723f6d41636d71d7161d1f9e27496865821ecd17
|