pyrootutils
Simple package for easy project root setup
Decision gist · record as of 2026-08-14
Yes, if you work with multi-directory Python projects, notebooks, or scripts that need to run from different locations. The single-function setup and low install friction make it a practical utility. The active maintenance and zero known vulnerabilities support confidence in use. The lack of recent releases is not a concern given the package's simplicity and stable scope.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction install with a single runtime dependency (python-dotenv).
- Maintenance status is active with recent commits, though the package itself has not had a release since 2022-06-09.
License · maintenance · safety
MIT (permissive) — MIT license is permissive, allowing free use, modification, and distribution with minimal restrictions.
last release 2022-06-09 (1527 days) · last repo commit 2026-06-23 · 180 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,361,255 downloads/mo, #4,002 on PyPI
Alternatives
Verify before relying
pip install pyrootutils
import pyrootutils
root = pyrootutils.setup_root(
search_from=__file__,
indicator=".project-root",
dotenv=True,
pythonpath=True,
cwd=True
)- Whether the package handles symlinks or unusual filesystem layouts reliably
- Performance characteristics when searching deeply nested directory hierarchies
- Compatibility with virtual environments and editable installs
What it is and what it does
pyrootutils solves the common problem of Python scripts failing or requiring complex relative imports when run from different working directories. It locates your project root by searching for a marker file (like .git, .project-root, or pyproject.toml) and then configures your Python environment in one step: setting PYTHONPATH so imports work relative to the root, changing the working directory, loading .env variables via its python-dotenv dependency, and optionally setting a PROJECT_ROOT environment variable.
The package is designed for developers who want scripts and notebooks to work consistently regardless of where they're executed from. It's particularly useful in projects with nested directories, notebooks in subdirectories, or teams running scripts from different locations. The setup is a single function call, making it lightweight and easy to integrate into existing projects.
Use it for
- Run Jupyter notebooks from nested subdirectories while importing from the project root
- Execute scripts from any directory without path-related failures or complex ../../../ imports
- Automatically load environment variables from .env without manual configuration in each script
- Set up CI/CD pipelines where scripts may be invoked from varying working directories
- Simplify data science projects where data paths and module imports need consistent root references
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you work with multi-directory Python projects, notebooks, or scripts that need to run from different locations.
The single-function setup and low install friction make it a practical utility. The active maintenance and zero known vulnerabilities support confidence in use. The lack of recent releases is not a concern given the package's simplicity and stable scope.
Install
pyrootutils on PyPI
Before you install
Low friction install with a single runtime dependency (python-dotenv). Maintenance status is active with recent commits, though the package itself has not had a release since 2022-06-09.
License in practice
MIT license is permissive, allowing free use, modification, and distribution with minimal restrictions.
Quickstart
pip install pyrootutils
import pyrootutils
root = pyrootutils.setup_root(
search_from=__file__,
indicator=".project-root",
dotenv=True,
pythonpath=True,
cwd=True
)
Verify before relying
- Whether the package handles symlinks or unusual filesystem layouts reliably
- Performance characteristics when searching deeply nested directory hierarchies
- Compatibility with virtual environments and editable installs
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.7.0 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepython-dotenv |
| Maintenance | Actively maintained 1,527 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,361,255 / month, #4,002 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: pyrootutils-1.0.4-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “project root finder”
- pyrootutilsFinds your project root directory and configures Python paths,…
- rootutilsFinds your project root directory and configures Python path, working…
- pyprojrootFinds your project's root directory and provides a `here()` function…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also rootutils · rootpath · pytest-pythonpath · pyprojroot · xdg-base-dirs · platformdirs · dotenv · python-discovery · django-dotenv