Guide · CRAClock · EU Cyber Resilience Act
How to generate an SBOM from requirements.txt
By the Ingenious AI team · Published 14 November 2026 · Reviewed 14 November 2026
Short answer: Paste the file into the free CRAClock job: each parseable line becomes a CycloneDX component named by its package (lowercased in the purl), with the version taken from an exact == pin. Lines the parser cannot use — editable installs, direct URLs, option lines — are skipped and counted in the summary, never silently dropped. Requirements without an exact pin still produce a component, but without a version, which is why the checklist pushes for == pins: only exact versions can be matched against vulnerability data.
Generate your free SBOM + readiness pack → Compare two releases free · See pricing
What is a requirements.txt SBOM?
A requirements.txt SBOM is a CycloneDX inventory generated by parsing a Python requirements file line by line. CRAClock's parser reads each line's package name and, where the line pins an exact version with ==, that version; it builds purls of the form pkg:pypi/<lowercased-name>@<version>; and it reports lines it had to skip — editable installs, URL references, options — in the parse summary. The SBOM therefore describes exactly what the requirements file declares, with its blind spots counted rather than concealed.
The parse, line by line
The parser's job is conservative: take from each line only what the line actually states. A line like requests==2.32.0 yields a component named requests at version 2.32.0, purl pkg:pypi/[email protected]. A line naming a package with a looser specifier yields the component without a claimed version — present in the inventory, honestly unversioned. Comment lines and blank lines are ignored; lines pointing at editable installs (-e), direct URLs or pip options are skipped, and the skip count appears in the job's summary so you can see the file's unparsed remainder.
That conservatism is the feature. A generator that guessed versions from loose specifiers would produce a beautiful SBOM full of small lies, each one capable of flipping a vulnerability match. The requirements parser instead mirrors the file's own precision — which is why improving the SBOM starts with improving the file, a theme the pinning guide develops fully.
Why == is the pin that matters
Pip's specifier grammar offers many ways to constrain a version, but only the exact pin states the version the environment is meant to run. Vulnerability data is organised by exact affected versions; matching asks 'is version X affected?', and only a manifest that answers 'we run exactly X' gets a reliable answer. Every non-exact specifier leaves the scanner to either guess (dishonest) or report the component as unmatchable (the honest outcome CRAClock's checklist surfaces in its pinning item).
The practical guidance follows: requirements files that feed production should pin with ==, ideally generated from the environment that actually runs (the pip freeze discipline) so the file describes a tested reality rather than an intention. When the SBOM's summary shows components without versions, read it as a work list — each entry is a place where your vulnerability visibility has a hole shaped exactly like that package.
Skipped lines: reading the count
The skipped-lines count is the summary's most underread number. Editable installs point at source checkouts whose contents the file does not declare; URL references fetch artefacts the file does not version; both are real components of the running product that the SBOM cannot see. A skip count of zero means the file fully declares the product (in the manifest's own terms); a growing count means a growing invisible region, and the right response is to bring those dependencies into declared, pinned form where possible.
Treat persistent skips as documented exceptions, not background noise: note them in the evidence, with the reason the dependency is sourced that way and how its version is tracked instead. An assessor who finds a skip count matched by an explanation sees a vendor in control of its inventory's edges; a skip count nobody has read is a question waiting to be asked by someone else.
Keeping the generated SBOM current
A requirements.txt SBOM ages at the speed of the file. The operating rule is simple: regenerate whenever the file changes, and diff the new SBOM against the previous one to see precisely what changed — the SBOM diff classifies additions, removals and changes with priorities, so the dependency bump that used to be a commit-message shrug becomes a reviewed event. Stored per release, the series is the product's composition history.
For teams whose requirements file is generated from a higher-level tool (a Pipfile, a poetry project, a constraints process), generate the SBOM from the file closest to what actually installs — the lock or the frozen requirements — because the SBOM's job is to describe the product that ships, not the intentions that preceded it. CRAClock accepts requirements.txt and Pipfile.lock precisely to cover both the declared and the locked views of a Python product.
The requirements SBOM in the CRA file
In the conformity evidence, the requirements-derived SBOM plays the same role as any other: the product's composition record, cited by its serial, refreshed per release. Its parse summary — parsed, pinned, skipped — belongs with it, because the summary is the inventory's own quality statement. A reviewer can then see not only what the product contains but how completely the manifest declares it, which is the difference between an SBOM as a file and an SBOM as a practice.
If your requirements discipline improves over time — pins added, skips eliminated — the summary numbers across the series tell that story without a word of narrative. That is the quiet power of generating rather than authoring: the evidence improves as the engineering does, automatically, in the same artefacts.
Your 5-action checklist
- Paste your production requirements.txt into the free CRAClock job and note the three summary numbers: parsed, pinned, skipped.
- For every component without a version, convert its specifier to an exact == pin of the version you actually run.
- For every skipped line, either bring the dependency into declared pinned form or record it as a documented exception.
- Regenerate the SBOM, confirm pinned equals parsed, and store the document and its summary in the vault.
- At each release, regenerate and diff; review any component change the diff raises before shipping.
Work through the list in order. The free CRAClock job on the home page produces the SBOM, the dated checklist and the reporting runbook that several of these actions depend on.
Worked example: 3 skips, 5 unpinned, one afternoon
A fictional vendor's first requirements SBOM parsed 36 components: 31 pinned, 5 without versions, and 3 skipped lines. The skips were an editable install of an internal package and two URL-referenced wheels — the product's least governed dependencies, now visible as a number. The 5 unpinned entries included the HTTP library at the product's core, specified with a range that had silently admitted 3 different versions across the year.
The afternoon's fixes were mechanical: == pins for the 5 (versions taken from the running environment), the internal package published and pinned, the two wheels moved to a declared index. The regenerated SBOM read 38 components, 38 pinned, 0 skipped — and the next OSV scan, matching exact versions for the first time, cleared 2 components the team had been vaguely worried about and flagged 1 they had never suspected. Precision, it turned out, was worth more than worry in both directions.
Keep going
- Free SBOM + readiness pack — paste a manifest, get the CycloneDX SBOM, checklist and runbook.
- SBOM change-to-impact analysis — diff two releases before you ship.
- CRAClock pricing — Free, Pro $29/month and Team $79/month.
- All CRAClock guides — the full library for small EU software vendors.
- CRAClock console — products, scans, incidents, vault and trust pages.
- What is an SBOM and why does the CRA require one?
- How to generate an SBOM from Pipfile.lock
- Why pin dependencies to exact versions for CRA compliance?
- What are the limitations of a manifest-based SBOM?
- How to diff two SBOMs between releases
- What is the risk of unpinned dependencies?
- What is a CycloneDX SBOM?
Frequently asked questions
My requirements file uses >= ranges. Will the SBOM still generate?
Yes — the components are generated, but without claimed versions, and the checklist's pinning item will show them as the gap they are. The SBOM stays honest; the fix is in the manifest: pin exact versions with == so matching becomes possible.
What happens to comments and blank lines?
They are ignored by the parser. Option lines, editable installs and URL references are skipped and counted in the summary — visible, not silent — so you always know how much of the file the SBOM could not use.
Should I generate from requirements.txt or from my lockfile?
From whichever file describes what actually installs. If a Pipfile.lock governs the environment, its SBOM (exact versions by construction) is the truer inventory. Many vendors keep both views; CRAClock parses both formats.
Does the parser include transitive dependencies?
It includes the lines the file declares. A frozen requirements file (pip freeze output) lists the full installed set, which is one reason generating requirements from the running environment produces the most complete declared inventory.
How are package names normalised in the SBOM?
Names are lowercased in the purl (pkg:pypi/<name>@<version>), matching PyPI's canonical identity, so matches against ecosystem data line up regardless of the capitalisation in your file.
CRAClock prepares drafts and evidence; regulatory submission is always performed by you in ENISA's Single Reporting Platform. This guide is general information about the duties CRAClock supports, not legal advice.