Skip to main content

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()
# default start: main script directory; fallback: current working directory

Python Usage Examples

from rootscope_finder import find_project_root

# Find from current dir
root = find_project_root()

# Start from a specific path (recommended for strict determinism)
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_ROOT env var can override detection (default enabled).
  • --no-env disables env override.
  • --marker can add custom markers.
  • If path is omitted, root search starts from __main__.__file__, then falls back to current working directory.
  • --strict returns exit code 1 when 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

MIT License

Copyright © 2026 https://github.com/LoganJinDev

Publish to PyPI

This repository includes .github/workflows/publish-pypi.yml.

  1. In PyPI, create project rootscope-finder and configure Trusted Publisher for this GitHub repo.
  2. Create and push a version tag:
git tag v0.2.1
git push origin v0.2.1
  1. After workflow success, users can install directly:
pip install rootscope-finder

Metadata

Release files for rootscope-finder 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rootscope-finder 0.2.1
File Size Uploaded Provenance Actions
rootscope_finder-0.2.1.tar.gz 8.8 kB Without provenance Details for rootscope_finder-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rootscope-finder 0.2.1
File Interpreter ABI Platform Actions
rootscope_finder-0.2.1-py3-none-any.whl Python 3 none any Details for rootscope_finder-0.2.1-py3-none-any.whl

Total release size: 16.0 kB

Release files / rootscope_finder-0.2.1.tar.gz

Download URL rootscope_finder-0.2.1.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b9704bc9dfe1af0d1c91bba5e2eecb8b3c908e1108df39d7eaa17995ddeaef17
BLAKE2b-256 checksum
How to use checksums
c8a978ea139fe4f53ee26b7976db68fcbeb21f0b395cec3b671098a699756c5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

Release files / rootscope_finder-0.2.1-py3-none-any.whl

Download URL rootscope_finder-0.2.1-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bfcd31e2e5f2b315f666d1fec7af270d80c4d06e700fdfa5384574506019d026
BLAKE2b-256 checksum
How to use checksums
f4026a68ad6a43df8b78e2300135dafed7e6d6174ab2cc4b17b98d45ebc62098
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

Security for rootscope-finder 0.2.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.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page