--- id: rootpath version: "0.1.1" license: MIT license_treatment: permissive maintenance: abandoned --- # rootpath — Python project/package root path detection. License: permissive · Maintenance: abandoned · Downloads: 203.1K/mo ## What it is and what it does Rootpath is a utility library that automatically detects the root directory of a Python project by looking for common marker files and folders such as `.git`, `requirements.txt`, `setup.py`, and others. It works from any nested module within the project and returns the detected root path. The package also provides a helper function to prepend the root path to `sys.path`, which can simplify module imports across a project without relying on relative imports. The library is designed to solve the problem of Python's import system becoming fragile when scripts are run from different working directories. By detecting and adding the project root to the module search path, it allows imports to work consistently regardless of where a script is executed from. The detection logic can be overridden if the default markers don't match your project structure. Use it for: - Detect project root in a multi-level package structure to enable consistent absolute imports from any nested module. - Add project root to sys.path in test runners or utility scripts to avoid import errors when executed from different directories. - Resolve import paths in research or data-science projects where scripts may be run from various working directories. - Configure logging or resource paths relative to the detected project root rather than the current working directory. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Detects a Python project or package root directory by scanning for typical marker files and folders, and optionally adds that path to sys.path to resolve import issues. No. While the package is simple and has low install friction, it is abandoned (last release 2019, last commit 2022) and will not receive updates. For new projects, consider using modern alternatives like `importlib.resources` or `pathlib` with `__file__` inspection, or rely on proper package installation and relative imports. Only install if you are maintaining legacy code that already depends on it. ## Install pip install rootpath uv add rootpath poetry add rootpath ## Installing rootpath Before you install: Low install friction with a pure-Python wheel. However, the package is abandoned—last release was in 2019 and last commit in 2022—so it will not receive updates or security patches if issues arise. License in practice: MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions. Quickstart: import rootpath # Detect project root from any nested module root = rootpath.detect() print(root) # e.g., '/home/me/projects/py-foo' # Optionally add root to sys.path for easier imports rootpath.append() Verify before relying: - Whether the package correctly handles monorepos or projects with non-standard root markers. - Performance impact when scanning deeply nested directory structures for root markers. - Compatibility with modern Python versions beyond what classifiers declare. ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 203.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags python project root detection, find package root path, auto-detect project root, resolve python import paths, sys.path helper utility, project root marker detection, python module import resolution, path-detection, import-resolution, project-utilities [View on SkillFed](https://skillfed.io/packages/rootpath) · [View on PyPI](https://pypi.org/project/rootpath/)