Settings

Configuration settings for the application.

pydantic settings HostSettings[source]

Bases: BaseSettings

Show JSON schema
{
   "title": "HostSettings",
   "type": "object",
   "properties": {
      "host": {
         "default": "localhost",
         "description": "Host name or IP address",
         "short": "H",
         "title": "Host",
         "type": "string"
      },
      "port": {
         "default": 8010,
         "description": "Port",
         "maximum": 65535,
         "minimum": 1,
         "short": "p",
         "title": "Port",
         "type": "integer"
      },
      "root_path": {
         "default": "",
         "description": "ASGI root_path",
         "short": "R",
         "title": "Root Path",
         "type": "string"
      },
      "access_log": {
         "default": false,
         "description": "Display access log",
         "short": "a",
         "title": "Access Log",
         "type": "boolean"
      },
      "reload": {
         "default": false,
         "description": "Enable auto-reload (turns off multiple workers)",
         "short": "r",
         "title": "Reload",
         "type": "boolean"
      },
      "workers": {
         "default": 4,
         "description": "Number of workers",
         "minimum": 1,
         "short": "w",
         "title": "Workers",
         "type": "integer"
      }
   }
}

Config:
  • extra: str = ignore

  • env_prefix: str = pydiet_

Fields:
field access_log: bool = False

Display access log

field host: str = 'localhost'

Host name or IP address

field port: int = 8010

Port

Constraints:
  • ge = 1

  • le = 65535

field reload: bool = False

Enable auto-reload (turns off multiple workers)

field root_path: str = ''

ASGI root_path

field workers: int = 4

Number of workers

Constraints:
  • ge = 1

pydantic settings ServerSettings[source]

Bases: BaseSettings

Show JSON schema
{
   "title": "ServerSettings",
   "type": "object",
   "properties": {
      "api_path": {
         "default": "/api",
         "description": "Endpoint URL for the webservice API",
         "short": null,
         "title": "Api Path",
         "type": "string"
      },
      "banner_template": {
         "default": "common/banner.html",
         "description": "Name of the HTML template file for the service banner",
         "short": null,
         "title": "Banner Template",
         "type": "string"
      },
      "base_template": {
         "default": "common/base.html",
         "description": "Name of the HTML template file for the web client",
         "short": null,
         "title": "Base Template",
         "type": "string"
      },
      "browser": {
         "default": false,
         "description": "Start browser when launching the server",
         "short": "b",
         "title": "Browser",
         "type": "boolean"
      },
      "client_dir": {
         "default": "/home/runner/work/pydiet/pydiet/src/pydiet/web_client",
         "description": "Directory containing the web client code, style and media",
         "short": null,
         "title": "Client Dir",
         "type": "string"
      },
      "data_config": {
         "default": "/home/runner/work/pydiet/pydiet/src/pydiet/data/data_config.toml",
         "description": "Data configuration filename",
         "short": null,
         "title": "Data Config",
         "type": "string"
      },
      "data_dir": {
         "default": "/home/runner/work/pydiet/pydiet/src/pydiet/data",
         "description": "Data root directory",
         "short": null,
         "title": "Data Dir",
         "type": "string"
      },
      "doc_dir": {
         "default": "/home/runner/work/pydiet/pydiet/src/pydiet/doc/html",
         "description": "HTML documentation root directory (after build)",
         "short": null,
         "title": "Doc Dir",
         "type": "string"
      },
      "doc_path": {
         "default": "/manual",
         "description": "Endpoint URL for the root of the HTML documentation",
         "short": null,
         "title": "Doc Path",
         "type": "string"
      },
      "extra_dir": {
         "default": ".",
         "description": "Extra data root directory",
         "short": null,
         "title": "Extra Dir",
         "type": "string"
      },
      "template_dir": {
         "default": "/home/runner/work/pydiet/pydiet/src/pydiet/templates",
         "description": "Directory containing templates",
         "short": null,
         "title": "Template Dir",
         "type": "string"
      },
      "userdoc_url": {
         "default": "/manual/index.html",
         "description": "Endpoint URL for the user's HTML documentation",
         "short": null,
         "title": "Userdoc Url",
         "type": "string"
      }
   }
}

Config:
  • extra: str = ignore

  • env_prefix: str = pydiet_

Fields:
field api_path: str = '/api'

Endpoint URL for the webservice API

field banner_template: str = 'common/banner.html'

Name of the HTML template file for the service banner

field base_template: str = 'common/base.html'

Name of the HTML template file for the web client

field browser: bool = False

Start browser when launching the server

field client_dir: str = '/home/runner/work/pydiet/pydiet/src/pydiet/web_client'

Directory containing the web client code, style and media

field data_config: str = '/home/runner/work/pydiet/pydiet/src/pydiet/data/data_config.toml'

Data configuration filename

field data_dir: str = '/home/runner/work/pydiet/pydiet/src/pydiet/data'

Data root directory

field doc_dir: str = '/home/runner/work/pydiet/pydiet/src/pydiet/doc/html'

HTML documentation root directory (after build)

field doc_path: str = '/manual'

Endpoint URL for the root of the HTML documentation

field extra_dir: str = '.'

Extra data root directory

field template_dir: str = '/home/runner/work/pydiet/pydiet/src/pydiet/templates'

Directory containing templates

field userdoc_url: str = '/manual/index.html'

Endpoint URL for the user's HTML documentation

pydantic settings EngineSettings[source]

Bases: BaseSettings

Show JSON schema
{
   "title": "EngineSettings",
   "type": "object",
   "properties": {
      "thread_count": {
         "default": 2,
         "description": "Number of engine threads",
         "maximum": 1024,
         "minimum": 0,
         "short": "t",
         "title": "Thread Count",
         "type": "integer"
      }
   }
}

Config:
  • extra: str = ignore

  • env_prefix: str = pydiet_

Fields:
field thread_count: int = 2

Number of engine threads

Constraints:
  • ge = 0

  • le = 1024

pydantic settings MiscSettings[source]

Bases: BaseSettings

Miscellaneous settings.

Show JSON schema
{
   "title": "MiscSettings",
   "description": "Miscellaneous settings.",
   "type": "object",
   "properties": {
      "verbose": {
         "default": true,
         "description": "Verbose output",
         "short": "v",
         "title": "Verbose",
         "type": "boolean"
      }
   }
}

Config:
  • extra: str = ignore

  • env_prefix: str = pydiet_

Fields:
field verbose: bool = True

Verbose output

pydantic settings AppSettings[source]

Bases: BaseSettings

Show JSON schema
{
   "title": "AppSettings",
   "type": "object",
   "properties": {
      "host": {
         "$ref": "#/$defs/BaseSettings",
         "default": {
            "host": "localhost",
            "port": 8010,
            "root_path": "",
            "access_log": false,
            "reload": false,
            "workers": 4
         }
      },
      "server": {
         "$ref": "#/$defs/BaseSettings",
         "default": {
            "api_path": "/api",
            "banner_template": "common/banner.html",
            "base_template": "common/base.html",
            "browser": false,
            "client_dir": "/home/runner/work/pydiet/pydiet/src/pydiet/web_client",
            "data_config": "/home/runner/work/pydiet/pydiet/src/pydiet/data/data_config.toml",
            "data_dir": "/home/runner/work/pydiet/pydiet/src/pydiet/data",
            "doc_dir": "/home/runner/work/pydiet/pydiet/src/pydiet/doc/html",
            "doc_path": "/manual",
            "extra_dir": ".",
            "template_dir": "/home/runner/work/pydiet/pydiet/src/pydiet/templates",
            "userdoc_url": "/manual/index.html"
         }
      },
      "engine": {
         "$ref": "#/$defs/BaseSettings",
         "default": {
            "thread_count": 2
         }
      },
      "misc": {
         "$ref": "#/$defs/BaseSettings",
         "default": {
            "verbose": true
         }
      }
   },
   "$defs": {
      "BaseSettings": {
         "additionalProperties": false,
         "description": "Base class for settings, allowing values to be overridden by environment variables.\n\nThis is useful in production for secrets you do not wish to save in code, it plays nicely with docker(-compose),\nHeroku and any 12 factor app design.\n\nAll the below attributes can be set via `model_config`.\n\nArgs:\n    _case_sensitive: Whether environment and CLI variable names should be read with case-sensitivity.\n        Defaults to `None`.\n    _nested_model_default_partial_update: Whether to allow partial updates on nested model default object fields.\n        Defaults to `False`.\n    _env_prefix: Prefix for all environment variables. Defaults to `None`.\n    _env_prefix_target: Targets to which `_env_prefix` is applied. Default: `variable`.\n    _env_file: The env file(s) to load settings values from. Defaults to `Path('')`, which\n        means that the value from `model_config['env_file']` should be used. You can also pass\n        `None` to indicate that environment variables should not be loaded from an env file.\n    _env_file_encoding: The env file encoding, e.g. `'latin-1'`. Defaults to `None`.\n    _env_ignore_empty: Ignore environment variables where the value is an empty string. Default to `False`.\n    _env_nested_delimiter: The nested env values delimiter. Defaults to `None`.\n    _env_nested_max_split: The nested env values maximum nesting. Defaults to `None`, which means no limit.\n    _env_parse_none_str: The env string value that should be parsed (e.g. \"null\", \"void\", \"None\", etc.)\n        into `None` type(None). Defaults to `None` type(None), which means no parsing should occur.\n    _env_parse_enums: Parse enum field names to values. Defaults to `None.`, which means no parsing should occur.\n    _cli_prog_name: The CLI program name to display in help text. Defaults to `None` if _cli_parse_args is `None`.\n        Otherwise, defaults to sys.argv[0].\n    _cli_parse_args: The list of CLI arguments to parse. Defaults to None.\n        If set to `True`, defaults to sys.argv[1:].\n    _cli_settings_source: Override the default CLI settings source with a user defined instance. Defaults to None.\n    _cli_parse_none_str: The CLI string value that should be parsed (e.g. \"null\", \"void\", \"None\", etc.) into\n        `None` type(None). Defaults to _env_parse_none_str value if set. Otherwise, defaults to \"null\" if\n        _cli_avoid_json is `False`, and \"None\" if _cli_avoid_json is `True`.\n    _cli_hide_none_type: Hide `None` values in CLI help text. Defaults to `False`.\n    _cli_avoid_json: Avoid complex JSON objects in CLI help text. Defaults to `False`.\n    _cli_enforce_required: Enforce required fields at the CLI. Defaults to `False`.\n    _cli_use_class_docs_for_groups: Use class docstrings in CLI group help text instead of field descriptions.\n        Defaults to `False`.\n    _cli_exit_on_error: Determines whether or not the internal parser exits with error info when an error occurs.\n        Defaults to `True`.\n    _cli_prefix: The root parser command line arguments prefix. Defaults to \"\".\n    _cli_flag_prefix_char: The flag prefix character to use for CLI optional arguments. Defaults to '-'.\n    _cli_implicit_flags: Controls how `bool` fields are exposed as CLI flags.\n\n        - False (default): no implicit flags are generated; booleans must be set explicitly (e.g. --flag=true).\n        - True / 'dual': optional boolean fields generate both positive and negative forms (--flag and --no-flag).\n        - 'toggle': required boolean fields remain in 'dual' mode, while optional boolean fields generate a single\n          flag aligned with the default value (if default=False, expose --flag; if default=True, expose --no-flag).\n    _cli_ignore_unknown_args: Whether to ignore unknown CLI args and parse only known ones. Defaults to `False`.\n    _cli_kebab_case: CLI args use kebab case. Defaults to `False`.\n    _cli_shortcuts: Mapping of target field name to alias names. Defaults to `None`.\n    _secrets_dir: The secret files directory or a sequence of directories. Defaults to `None`.\n    _build_sources: Pre-initialized sources and init kwargs to use for building instantiation values.\n        Defaults to `None`.",
         "properties": {},
         "title": "BaseSettings",
         "type": "object"
      }
   },
   "additionalProperties": false
}

Fields:
field engine: BaseSettings = EngineSettings(thread_count=2)
field host: BaseSettings = HostSettings(host='localhost', port=8010, root_path='', access_log=False, reload=False, workers=4)
field misc: BaseSettings = MiscSettings(verbose=True)
field server: BaseSettings = ServerSettings(api_path='/api', banner_template='common/banner.html', base_template='common/base.html', browser=False, client_dir='/home/runner/work/pydiet/pydiet/src/pydiet/web_client', data_config='/home/runner/work/pydiet/pydiet/src/pydiet/data/data_config.toml', data_dir='/home/runner/work/pydiet/pydiet/src/pydiet/data', doc_dir='/home/runner/work/pydiet/pydiet/src/pydiet/doc/html', doc_path='/manual', extra_dir='.', template_dir='/home/runner/work/pydiet/pydiet/src/pydiet/templates', userdoc_url='/manual/index.html')