Support for uv
Snyk support for the uv package manager with Python, available in Early Access on Enterprise plans through the CLI and SCM
Release status
CLI and SCM support for uv is in Early Access and available only with Enterprise plans. To enable the feature, visit Snyk Preview.
CLI support for uv
Prerequites
Ensure you have uv version 0.9.29 or later installed.
Snyk uses the uv.lock file to build the dependency graph for a uv application. This file must be present for Snyk to identify the Project, scan dependencies, and identify issues. Ensure you check this file into your repository and that it reflects your current pyproject.toml. That is, ensure you run uv lock after adding, removing, or updating dependencies.
You do not need to run uv sync before you run the Snyk CLI.
Test results are not specific to the platform where you run the test. For example, if your uv Project has a Windows-only dependency with a vulnerability, this vulnerability also appears in the results if you run your test on Linux. Contact Snyk to provide feedback on this behavior or if you want to narrow down results to the platform where you run the test, either by default or using a flag.
Supported commands and options
Snyk supports the snyk test, snyk monitor, and snyk sbom commands.
snyk test
snyk testThe following flags, options, and arguments are not available:
--detection-depth: There is no maximum depth for directory traversal. In later releases, Snyk scans onlyuvProjects in directories up to the given depth.--print-deps: The test incorrectly fails with aCould not detect supported target fileserror. In later releases, Snyk outputs dependency graphs for all found Projects without running a test.Input directory positional argument: When you run
snyk test <directory>, Snyk ignores the directory. In later releases, Snyk scans only the specified directory.
The following flags and options are supported with limitations:
--file: Snyk respects this flag only foruv.lockfiles. In later releases, Snyk supportspyproject.tomlmanifest files (both root and workspace packages).--exclude: This flag works only to excludeuv.lockfiles. In later releases, this option supports workspace packages. For example,--exclude=fooexcludes all dependencies frompackages/foo/pyproject.toml.
For uv, the --package-manager option is not supported because uv does not permit lockfiles with names other than uv.lock.
snyk monitor
snyk monitorSnyk does not render error messages from the uv plugin in the traditional CLI error style.
snyk sbom
snyk sbomFor SBOMs generated for uv Projects:
When you generate an SBOM in a monorepo containing both
uvand Maven Projects using the--all-projectsflag, Snyk prunes some Maven dependencies in the resulting SBOM. All dependencies appear in the graph, but there are fewer instances than expected. When there are nouvProjects present, all dependencies are present as expected for Maven Projects.
SCM support for uv
Snyk imports and tests uv Projects directly from your connected Git repositories.
Snyk resolves the following:
Direct and transitive dependencies from
uv.lock.Git-sourced dependencies (
[tool.uv.sources]with a git entry) in a standard, non-workspace project, and their transitive dependencies.For
uvworkspaces, Snyk imports the rootpyproject.toml. Snyk includes workspace members that the root depends on as path dependencies in the root Snyk Project's graph.
Prerequisites
The repository must contain a uv project: a pyproject.toml and a uv.lock file in the same directory. Both files are required.
You must have a connected SCM integration on an Organization, on the Enterprise plan, with the uv SCM Preview feature enabled.
How Snyk discovers uv Projects
When you import a repository, Snyk scans every directory for a pyproject.toml and uv.lock pair and creates one Snyk Project per pair.
Both files must be in the same directory. If a directory contains only a
pyproject.toml(no lock file) or only auv.lock(no manifest file), Snyk does not create a Project.When both
uv.lockandpoetry.lockexist for the samepyproject.toml,uv.locktakes precedence, and Snyk identifies the Project as auvProject.Snyk identifies a
requirements.txtin the same repository as a separate pip Project, independent of theuvProject.Snyk identifies Projects by path. Two directories with byte-identical manifests, therefore, become two separate Projects.
Snyk does not support the following dependencies:
Dev-dependency groups (PEP 735
[dependency-groups])Mixed git/URL/path sources in workspace members
Optional extras (
[project.optional-dependencies])
Last updated
Was this helpful?

