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": 8009,
         "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 = visiomatic_

Fields:
field access_log: bool = False

Display access log

field host: str = 'localhost'

Host name or IP address

field port: int = 8009

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 ImageSettings[source]

Bases: BaseSettings

Show JSON schema
{
   "title": "ImageSettings",
   "type": "object",
   "properties": {
      "brightness": {
         "default": 0.0,
         "description": "Default image brightness",
         "maximum": 100.0,
         "minimum": -100.0,
         "short": null,
         "title": "Brightness",
         "type": "number"
      },
      "contrast": {
         "default": 1.0,
         "description": "Default image contrast",
         "maximum": 100.0,
         "minimum": 0.0,
         "short": null,
         "title": "Contrast",
         "type": "number"
      },
      "color_saturation": {
         "default": 1.5,
         "description": "Default color saturation",
         "maximum": 5.0,
         "minimum": 0.0,
         "short": null,
         "title": "Color Saturation",
         "type": "number"
      },
      "gamma": {
         "default": 2.2,
         "description": "Default image gamma",
         "maximum": 5.0,
         "minimum": 0.2,
         "short": null,
         "title": "Gamma",
         "type": "number"
      },
      "quality": {
         "default": 95,
         "description": "Default image compression quality in %%",
         "maximum": 100,
         "minimum": 1,
         "short": null,
         "title": "Quality",
         "type": "integer"
      },
      "tile_size": {
         "default": [
            256,
            256
         ],
         "description": "Tile size",
         "ge": [
            1,
            1
         ],
         "le": [
            4096,
            4096
         ],
         "maxItems": 2,
         "maxLength": 2,
         "minItems": 2,
         "minLength": 2,
         "prefixItems": [
            {
               "type": "integer"
            },
            {
               "type": "integer"
            }
         ],
         "short": null,
         "title": "Tile Size",
         "type": "array"
      }
   }
}

Config:
  • extra: str = ignore

  • env_prefix: str = visiomatic_

Fields:
field brightness: float = 0.0

Default image brightness

Constraints:
  • ge = -100.0

  • le = 100.0

field color_saturation: float = 1.5

Default color saturation

Constraints:
  • ge = 0.0

  • le = 5.0

field contrast: float = 1.0

Default image contrast

Constraints:
  • ge = 0.0

  • le = 100.0

field gamma: float = 2.2

Default image gamma

Constraints:
  • ge = 0.2

  • le = 5.0

field quality: int = 95

Default image compression quality in %%

Constraints:
  • ge = 1

  • le = 100

field tile_size: Tuple[int, int] = (256, 256)

Tile size

Constraints:
  • ge = (1, 1)

  • le = (4096, 4096)

  • min_length = 2

  • max_length = 2

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": "banner.html",
         "description": "Name of the HTML template file for the service banner",
         "short": null,
         "title": "Banner Template",
         "type": "string"
      },
      "base_template": {
         "default": "base.html",
         "description": "Name of the HTML template file for the web client",
         "short": null,
         "title": "Base Template",
         "type": "string"
      },
      "client_dir": {
         "default": "/home/runner/work/visiomatic/visiomatic/src/visiomatic/client",
         "description": "Directory containing the web client code, style and media",
         "short": null,
         "title": "Client Dir",
         "type": "string"
      },
      "data_dir": {
         "default": ".",
         "description": "Data root directory",
         "short": null,
         "title": "Data Dir",
         "type": "string"
      },
      "doc_dir": {
         "default": "/home/runner/work/visiomatic/visiomatic/src/visiomatic/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"
      },
      "max_region_tile_count": {
         "default": 1024,
         "description": "Maximum number of image tiles per snapshot",
         "minimum": 1,
         "short": null,
         "title": "Max Region Tile Count",
         "type": "integer"
      },
      "no_browser": {
         "default": false,
         "description": "Do not start browser when providing image file",
         "short": "n",
         "title": "No Browser",
         "type": "boolean"
      },
      "template_dir": {
         "default": "/home/runner/work/visiomatic/visiomatic/src/visiomatic/templates",
         "description": "Directory containing templates",
         "short": null,
         "title": "Template Dir",
         "type": "string"
      },
      "userdoc_url": {
         "default": "/manual/interface.html",
         "description": "Endpoint URL for the user's HTML documentation",
         "short": null,
         "title": "Userdoc Url",
         "type": "string"
      }
   }
}

Config:
  • extra: str = ignore

  • env_prefix: str = visiomatic_

Fields:
field api_path: str = '/api'

Endpoint URL for the webservice API

field banner_template: str = 'banner.html'

Name of the HTML template file for the service banner

field base_template: str = 'base.html'

Name of the HTML template file for the web client

field client_dir: str = '/home/runner/work/visiomatic/visiomatic/src/visiomatic/client'

Directory containing the web client code, style and media

field data_dir: str = '.'

Data root directory

field doc_dir: str = '/home/runner/work/visiomatic/visiomatic/src/visiomatic/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 max_region_tile_count: int = 1024

Maximum number of image tiles per snapshot

Constraints:
  • ge = 1

field no_browser: bool = False

Do not start browser when providing image file

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

Directory containing templates

field userdoc_url: str = '/manual/interface.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": 1,
         "short": "t",
         "title": "Thread Count",
         "type": "integer"
      }
   }
}

Config:
  • extra: str = ignore

  • env_prefix: str = visiomatic_

Fields:
field thread_count: int = 2

Number of engine threads

Constraints:
  • ge = 1

  • le = 1024

pydantic settings CacheSettings[source]

Bases: BaseSettings

Show JSON schema
{
   "title": "CacheSettings",
   "type": "object",
   "properties": {
      "cache_dir": {
         "default": "/home/runner/.cache/visiomatic",
         "description": "Image cache directory",
         "short": null,
         "title": "Cache Dir",
         "type": "string"
      },
      "clear_cache": {
         "default": false,
         "description": "Clear image cache on startup",
         "short": "C",
         "title": "Clear Cache",
         "type": "boolean"
      },
      "max_cache_image_count": {
         "default": 100,
         "description": "Maximum number of images in disk cache",
         "minimum": 1,
         "short": null,
         "title": "Max Cache Image Count",
         "type": "integer"
      },
      "max_cache_tile_count": {
         "default": 1000,
         "description": "Maximum number of image tiles in memory cache",
         "minimum": 1,
         "short": null,
         "title": "Max Cache Tile Count",
         "type": "integer"
      },
      "max_open_files": {
         "default": 10000,
         "description": "Maximum number of open files",
         "maximum": 1000000,
         "minimum": 100,
         "short": null,
         "title": "Max Open Files",
         "type": "integer"
      },
      "ultradict_cache_file": {
         "default": "/dev/shm/visiomatic_cache_dict.pkl",
         "description": "Name of the pickled cache dictionary shared across processes",
         "short": null,
         "title": "Ultradict Cache File",
         "type": "string"
      }
   }
}

Config:
  • extra: str = ignore

  • env_prefix: str = visiomatic_

Fields:
field cache_dir: str = '/home/runner/.cache/visiomatic'

Image cache directory

field clear_cache: bool = False

Clear image cache on startup

field max_cache_image_count: int = 100

Maximum number of images in disk cache

Constraints:
  • ge = 1

field max_cache_tile_count: int = 1000

Maximum number of image tiles in memory cache

Constraints:
  • ge = 1

field max_open_files: int = 10000

Maximum number of open files

Constraints:
  • ge = 100

  • le = 1000000

field ultradict_cache_file: str = '/dev/shm/visiomatic_cache_dict.pkl'

Name of the pickled cache dictionary shared across processes

pydantic settings AppSettings[source]

Bases: BaseSettings

Show JSON schema
{
   "title": "AppSettings",
   "type": "object",
   "properties": {
      "host": {
         "$ref": "#/$defs/BaseSettings",
         "default": {
            "host": "localhost",
            "port": 8009,
            "root_path": "",
            "access_log": false,
            "reload": false,
            "workers": 4
         }
      },
      "image": {
         "$ref": "#/$defs/BaseSettings",
         "default": {
            "brightness": 0.0,
            "contrast": 1.0,
            "color_saturation": 1.5,
            "gamma": 2.2,
            "quality": 95,
            "tile_size": [
               256,
               256
            ]
         }
      },
      "server": {
         "$ref": "#/$defs/BaseSettings",
         "default": {
            "api_path": "/api",
            "banner_template": "banner.html",
            "base_template": "base.html",
            "client_dir": "/home/runner/work/visiomatic/visiomatic/src/visiomatic/client",
            "data_dir": ".",
            "doc_dir": "/home/runner/work/visiomatic/visiomatic/src/visiomatic/doc/html",
            "doc_path": "/manual",
            "extra_dir": ".",
            "max_region_tile_count": 1024,
            "no_browser": false,
            "template_dir": "/home/runner/work/visiomatic/visiomatic/src/visiomatic/templates",
            "userdoc_url": "/manual/interface.html"
         }
      },
      "engine": {
         "$ref": "#/$defs/BaseSettings",
         "default": {
            "thread_count": 2
         }
      },
      "cache": {
         "$ref": "#/$defs/BaseSettings",
         "default": {
            "cache_dir": "/home/runner/.cache/visiomatic",
            "clear_cache": false,
            "max_cache_image_count": 100,
            "max_cache_tile_count": 1000,
            "max_open_files": 10000,
            "ultradict_cache_file": "/dev/shm/visiomatic_cache_dict.pkl"
         }
      }
   },
   "$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_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_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        Otherwse, 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: Whether `bool` fields should be implicitly converted into CLI boolean flags.\n        (e.g. --flag, --no-flag). Defaults to `False`.\n    _cli_ignore_unknown_args: Whether to ignore unknown CLI args and parse only known ones. Defaults to `False`.\n    _secrets_dir: The secret files directory or a sequence of directories. Defaults to `None`.",
         "properties": {},
         "title": "BaseSettings",
         "type": "object"
      }
   },
   "additionalProperties": false
}

Fields:
field cache: BaseSettings = CacheSettings(cache_dir='/home/runner/.cache/visiomatic', clear_cache=False, max_cache_image_count=100, max_cache_tile_count=1000, max_open_files=10000, ultradict_cache_file='/dev/shm/visiomatic_cache_dict.pkl')
field engine: BaseSettings = EngineSettings(thread_count=2)
field host: BaseSettings = HostSettings(host='localhost', port=8009, root_path='', access_log=False, reload=False, workers=4)
field image: BaseSettings = ImageSettings(brightness=0.0, contrast=1.0, color_saturation=1.5, gamma=2.2, quality=95, tile_size=(256, 256))
field server: BaseSettings = ServerSettings(api_path='/api', banner_template='banner.html', base_template='base.html', client_dir='/home/runner/work/visiomatic/visiomatic/src/visiomatic/client', data_dir='.', doc_dir='/home/runner/work/visiomatic/visiomatic/src/visiomatic/doc/html', doc_path='/manual', extra_dir='.', max_region_tile_count=1024, no_browser=False, template_dir='/home/runner/work/visiomatic/visiomatic/src/visiomatic/templates', userdoc_url='/manual/interface.html')