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
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
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
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
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