Profile
--profile¶
Use a named profile from pyproject.toml configuration.
Profiles allow you to define multiple named configurations in your pyproject.toml file. Each profile can override the default settings with its own set of options.
Related: pyproject.toml Configuration
Usage
-
--profile- the option documented here
Configuration (pyproject.toml)
[tool.datamodel-codegen]
# Default configuration
output-model-type = "pydantic_v2.BaseModel"
[tool.datamodel-codegen.profiles.strict]
# Strict profile with additional options
strict-types = ["str", "int", "float", "bool"]
strict-nullable = true
[tool.datamodel-codegen.profiles.dataclass]
# Dataclass profile
output-model-type = "dataclasses.dataclass"
Use profiles: