Runtime dependencies are packages needed after installation, when the application runs. Build requirements are packages needed earlier, while a distribution is being prepared or compiled. In Python packaging, build requirements may be installed in an ephemeral environment and never appear in the final environment, which is why they can evade standard lockfile-based review unless the tooling explicitly includes them.
How runtime dependencies differ from build requirements
Runtime dependencies are the packages your code needs after installation, so they must be present whenever the application is executed. Build requirements are only needed while preparing a distribution, such as creating a wheel or source distribution, and can live in a temporary build environment. The practical difference is scope, timing, and whether the dependency must exist in the deployed runtime environment.
That distinction matters because a package can be essential to produce installable artifacts without being part of the application’s operational dependency set. A typical example is a build backend, code generator, or compiler extension that is invoked during packaging but not imported by the running application. If you only audit the final environment, build-only packages can be missed entirely.
For teams using modern Python packaging, the cleanest mental model is: runtime dependencies answer “what must be installed for the app to function,” while build requirements answer “what must exist long enough to produce the artifact.” This is also why packaging metadata splits these concerns, and why tools that resolve only runtime graphs can give an incomplete picture of what was actually used to build the release.
Why the split affects security and supply-chain review
The split creates a visibility gap when organisations treat the runtime lockfile as the whole bill of materials. Build requirements may be fetched into an ephemeral environment, used once, and discarded, which means they can evade ordinary review, allowlist checks, and some forms of drift detection. That is especially important in Python ecosystems where build steps can execute code before the final package is ever installed. Python Packaging and pip Security Guide is useful background for the surrounding install controls.
Security exposure rises when build tooling can reach package indexes, secrets, or CI credentials that the production application never needs. A malicious or compromised build dependency can alter the artifact, inject code, or exfiltrate tokens during packaging. In other words, the build environment is part of the trust boundary, even if it is not part of the runtime footprint.
That is why build requirements deserve separate scrutiny in release pipelines, especially for projects that compile native extensions, generate code, or build from source. In those cases, the build step is not just a convenience layer, it is a control point where provenance and integrity can be lost if the dependency set is not pinned and reviewable.
How to separate and verify them in practice
Runtime dependencies should be checked against the installed application environment, while build requirements should be checked against the packaging workflow and its isolated build context. The important question is whether the dependency influences execution, artifact creation, or both. If it only influences artifact creation, it belongs in the build side of the analysis, not the runtime side.
In Python packaging, that means verifying three things: what the project declares for installation, what the build backend needs to assemble the distribution, and whether the build process introduces additional transitive requirements that are not visible in the final deployment image. If your tooling supports it, review both the source metadata and the resolved build environment rather than relying on one lockfile alone.
For release engineering, the most reliable pattern is to make build inputs explicit, reproducible, and isolated. When build dependencies are hidden inside ad hoc CI jobs or developer machines, you lose auditability and make it harder to explain why two apparently identical releases were produced from different inputs.
Risk and Threat Considerations
The main risk is not that build requirements exist, but that they can be overlooked because they are temporary and environment-specific. That creates blind spots in software supply-chain review, especially when a build dependency is compromised or when the build environment has broader network or secret access than the runtime service.
Failure mechanism: A dependency used only during packaging can alter the artifact, execute unexpected code, or access sensitive build-time resources before the final package is published or deployed.
Impact: The released artifact may carry malicious or unintended behaviour even though the runtime dependency review looked clean, which weakens provenance, trust, and incident investigation.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
CIS Controls v8, NIST SP 800-53 Rev 5 and SLSA set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| CIS Controls v8 | CIS-16 — Application Software Security | Build vs runtime dependency separation is part of secure software delivery. |
| Recommendation — Review build inputs and release pipelines to prevent untrusted packaging dependencies from altering artifacts. | ||
| NIST SP 800-53 Rev 5 | CM-8 — System Component Inventory | Distinguishing build and runtime components depends on knowing what enters the artifact and environment. |
| SA-15 — Development Process, Standards, and Tools | Packaging workflows need governed build tooling and repeatable release processes. | |
| Recommendation — Maintain an inventory of build and runtime components to detect missing or unexpected software inputs. Standardize build tooling and release practices so packaging inputs are controlled and repeatable. | ||
| SLSA | Supply-chain Levels for Software Artifacts | SLSA directly addresses provenance and integrity of build-produced artifacts. |
| Recommendation — Adopt provenance controls so build-time dependencies and artifact creation are traceable and verifiable. | ||
Practitioner Guidance
What to verify: Confirm that your packaging workflow distinguishes declared runtime dependencies from build-system requirements, and verify that both are resolved from trusted sources under reproducible conditions. If the build step can reach secrets, signing material, or publishing credentials, treat that environment as security-sensitive in its own right.
Common mistake: Teams often secure the deployment image but ignore the build environment, assuming the final lockfile represents the full dependency set. That assumption breaks when a source distribution, build backend, or compiled extension introduces extra inputs outside the runtime graph.
Practitioner takeaway: The security boundary in Python packaging is not the installed environment alone, it is the full path from source to artifact, including whatever was needed only long enough to build it.
Related resources from NHI Mgmt Group
- How can security teams detect and contain a malicious Python dependency before it spreads across build and runtime systems?
- What breaks when a trusted Python package is compromised in a cloud build or runtime environment?
- How should security teams build a shift-left DevSecOps toolchain across code, dependencies, infrastructure, containers, APIs, secrets, tests, and runtime?
- Why do source distributions used as build requirements increase supply chain risk for Python installs?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on October 31, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org