pyproject.toml is a TOML configuration file for packaging tools. This article explains the standardized tables [build-system], [project] and [tool], required versus optional keys, and how the file differs from a pip lock file.
python / packaging / pyproject-toml / build-system / dependencies / pip / toml
Use PurePath-family classes for portable, I/O-free path manipulation and Path/PosixPath/WindowsPath for filesystem-backed work. Do not treat lexical normalization as proof that a target exists, resolves through symlinks, or is contained.
pathlib / PurePath / Path / symlinks / resolve / filesystem checks
A step‑by‑step guide to achieve repeatable installs using pip requirements, hash verification, and wheelhouse bundles, while separating project metadata in pyproject.toml. No claims are made about json.loads or object_hook.
pip / repeatable-installs / requirements-pinning / hash-checking / wheelhouse / pyproject-toml / environment-reproducibility
The json.loads and json.load functions in Python accept bytes and bytearray inputs since version 3.6, automatically detecting UTF-8, UTF-16, or UTF-32 encoding. If the encoding is incorrect, UnicodeDecodeError is raised. The strict parameter controls handling of control characters in JSON strings. Practical scenarios and limitations are discussed.
Python 3.6+ / JSON / bytes and bytearray / UTF-8/UTF-16/UTF-32 / UnicodeDecodeError / strict parameter / pathlib / binary files
In pyproject.toml, static metadata keys are declared directly in the file, while dynamic keys are listed in the project.dynamic array so a build backend can supply their values at build time. A backend must honour statically specified keys that are not listed in dynamic, and it must raise an error if name appears in dynamic. When a key is specified both statically and in dynamic (PEP 808), the backend may only append entries and must not modify or remove existing ones.
pyproject.toml / PEP 621 / PEP 808 / build backend / dynamic metadata / versioning / setuptools_scm / reproducible builds
Learn how to control JSON serialization using separators, indentation, key sorting, and ASCII encoding to optimize for machine or human readability.
python / json / serialization / formatting / api / debugging / encoding / data-interchange
Learn to declare entry points in pyproject.toml using the three supported tables. Avoid nested subtables and duplicate definitions to prevent installation errors.
Python / Packaging / pyproject.toml / Entry Points / CLI / Scripts
Resolve the trusted base and the user path, then check containment with is_relative_to before reading. This blocks lexical traversal and symlink escapes, but not races after the check.
python / pathlib / path-traversal / security / filesystem
PEP 639 replaced the legacy license table with a single SPDX expression string and introduced license-files for glob-based license distribution, while deprecating License:: classifiers.
pyproject.toml / PEP 639 / SPDX / license-files / classifiers / packaging
To avoid version conflicts and ensure reproducible installs, use [build-system].requires for build tools only and [project].dependencies for runtime libraries. Pin exact versions in a separate requirements.txt generated with pip freeze or pip-compile.
pyproject.toml / dependencies / packaging / reproducibility / pip / pip-tools
pip freeze captures all direct and transitive dependencies in a requirements file, ensuring repeatable installations. Using --no-deps during installation adds a safety layer by preventing automatic installation of transitive dependencies. For stronger integrity guarantees, hash-checking mode with pip-compile --generate-hashes verifies downloaded artifacts, although no strategy fully eliminates repository or supply-chain risks.
pip / dependencies / install / freeze / no-deps / repeatable / security / requirements
Each key under [project.optional-dependencies] becomes a Provides-Extra entry whose dependency array elements are gated by an environment marker, so pip only installs them when the user requests the bracket syntax. Self-referencing extras compose groups but require modern package managers.
pyproject.toml / optional-dependencies / extras / self-referential-extras / PEP-621 / packaging
Use SHA-256 hash-checking when servers can still reach an index but you need tamper resistance beyond version pinning; use a wheelhouse when the server is offline or must avoid recompilation. Choose the repeatability level by environment: pinning for a cross-platform baseline, hashes for automated tamper protection, and wheelhouse for full offline isolation with portability limits.
pip / repeatable installs / SHA-256 hash-checking / wheelhouse / requirements.txt / offline deployment / server deployment / Python packaging
Hash-checking verifies artifact integrity against a pinned digest at install time, making it suitable for automated server deployments that can reach public indexes but do not need offline availability guarantees.
pip / hash-checking / wheelhouse / supply-chain / reproducible-installs / sha256 / server-deployment
Use [build-system] for build-time dependencies and [project] for runtime dependency specifiers, then keep pyproject.toml as a declaration rather than a lockfile. For repeatable installs, generate a separate pinned requirements file, add hash-checking, or build a wheelhouse bundle instead of overloading pyproject.toml with locked install state.
pyproject.toml / build-system / project metadata / repeatable installs / pip / pinning / hash-checking / wheelhouse
Reproducibility is built in layers: exact version pins, SHA-256 artifact hashes, and a bundled wheelhouse for offline installs. Each layer removes a different source of drift, and none of them replaces pyproject.toml, which describes how the project itself is built.
python / dependency-management / pip / reproducibility / sha256 / wheelhouse / packaging / pyproject-toml
pyproject.toml is a TOML configuration file for packaging tools. Learn how [build-system], [project] and [tool] tables, dependencies and entry points fit together, and how they relate to repeatable pip installs.
python / packaging / pyproject.toml / pip / entry-points
A guide to using the Python csv module to automatically detect delimiters, handle Unicode Byte Order Marks (BOM) with utf-8-sig, and manage platform-specific newline issues using the Sniffer class and correct file opening parameters.
python / csv / data-processing / encoding / utf-8-sig / automation
Use default or a JSONEncoder subclass to convert unsupported Python values into an explicit JSON representation. An unhandled TypeError stops the whole dump. Add object_hook only when you need to reconstruct custom types from marker objects.
json / serialization / JSONEncoder / default / object_hook / python-standard-library / datetime / complex
A wheelhouse is a pre-built directory of wheels created on a network-connected build machine and installed offline on a target machine. Pin a requirements file, run pip wheel, archive with tar, then install with --no-index --no-deps --force-reinstall.
wheelhouse / offline-install / pip-wheel / repeatable-installs / hash-checking / requirements-file / pyproject-toml / build-dependencies
Exact version pins help repeat installs, while hashes check downloaded files. Neither guarantees identical build output. Record the build backend, Python version, platform, and relevant environment inputs.
Python / pyproject.toml / dependencies / reproducibility / pip / hash-checking / build-system / release-contract
How to read, modify, and synchronize environment variables in Python using os.environ and os.environb, handle encoding differences across platforms, and pass environment to child processes.
os.environ / os.environb / environment-variables / python-os / utf8-mode / cross-platform / child-process / reload_environ
Distinguish missing and empty settings, parse ports and booleans explicitly, and report configuration errors without exposing secrets.
Python / Configuration / Environment / Validation
Use ISO timestamp strings and decimal strings, then reconstruct the fields explicitly. A complete standard-library example shows timezone checks, precision and predictable failures.
JSON / Serialization / Deserialization / Datetime / Decimal / Python / Data Contract / Type Handling