Learn Python - Free Tutorials & AI Guides

Free Python Tutorials, AI Guides & Coding Projects

Python Dev Tools
How virtualenv Works: A Source Tour of the Venv Builder Behind Every Python Project

How virtualenv Works: A Source Tour of the Venv Builder Behind Every Python P...

Every CI job running tox, every pre-commit hook, every scratch install eventually reaches the same few thousand lines of Python that pypa/virtualenv keeps polishing. When it misbehaves, the symptoms are annoying: a fresh environment with no pip inside it, an...

Python Dev Tools
How tox Works: A tox 4 Source Tour from tox.ini Parsing to Virtualenv Runs

How tox Works: A tox 4 Source Tour from tox.ini Parsing to Virtualenv Runs

Every Python team eventually hits the same wall: the test suite passes on one interpreter and explodes on another, or the package installs fine locally and fails in CI because a dependency drifted. The usual prescription is tox — the...

Python Dev Tools
Ruff Source Tour: Inside the Rust Engine Driving 900+ Python Lint Rules

Ruff Source Tour: Inside the Rust Engine Driving 900+ Python Lint Rules

Every Python team eventually pays the lint tax. Flake8 plus isort plus a formatter means three tools, three config formats, and a CI job that crawls through a large monorepo one interpreter process at a time. On a million-line repository,...

Python Dev Tools
pytest Source Tour: How Hooks, Fixtures, and Assertion Rewriting Actually Work

pytest Source Tour: How Hooks, Fixtures, and Assertion Rewriting Actually Work

If you have ever watched ten thousand green dots scroll past a CI log and then had one red F ruin your afternoon, you have pytest to thank for both experiences. The library is so good at hiding its work...

Python Dev Tools
How pre-commit Works: A Source Tour of the Hook Store, the Stash, and the Run Loop

How pre-commit Works: A Source Tour of the Hook Store, the Stash, and the Run...

Every Python developer eventually meets the same two villains. First: you clone a repo, run git commit, and the terminal freezes for four minutes while it prints “Installing environment for https://github.com/psf/black” — with no idea where those gigabytes went or...

Python Dev Tools
nox Source Tour: From @nox.session to a Finished Session Run

nox Source Tour: From @nox.session to a Finished Session Run

Every Python team eventually hits the same wall: the test matrix grows, conda users and pip users must coexist, docs and lint jobs join the party, and “just run pytest” quietly becomes a shell script nobody dares touch. nox is...

Python Dev Tools
Hypothesis Source Tour: Inside the Property-Based Testing Engine That Shrinks Your Bugs

Hypothesis Source Tour: Inside the Property-Based Testing Engine That Shrinks...

Every developer knows this failure mode. Your test suite is green, coverage looks healthy, and then production falls over on an input nobody imagined: an empty string, a four-byte unicode sequence, a leap-year boundary, a list containing exactly two elements....

Python Dev Tools
coverage.py Internals: How Python Code Coverage Really Measures Your Tests

coverage.py Internals: How Python Code Coverage Really Measures Your Tests

You raise the coverage gate to 85%, CI turns green, and two weeks later production fails in the exact branch nobody ever exercised. That gap between “the number looks good” and “the code actually ran” is where most teams develop...

Python Dev Tools
Black Formatter Internals: A Source Tour of Python's Uncompromising Formatter

Black Formatter Internals: A Source Tour of Python's Uncompromising Formatter

Every Python team eventually runs into the same argument: do we sort imports, where does the closing bracket go, is 79 characters enough, and who gets to decide? The black project ended that debate by refusing to have it. You...

Python Dev Tools
Bandit Source Tour: Inside PyCQA's AST-Based Security Scanner for Python

Bandit Source Tour: Inside PyCQA's AST-Based Security Scanner for Python

Every Python codebase has that one diff nobody wants to review: a new subprocess.Popen call that quietly grew a shell=True, a yaml.load() on a requests payload, an API token pasted straight into a test fixture. Code review catches some of...

Python Packaging
How Python wheels are built: a source tour of bdist_wheel, tag algebra and RECORD hashing

How Python wheels are built: a source tour of bdist_wheel, tag algebra and RE...

Every Python developer has lived both sides of the wheel story: pip install landing in two seconds because a compatible .whl sat on PyPI, versus the silent sdist fallback, a local compiler grinding away, and a “failed building wheel for...

Python Packaging
Twine Source Explained: How Python Packages Actually Reach PyPI

Twine Source Explained: How Python Packages Actually Reach PyPI

Every Python developer has met this wall: you build your package, run twine upload dist/*, and PyPI answers with an opaque 400 Bad Request — or worse, a 403 that tells you the credentials were rejected without saying which credential....

Python Packaging
setuptools Source Tour: How dist.py, build_meta.py and the distutils Shim Actually Build a Wheel

setuptools Source Tour: How dist.py, build_meta.py and the distutils Shim Act...

Every Python developer has met this failure at least once: pip install . fails inside an isolated build environment, and the traceback ends somewhere inside setuptools.build_meta or a distutils import that “does not exist” even though the code clearly imports...

Python Packaging
Poetry Source Code: How the Solver, Marker Split and pyproject Loading Really Work

Poetry Source Code: How the Solver, Marker Split and pyproject Loading Really...

Every Python developer knows the moment: you run poetry install, the terminal prints “Resolving dependencies…”, and then you either get a clean lock in seconds or a wall of conflict text about versions you never asked for. Poetry is the...

Python Packaging
How pipx Works: venv Isolation, Shared pip, and the uv Backend

How pipx Works: venv Isolation, Shared pip, and the uv Backend

Every Python developer has been burned by the same mistake: pip install some-cli into the interpreter the system uses, then months later another tool demands a different requests version and the first command starts crashing. Or worse, the tool’s executable...

Python Packaging
How Pipenv Works: A Source Tour of Pipfile Locking, do_install and the Resolver Subprocess

How Pipenv Works: A Source Tour of Pipfile Locking, do_install and the Resolv...

Every Python developer has felt pipenv’s peculiar pain: you run pipenv install, wait through a resolve that seems to take forever, then stare at a Pipfile.lock wondering why the virtualenv directory ends with a cryptic eight-character hash. Or worse —...

Python Packaging
pip Source Tour: How pip install Resolves, Downloads and Builds Packages in src/pip/_internal

pip Source Tour: How pip install Resolves, Downloads and Builds Packages in s...

Everyone knows the moment: you run pip install on a project with a couple of transitive dependencies, and the tool starts backtracking through every version of every package, downloading metadata, building wheels from sdists, and minutes later either solves your...

Python Packaging
Inside Hatch: How the hatchling Build Backend Builds Wheels and the CLI Runs Environment Matrices

Inside Hatch: How the hatchling Build Backend Builds Wheels and the CLI Runs ...

Every Python project that ships to PyPI eventually meets a build backend, and most of us meet it as an opaque black box: pip install prints a wall of “Building wheel” output, something called RECORD fails a hash check, an...

Python Packaging
How conda Works: The Classic SAT Solver, the Rattler Default, and the Link Transaction

How conda Works: The Classic SAT Solver, the Rattler Default, and the Link Tr...

Every developer who has leaned on conda has met the same screen: a spinner that says Solving environment: and refuses to finish, followed by an UnsatisfiableError that names a dozen packages but explains nothing. The frustration is structural, not cosmetic....

Python Packaging
pypa/build Internals: How python -m build Isolates Envs and Drives PEP 517 Backends

pypa/build Internals: How python -m build Isolates Envs and Drives PEP 517 Ba...

Every Python developer eventually meets the same ghost: pip install . works on your laptop, then a clean CI runner fails with “Backend ‘setuptools.build_meta’ is not available” or a cryptic unmet-dependency dump. What broke is the environment — a leftover...

Desktop
Wails Architecture Deep Dive: Go Runtime, Bindings Generator and the Webview Bridge

Wails Architecture Deep Dive: Go Runtime, Bindings Generator and the Webview ...

Every Go developer shipping a desktop tool eventually hits the GUI question. Electron answers it with Chromium and a Node process, and your 8 MB CLI becomes a 150 MB installer idling at 300 MB of RAM. Tauri answers it...

Desktop
Tauri Architecture Explained: Inside the Rust Core, IPC and the Capability ACL

Tauri Architecture Explained: Inside the Rust Core, IPC and the Capability ACL

Every desktop developer knows the tradeoff. Electron gives you one codebase and ships an entire Chromium instance per app — a hundred megabytes before your first feature. Native toolkits give you tiny binaries and three platform-specific codebases. Tauri’s pitch is...

Scientific Python
How SymPy Works: A Source Tour of Expression Trees, Assumptions and Polynomial Algebra

How SymPy Works: A Source Tour of Expression Trees, Assumptions and Polynomia...

Every numeric programmer eventually hits the same wall: 0.1 + 0.2 is not 0.3, and no amount of floating-point care will make (x + y)**2 expand itself. Symbolic math systems solve this by refusing to evaluate. When you write x...

Scientific Python
How Statsmodels Works: OLS, GLM and ARIMA Behind One LikelihoodModel Contract

How Statsmodels Works: OLS, GLM and ARIMA Behind One LikelihoodModel Contract

You have typed sm.OLS(y, X).fit() a hundred times without thinking about it. Then one day the results object surprises you: .params comes back as a pandas Series carrying your column names, .bse does the same, .conf_int() returns a DataFrame —...

Watch PyShine on YouTube