python-dotenv is a production-grade Python library that reads key-value pairs from .env files and sets them as environment variables, following the 12-factor configuration principles. It is widely used in development and deployment workflows to separate configuration from code. The library provides both programmatic APIs and a command-line interface for managing environment variables without manual file editing. The architecture centers on the `DotEnv` class, which orchestrates parsing, variable interpolation, and environment loading. Parsing is handled by a custom streaming parser (`parser.py`) that uses a `Reader` with position tracking and regex-based tokenization to handle single/double quoted values, comments, escape sequences, and UTF-8 BOM stripping. Variable expansion (`variables.py`) implements POSIX-style `${VAR:-default}` interpolation using an `Atom` abstract base class with `Literal` and `Variable` strategies. The core library has zero external dependencies; the CLI (built on `click`) and IPython integration are optional extras. Key entry points include `load_dotenv()` (loads .env into `os.environ`), `dotenv_values()` (returns a dict without touching the environment), `set_key()`/`unset_key()` for programmatic file manipulation, and `find_dotenv()` for locating .env files. The CLI offers `list`, `get`, `set`, `unset`, and `run` subcommands, with support for JSON/shell/export output formats. The IPython `%dotenv` magic provides interactive loading. Data flows from file or stream through the parser into an ordered dict, with optional interpolation and override control. External dependencies are minimal: `click` for the CLI, `IPython` for the magic extension, and standard library modules (`os`, `io`, `re`, `tempfile`, `pathlib`, etc.). The library supports Python 3.10–3.14 (including free-threaded 3.14t) and PyPy 3.11, with comprehensive CI testing across Linux and Windows.
jupyter-manim is a Jupyter/IPython extension that provides a `%%manim` cell magic for rendering Manim animations and displaying the resulting video or GIF inline in notebooks. It integrates with the manimlib library (specifically the Cairo backend) to execute scene definitions defined in notebook cells, handles exporting notebook variables to the Manim script via pickling, extracts imports from the notebook's global scope, and captures Manim's output to locate and display the generated media file. The architecture centers around the `ManimMagics` class in `jupyter_manim/__init__.py`, which orchestrates the execution flow: executing cell code for early feedback, preparing a temporary script with exported variables and imports, invoking manimlib.main(), and rendering the output using IPython's display system. While the project is functional and serves its niche purpose well, it shows signs of technical drift through inconsistent versioning between setup.py and __init__.py, lack of testing on modern Python versions (only 3.6 and 3.7 in CI), and an aging Travis CI configuration. The codebase contains several reusable utilities such as StringIOWithCallback for stdout capture, is_pickable for safe serialization checks, find_ipython_frame for accessing the user namespace, and video/gif helpers for media display, which demonstrate solid craftsmanship and could be extracted for use in other Jupyter extensions.