Finding your project root in Python. You know, basic shit.
Project description
basic-shit
Finding your project root in Python. You know, basic shit.
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. 🎯
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 basic_shit-1.0.0.tar.gz.
File metadata
- Download URL: basic_shit-1.0.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b24e414dcd0bf41c14b7f464002043d4aae2c91bbc6d6ae6c168126de3e036b
|
|
| MD5 |
10fbf5f211bee1d0115654e61b8cb3cc
|
|
| BLAKE2b-256 |
0b3ac29e44a1f2c4649c90825e4554c3f41b9eb15b1d289a582a89f3825408bf
|
File details
Details for the file basic_shit-1.0.0-py3-none-any.whl.
File metadata
- Download URL: basic_shit-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43c4e154bfe19d17bd84e6f247fa2fe292f29d5adfab8e9a8b16e0da995926c0
|
|
| MD5 |
6b5d59f1ba98578e7bce05d6f54239ac
|
|
| BLAKE2b-256 |
077f57bd99a9688a7418aab846109514fff80f6203aba34e428c380746a1a967
|