Skip to main content

basic-shit

Finding your project root in Python. You know, basic shit.

PyPI version License: MIT

Because apparently in 2026, Python still can't do this out of the box.

The Problem

You want to find your project root. Should be easy, right? WRONG.

Python has been around since 1991 and still doesn't have a built-in way to find your project root directory.

Want to access a file in your project? Better hope you started your script from the right directory. Or write 50 lines of os.path spaghetti. Or use __file__ with a bunch of .parent.parent.parent calls that break when you refactor.

It's 2026. This is basic shit.

The Solution

from basic_shit import get_project_root

root = get_project_root()
That's it. That's the whole library.

Installation
bash
pip install basic-shit
Usage
Basic Usage
python
from basic_shit import get_project_root

# Get your project root
root = get_project_root()

# Now use it
data_dir = root / "data"
config_file = root / "config.yaml"
How It Works
basic-shit walks up the directory tree from your current file and looks for marker files that indicate the project root:

.project_root (recommended - create this in your project root)

.git

pyproject.toml

requirements.txt

setup.py

Custom Markers
python
from basic_shit import get_project_root

# Use your own marker files
root = get_project_root(marker_files=(".mymarker", "package.json"))
The Recommended Way
Create a .project_root file in your project root:

bash
touch .project_root
Now basic-shit will find it instantly. No ambiguity. No magic. Just basic shit that works.

Why This Exists
Because I got tired of:

❌ os.path.dirname(os.path.abspath(__file__)) spaghetti

❌ Hardcoded ../../.. paths that break when you refactor

❌ os.getcwd() that depends on where you run the script from

❌ Different behavior in development vs. production

❌ Writing the same "find project root" function in every project

Why The Name?
Because finding your project root IS basic shit. And Python making it this hard is ridiculous.

Requirements
Python 3.8+

That's it. No dependencies. Because it's basic shit.

License
MIT License - because even licensing shouldn't be complicated.

Contributing
Found a bug? Have an idea? PRs welcome!

Just remember: keep it simple. This library does one thing and does it well. If your PR adds 500 lines of code, you missed the point.

Acknowledgments
Inspired by every developer who ever screamed "WHY ISN'T THIS BUILT-IN?!" at their computer.

You're not alone. We've all been there.

basic-shit - Solving Python's hardest problem since 1991. 🎯

Metadata

Release files for basic-shit 1.0.0

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

Source distribution (sdist)

Source distribution for basic-shit 1.0.0
File Size Uploaded Provenance
basic_shit-1.0.0.tar.gz 5.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for basic-shit 1.0.0
File Interpreter ABI Platform
basic_shit-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / basic_shit-1.0.0.tar.gz

Download URL basic_shit-1.0.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3b24e414dcd0bf41c14b7f464002043d4aae2c91bbc6d6ae6c168126de3e036b
BLAKE2b-256 checksum
How to use checksums
0b3ac29e44a1f2c4649c90825e4554c3f41b9eb15b1d289a582a89f3825408bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release files / basic_shit-1.0.0-py3-none-any.whl

Download URL basic_shit-1.0.0-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43c4e154bfe19d17bd84e6f247fa2fe292f29d5adfab8e9a8b16e0da995926c0
BLAKE2b-256 checksum
How to use checksums
077f57bd99a9688a7418aab846109514fff80f6203aba34e428c380746a1a967
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Security for basic-shit 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 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