Skip to content

How to use custom Python distributionsカスタム Python ディストリビューションの使用方法


The built-in Python management capabilities offer full support for using custom distributions.組み込みの Python 管理 機能は、カスタムディストリビューションの使用を完全にサポートしています。

Configuration設定

Configuring custom Python distributions is done entirely through three environment variables that must all be defined, for each desired distribution. In the following sections, the placeholder <NAME> is the uppercased version of the distribution name with periods replaced by underscores e.g. pypy3.10 would become PYPY3_10.カスタム Python ディストリビューションの設定は、すべての希望するディストリビューションについて定義する必要がある3つの環境変数を通じて完全に行われます。以下のセクションでは、プレースホルダー <NAME> は、ディストリビューション名の大文字バージョンで、ピリオドがアンダースコアに置き換えられたものです。例えば、pypy3.10PYPY3_10 になります。

Sourceソース

The HATCH_PYTHON_CUSTOM_SOURCE_<NAME> variable is the URL to the distribution's archive. The value must end with the archive's real file extension, which is used to determine the extraction method.HATCH_PYTHON_CUSTOM_SOURCE_<NAME> 変数は、配布のアーカイブのURLです。値はアーカイブの実際のファイル拡張子で終わる必要があり、これが抽出方法を決定するために使用されます。

The following extensions are supported:次の拡張子がサポートされています:

Extensions拡張機能 Description説明
  • .tar.bz2.tar.bz2
  • .bz2.bz2
A tar file with bzip2 compressiontarファイルで、bzip2圧縮
  • .tar.gz.tar.gz
  • .tgz.tgz
A tar file with gzip compressiontarファイルで、gzip圧縮
  • .tar.zst.tar.zst
  • .tar.zstd.tar.zstd
A tar file with Zstandard compressiontarファイルで、Zstandard圧縮が施されています。
  • .zip.zip
A ZIP file with DEFLATE compressionZIPファイルで、DEFLATE圧縮が施されています。

Python pathPythonパス

The HATCH_PYTHON_CUSTOM_PATH_<NAME> variable is the path to the Python interpreter within the archive. This path is relative to the root of the archive and must be a Unix-style path, even on Windows.HATCH_PYTHON_CUSTOM_PATH_<NAME>変数は、アーカイブ内のPythonインタプリタへのパスです。このパスはアーカイブのルートに対して相対的であり、WindowsでもUnixスタイルのパスである必要があります。

Versionバージョン

The HATCH_PYTHON_CUSTOM_VERSION_<NAME> variable is the version of the distribution. This value is used to determine whether updates are required and is displayed in the output of the python show command.HATCH_PYTHON_CUSTOM_VERSION_<NAME>変数は、ディストリビューションのバージョンです。この値は、更新が必要かどうかを判断するために使用され、python showコマンドの出力に表示されます。