settings

Settings for the Byte portion of the application.

Project Settings.

pydantic settings src.byte.lib.settings.DiscordSettings[source]

Bases: BaseSettings

Discord Settings.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "DiscordSettings",
   "description": "Discord Settings.",
   "type": "object",
   "properties": {
      "TOKEN": {
         "title": "Token",
         "type": "string"
      },
      "COMMAND_PREFIX": {
         "default": [
            "!"
         ],
         "items": {
            "type": "string"
         },
         "title": "Command Prefix",
         "type": "array"
      },
      "DEV_GUILD_ID": {
         "title": "Dev Guild Id",
         "type": "integer"
      },
      "DEV_USER_ID": {
         "title": "Dev User Id",
         "type": "integer"
      },
      "PLUGINS_LOC": {
         "default": "/home/runner/work/byte/byte/src/byte/plugins",
         "format": "path",
         "title": "Plugins Loc",
         "type": "string"
      },
      "PLUGINS_DIRS": {
         "default": [
            "/home/runner/work/byte/byte/src/byte/plugins"
         ],
         "items": {
            "format": "path",
            "type": "string"
         },
         "title": "Plugins Dirs",
         "type": "array"
      },
      "PRESENCE_URL": {
         "default": "",
         "title": "Presence Url",
         "type": "string"
      }
   },
   "required": [
      "TOKEN",
      "DEV_GUILD_ID",
      "DEV_USER_ID"
   ]
}

Config:
  • extra: str = ignore

  • case_sensitive: bool = True

  • env_prefix: str = DISCORD_

  • env_file: str = .env

Fields:
Validators:
field TOKEN: str [Required]

Discord API token.

field COMMAND_PREFIX: list[str] = ['!']

Command prefix for bot commands.

Validated by:
field DEV_GUILD_ID: int [Required]

Discord Guild ID for development.

field DEV_USER_ID: int [Required]

Discord User ID for development.

field PLUGINS_LOC: Path = PosixPath('/home/runner/work/byte/byte/src/byte/plugins')

Base Path to plugins directory.

field PLUGINS_DIRS: list[Path] = ['/home/runner/work/byte/byte/src/byte/plugins']

Directories to search for plugins.

field PRESENCE_URL: str = ''
Validated by:
validator assemble_command_prefix  »  COMMAND_PREFIX[source]

Assembles the bot command prefix based on the environment.

Parameters:

value – Default value of COMMAND_PREFIX. Currently ["!"]

Returns:

The assembled prefix string.

validator assemble_presence_url  »  PRESENCE_URL[source]

Assembles the bot presence url based on the environment.

Parameters:

value – Not used.

Returns:

The assembled prefix string.

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

pydantic settings src.byte.lib.settings.LogSettings[source]

Bases: BaseSettings

Logging config for the Project.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "LogSettings",
   "description": "Logging config for the Project.",
   "type": "object",
   "properties": {
      "LEVEL": {
         "default": 20,
         "title": "Level",
         "type": "integer"
      },
      "DISCORD_LEVEL": {
         "default": 30,
         "title": "Discord Level",
         "type": "integer"
      },
      "WEBSOCKETS_LEVEL": {
         "default": 30,
         "title": "Websockets Level",
         "type": "integer"
      },
      "ASYNCIO_LEVEL": {
         "default": 20,
         "title": "Asyncio Level",
         "type": "integer"
      },
      "FORMAT": {
         "default": "[[ %(asctime)s ]] - [[ %(name)s ]] - [[ %(levelname)s ]] - %(message)s",
         "title": "Format",
         "type": "string"
      },
      "FILE": {
         "default": "/home/runner/work/byte/byte/src/logs/byte.log",
         "format": "path",
         "title": "File",
         "type": "string"
      }
   }
}

Config:
  • extra: str = ignore

  • case_sensitive: bool = True

  • env_prefix: str = LOG_

  • env_file: str = .env

Fields:
field LEVEL: int = 20

Stdlib log levels.

Only emit logs at this level, or higher.

field DISCORD_LEVEL: int = 30

Sets the log level for the discord.py library.

field WEBSOCKETS_LEVEL: int = 30

Sets the log level for the websockets library.

field ASYNCIO_LEVEL: int = 20

Sets the log level for the asyncio library.

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

field FORMAT: str = '[[ %(asctime)s ]] - [[ %(name)s ]] - [[ %(levelname)s ]] - %(message)s'

Log format string.

field FILE: Path = PosixPath('/home/runner/work/byte/byte/src/logs/byte.log')

Log file path.

pydantic settings src.byte.lib.settings.ProjectSettings[source]

Bases: BaseSettings

Project Settings.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "ProjectSettings",
   "description": "Project Settings.",
   "type": "object",
   "properties": {
      "DEBUG": {
         "default": false,
         "title": "Debug",
         "type": "boolean"
      },
      "ENVIRONMENT": {
         "default": "prod",
         "title": "Environment",
         "type": "string"
      },
      "VERSION": {
         "default": "0.2.0",
         "title": "Version",
         "type": "string"
      }
   }
}

Config:
  • extra: str = ignore

  • case_sensitive: bool = True

  • env_file: str = .env

Fields:
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

field DEBUG: bool = False

Run app with debug=True.

field ENVIRONMENT: str = 'prod'

dev, prod, test, etc.

field VERSION: str = '0.2.0'

The current version of the application.