Skip to content

Exporting a lockfileロックファイルのエクスポート

uv can export a lockfile to different formats for integration with other tools and workflows. The uv export command supports multiple output formats, each suited to different use cases.uvは、他のツールやワークフローとの統合のために、ロックファイルを異なる形式にエクスポートできます。 uv exportコマンドは、さまざまな出力形式をサポートしており、それぞれ異なるユースケースに適しています。

For more details on lockfiles and how they're created, see the project layout and locking and syncing documentation.ロックファイルの詳細とその作成方法については、プロジェクトレイアウトおよび ロックと同期のドキュメントを参照してください。

Overview of export formatsエクスポート形式の概要

uv supports three export formats:uvは3つのエクスポート形式をサポートしています:

The format can be specified with the --format flag:形式は--formatフラグで指定できます:

$ uv export --format requirements.txt
$ uv export --format pylock.toml
$ uv export --format cyclonedx1.5

Tipヒント

By default, uv export prints to stdout. Use --output-file to write to a file for any format:デフォルトでは、uv exportはstdoutに出力します。任意の形式でファイルに書き込むには--output-fileを使用します:

$ uv export --format requirements.txt --output-file requirements.txt
$ uv export --format pylock.toml --output-file pylock.toml
$ uv export --format cyclonedx1.5 --output-file sbom.json

requirements.txt formatrequirements.txt形式

The requirements.txt format is the most widely supported format for Python dependencies. It can be used with pip and other Python package managers.requirements.txt形式は、Python依存関係に最も広くサポートされている形式です。pipや他のPythonパッケージマネージャーと一緒に使用できます。

Basic usage基本的な使用法

$ uv export --format requirements.txt

The generated requirements.txt file can then be installed via uv pip install, or with other tools like pip.生成されたrequirements.txtファイルは、uv pip installを介して、またはpipのような他のツールでインストールできます。

Note注意

In general, we recommend against using both a uv.lock and a requirements.txt file. The uv.lock format is more powerful and includes features that cannot be expressed in requirements.txt. If you find yourself exporting a uv.lock file, consider opening an issue to discuss your use case.一般的に、uv.lockrequirements.txtファイルの両方を使用することは推奨しません。uv.lock形式はより強力で、requirements.txtでは表現できない機能が含まれています。uv.lockファイルをエクスポートする必要がある場合は、使用ケースについて議論するために問題を開くことを検討してください。

pylock.toml formatpylock.toml形式

PEP 751 defines a TOML-based lockfile format for Python dependencies. uv can export your project's dependency lockfile to this format.PEP 751 は、Pythonの依存関係のためのTOMLベースのロックファイル形式を定義しています。uvは、プロジェクトの依存関係ロックファイルをこの形式にエクスポートできます。

Basic usage基本的な使用法

$ uv export --format pylock.toml

CycloneDX SBOM formatCycloneDX SBOM形式

uv can export your project's dependency lockfile as a Software Bill of Materials (SBOM) in CycloneDX format. SBOMs provide a comprehensive inventory of all software components in your application, which is useful for security auditing, compliance, and supply chain transparency.uvは、プロジェクトの依存関係ロックファイルをCycloneDX形式のソフトウェア部品表(SBOM)としてエクスポートできます。SBOMは、アプリケーション内のすべてのソフトウェアコンポーネントの包括的なインベントリを提供し、セキュリティ監査、コンプライアンス、サプライチェーンの透明性に役立ちます。

Important重要

Support for exporting to CycloneDX is in preview, and may change in any future release.CycloneDXへのエクスポートのサポートはプレビューにあり、今後のリリースで変更される可能性があります。

What is CycloneDX?CycloneDXとは何ですか?

CycloneDX is an industry-standard format for creating Software Bill of Materials. CycloneDX is machine readable and widely supported by security scanning tools, vulnerability databases, and Software Composition Analysis (SCA) platforms.CycloneDXは、ソフトウェア部品表を作成するための業界標準形式です。CycloneDXは機械可読であり、セキュリティスキャンツール、脆弱性データベース、ソフトウェア構成分析(SCA)プラットフォームによって広くサポートされています。

Basic usage基本的な使用法

To export your project's lockfile as a CycloneDX SBOM:プロジェクトのロックファイルをCycloneDX SBOMとしてエクスポートするには:

$ uv export --format cyclonedx1.5

This will generate a JSON-encoded CycloneDX v1.5 document containing your project and all of its dependencies.これにより、プロジェクトとそのすべての依存関係を含むJSONエンコードされたCycloneDX v1.5ドキュメントが生成されます。

SBOM StructureSBOMの構造

The generated SBOM follows the CycloneDX specification. uv also includes the following custom properties on components:生成されたSBOMは、 CycloneDX仕様に従っています。uvはまた、コンポーネントに以下のカスタムプロパティを含みます:

  • uv:package:marker: Environment markers (e.g., python_version >= "3.8")uv:package:marker: 環境マーカー(例:python_version >= "3.8"
  • uv:workspace:path: Relative path for workspace membersuv:workspace:path: ワークスペースメンバーの相対パス

Next steps次のステップ

To learn more about lockfiles and exporting, see the locking and syncing documentation and the command reference.ロックファイルとエクスポートについて詳しくは、ロックと同期のドキュメントと、コマンドリファレンスを参照してください。

Or, read on to learn how to build and publish your project to a package index.または、パッケージインデックスにプロジェクトを構築して公開する方法を学ぶために読み進めてください。