Installation
インストールは簡単です。
pip install pydantic
Pydanticにはいくつかの依存関係があります。
pydantic-core: rustで書かれた_pydantic_のコア検証ロジック。typing-extensions: 標準ライブラリtypingモジュールのバックポート。annotated-types:typing.Annotatedで使用する再利用可能な制約タイプ。
Python 3.8以降とpipがインストールされていれば、問題ありません。
Pydanticは、conda-forgeの下のcondaでも利用できます。
チャネル:
conda install pydantic -c conda-forge
Optional dependencies¶
Pydanticには、次のオプションの依存関係があります。
- Eメールの検証が必要な場合は、email-validatorを追加できます。
Pydanticと一緒にオプションの依存関係をインストールするには、次のようにします。
pip install pydantic[email]
もちろん、pip install email-validatorを使って手動で必要な依存関係をインストールすることもできます。
Install from repository¶
また、リポジトリから直接Pydanticをインストールしたい場合は、次のようにします。
pip install git+https://github.com/pydantic/pydantic@main#egg=pydantic
# or with extras
pip install git+https://github.com/pydantic/pydantic@main#egg=pydantic[email]