The src/ Layout#
The “src-layout”
Instructs the Python interpreter where to find importable code.
Physically isolates core analysis logic from runtime execution and configuration.
A directory with an
__init__.pyis treated natively as a package.
📁 Directory Structure
.
├── scripts/
│ └── run_hello.py
├── src/
│ └── mypkgs/
│ ├── __init__.py
│ └── hello.py
├── pyproject.toml
.
🧩 Core Logic (
src/)# src/mypkgs/hello.py
def say_hello(name: str) -> None:
"""Greets a name"""
print(f"Hello {name}")
Editable (Development) Installs
Creates a system symlink to the src/ directory. Modifications to the underlying Python files are immediately reflected without requiring reinstallation.
⚙️ Installation
# Using modern uv tooling
uv sync
# Using standard pip
pip install -e .
🚀 Execution (
scripts/)# scripts/run_hello.py
from mypkgs.hello import say_hello
if __name__ == "__main__":
say_hello(name="Bob")