📝 Utility Options¶
📋 Options¶
| Option | Description |
|---|---|
--debug |
Show debug messages during code generation |
--help |
Show help message and exit |
--no-color |
Disable colorized output |
--profile |
Use a named profile from pyproject.toml |
--version |
Show program version and exit |
--debug¶
Show debug messages during code generation.
Enables verbose debug output to help troubleshoot issues with schema parsing
or code generation. Requires the debug extra to be installed.
Requires extra dependency
The debug feature requires the debug extra:
--help¶
Show help message and exit.
Displays all available command-line options with their descriptions and default values.
Aliases: -h
Output
--no-color¶
Disable colorized output.
By default, datamodel-codegen uses colored output for better readability. Use this option to disable colors, which is useful for CI/CD pipelines or when redirecting output to files.
Usage
-
--no-color- the option documented here
Environment variable
You can also disable colors by setting the NO_COLOR environment variable:
--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.legacy]
# Legacy profile for Pydantic v1
output-model-type = "pydantic.BaseModel"
Use profiles:
--version¶
Show program version and exit.
Displays the installed version of datamodel-code-generator.