Skip to content
Back to top
View this page

# semantic_release.cli.config module

class semantic_release.cli.config.BranchConfig(*, match: str = '(main|master)', prerelease_token: str = 'rc', prerelease: bool = False)

  Bases: `BaseModel`

  match: str
  model_config: ClassVar[ConfigDict] = {}

    Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

  prerelease: bool
  prerelease_token: str
  classmethod validate_match(match: str) → str

class semantic_release.cli.config.ChangelogConfig(*, changelog_file: str = '', default_templates: ~semantic_release.cli.config.DefaultChangelogTemplatesConfig = DefaultChangelogTemplatesConfig(changelog_file='CHANGELOG.md', output_format=<ChangelogOutputFormat.MARKDOWN: 'md'>, mask_initial_release=True), environment: ~semantic_release.cli.config.ChangelogEnvironmentConfig = ChangelogEnvironmentConfig(block_start_string='{%', block_end_string='%}', variable_start_string='{{', variable_end_string='}}', comment_start_string='{#', comment_end_string='#}', line_statement_prefix=None, line_comment_prefix=None, trim_blocks=False, lstrip_blocks=False, newline_sequence='\n', keep_trailing_newline=False, extensions=(), autoescape=False), exclude_commit_patterns: ~typing.Tuple[str, ...] = (), mode: ~semantic_release.changelog.context.ChangelogMode = ChangelogMode.UPDATE, insertion_flag: str = '', template_dir: str = 'templates')

  Bases: `BaseModel`

  changelog_file: str

    Deprecated! Moved to ‘default_templates.changelog_file’

  classmethod changelog_file_deprecation_warning(val: str) → str
  default_templates: DefaultChangelogTemplatesConfig
  environment: ChangelogEnvironmentConfig
  exclude_commit_patterns: Tuple[str, ...]
  insertion_flag: str
  load_default_insertion_flag_on_missing() → Self
  mode: ChangelogMode
  model_config: ClassVar[ConfigDict] = {}

    Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

  move_changelog_file() → Self
  template_dir: str
  classmethod validate_match(patterns: Tuple[str, ...]) → Tuple[str, ...]

class semantic_release.cli.config.ChangelogEnvironmentConfig(*, block_start_string: str = '{%', block_end_string: str = '%}', variable_start_string: str = '{{', variable_end_string: str = '}}', comment_start_string: str = '{#', comment_end_string: str = '#}', line_statement_prefix: str | None = None, line_comment_prefix: str | None = None, trim_blocks: bool = False, lstrip_blocks: bool = False, newline_sequence: Literal['\n', '\r', '\r\n'] = '\n', keep_trailing_newline: bool = False, extensions: Tuple[str, ...] = (), autoescape: bool | str = False)

  Bases: `BaseModel`

  autoescape: bool | str
  block_end_string: str
  block_start_string: str
  comment_end_string: str
  comment_start_string: str
  extensions: Tuple[str, ...]
  keep_trailing_newline: bool
  line_comment_prefix: str | None
  line_statement_prefix: str | None
  lstrip_blocks: bool
  model_config: ClassVar[ConfigDict] = {}

    Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

  newline_sequence: Literal['\n', '\r', '\r\n']
  trim_blocks: bool
  variable_end_string: str
  variable_start_string: str

class semantic_release.cli.config.ChangelogOutputFormat(*values)

  Bases: `str`, `Enum`

  Supported changelog output formats when using the default templates.

  MARKDOWN = 'md'
  NONE = ''
  RESTRUCTURED_TEXT = 'rst'

class semantic_release.cli.config.DefaultChangelogTemplatesConfig(*, changelog_file: str = 'CHANGELOG.md', output_format: ChangelogOutputFormat = ChangelogOutputFormat.NONE, mask_initial_release: bool = True)

  Bases: `BaseModel`

  changelog_file: str
  interpret_output_format() → Self
  mask_initial_release: bool
  model_config: ClassVar[ConfigDict] = {}

    Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

  output_format: ChangelogOutputFormat

class semantic_release.cli.config.EnvConfigVar(*, env: str, default: str | None = None, default_env: str | None = None)

  Bases: `BaseModel`

  default: str | None
  default_env: str | None
  env: str
  getvalue() → str | None
  model_config: ClassVar[ConfigDict] = {}

    Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class semantic_release.cli.config.GlobalCommandLineOptions(noop: bool = False, verbosity: int = 0, config_file: str = 'pyproject.toml', strict: bool = False)

  Bases: `object`

  A dataclass to hold all the command line options that should be set in the RuntimeContext

  config_file: str = 'pyproject.toml'
  noop: bool = False
  strict: bool = False
  verbosity: int = 0

class semantic_release.cli.config.HvcsClient(*values)

  Bases: `str`, `Enum`

  BITBUCKET = 'bitbucket'
  GITEA = 'gitea'
  GITHUB = 'github'
  GITLAB = 'gitlab'

class semantic_release.cli.config.PublishConfig(*, dist_glob_patterns: Tuple[str, ...] = ('dist/*',), upload_to_vcs_release: bool = True)

  Bases: `BaseModel`

  dist_glob_patterns: Tuple[str, ...]
  model_config: ClassVar[ConfigDict] = {}

    Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

  upload_to_vcs_release: bool

class semantic_release.cli.config.RawConfig(*, assets: ~typing.List[str] = [], branches: ~typing.Dict[str, ~semantic_release.cli.config.BranchConfig] = {'main': BranchConfig(match='(main|master)', prerelease_token='rc', prerelease=False)}, build_command: str | None = None, build_command_env: ~typing.List[str] = [], changelog: ~semantic_release.cli.config.ChangelogConfig = ChangelogConfig(changelog_file='', default_templates=DefaultChangelogTemplatesConfig(changelog_file='CHANGELOG.md', output_format=<ChangelogOutputFormat.MARKDOWN: 'md'>, mask_initial_release=True), environment=ChangelogEnvironmentConfig(block_start_string='{%', block_end_string='%}', variable_start_string='{{', variable_end_string='}}', comment_start_string='{#', comment_end_string='#}', line_statement_prefix=None, line_comment_prefix=None, trim_blocks=False, lstrip_blocks=False, newline_sequence='\n', keep_trailing_newline=False, extensions=(), autoescape=False), exclude_commit_patterns=(), mode=<ChangelogMode.UPDATE: 'update'>, insertion_flag='<!-- version list -->', template_dir='templates'), commit_author: ~semantic_release.cli.config.EnvConfigVar | str = EnvConfigVar(env='GIT_COMMIT_AUTHOR', default='semantic-release <semantic-release>', default_env=None), commit_message: str = '{version}\n\nAutomatically generated by python-semantic-release', commit_parser: ~typing.Annotated[str, ~annotated_types.MinLen(min_length=1)] = 'conventional', commit_parser_options: ~typing.Dict[str, ~typing.Any] = {}, logging_use_named_masks: bool = False, major_on_zero: bool = True, allow_zero_version: bool = False, repo_dir: ~pathlib.Path = PosixPath('.'), remote: ~semantic_release.cli.config.RemoteConfig = RemoteConfig(name='origin', token=None, url=None, type=<HvcsClient.GITHUB: 'github'>, domain=None, api_domain=None, ignore_token_for_push=False, insecure=False), no_git_verify: bool = False, tag_format: str = 'v{version}', add_partial_tags: bool = False, publish: ~semantic_release.cli.config.PublishConfig = PublishConfig(dist_glob_patterns=('dist/*', ), upload_to_vcs_release=True), version_toml: ~typing.Tuple[str, ...] | None = None, version_variables: ~typing.Tuple[str, ...] | None = None)

  Bases: `BaseModel`

  add_partial_tags: bool
  allow_zero_version: bool
  classmethod angular_commit_parser_deprecation_warning(val: str) → str
  assets: List[str]
  branches: Dict[str, BranchConfig]
  build_command: str | None
  build_command_env: List[str]
  changelog: ChangelogConfig
  commit_author: MaybeFromEnv
  commit_message: str
  commit_parser: NonEmptyString
  commit_parser_options: Dict[str, Any]
  classmethod convert_str_to_path(value: Any) → Path
  logging_use_named_masks: bool
  major_on_zero: bool
  model_config: ClassVar[ConfigDict] = {}

    Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

  no_git_verify: bool
  publish: PublishConfig
  remote: RemoteConfig
  classmethod remove_whitespace(val: list[str]) → list[str]
  repo_dir: Annotated[Path, Field(validate_default=True)]
  set_default_opts() → Self
  classmethod tag_commit_parser_deprecation_warning(val: str) → str
  tag_format: str
  classmethod verify_git_repo_dir(dir_path: Path) → Path
  version_toml: Tuple[str, ...] | None
  version_variables: Tuple[str, ...] | None

class semantic_release.cli.config.RemoteConfig(*, name: str = 'origin', token: str | None = None, url: str | None = None, type: HvcsClient = HvcsClient.GITHUB, domain: str | None = None, api_domain: str | None = None, ignore_token_for_push: bool = False, insecure: bool = False)

  Bases: `BaseModel`

  api_domain: str | None
  check_insecure_flag(url_str: str, field_name: str) → None
  check_url_scheme() → Self
  domain: str | None
  ignore_token_for_push: bool
  insecure: bool
  model_config: ClassVar[ConfigDict] = {}

    Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

  name: str
  classmethod resolve_env_vars(val: Any) → str | None
  set_default_token() → Self
  token: str | None
  type: HvcsClient
  url: str | None

class semantic_release.cli.config.RuntimeContext(project_metadata: 'dict[str, Any]', repo_dir: 'Path', commit_parser: 'CommitParser[ParseResult, ParserOptions]', version_translator: 'VersionTranslator', major_on_zero: 'bool', allow_zero_version: 'bool', prerelease: 'bool', no_git_verify: 'bool', assets: 'List[str]', commit_author: 'Actor', commit_message: 'str', changelog_excluded_commit_patterns: 'Tuple[Pattern[str], ...]', version_declarations: 'Tuple[IVersionReplacer, ...]', hvcs_client: 'hvcs.HvcsBase', changelog_insertion_flag: 'str', changelog_mask_initial_release: 'bool', changelog_mode: 'ChangelogMode', changelog_file: 'Path', changelog_style: 'str', changelog_output_format: 'ChangelogOutputFormat', ignore_token_for_push: 'bool', template_environment: 'Environment', template_dir: 'Path', build_command: 'Optional[str]', build_command_env: 'dict[str, str]', dist_glob_patterns: 'Tuple[str, ...]', upload_to_vcs_release: 'bool', global_cli_options: 'GlobalCommandLineOptions', masker: 'MaskingFilter')

  Bases: `object`

  allow_zero_version: bool
  apply_log_masking(masker: MaskingFilter) → MaskingFilter
  assets: List[str]
  build_command: str | None
  build_command_env: dict[str, str]
  changelog_excluded_commit_patterns: Tuple[Pattern[str], ...]
  changelog_file: Path
  changelog_insertion_flag: str
  changelog_mask_initial_release: bool
  changelog_mode: ChangelogMode
  changelog_output_format: ChangelogOutputFormat
  changelog_style: str
  commit_author: Actor
  commit_message: str
  commit_parser: CommitParser[ParsedCommit | ParseError, ParserOptions]
  dist_glob_patterns: Tuple[str, ...]
  classmethod from_raw_config(raw: RawConfig, global_cli_options: GlobalCommandLineOptions) → RuntimeContext
  global_cli_options: GlobalCommandLineOptions
  hvcs_client: HvcsBase
  ignore_token_for_push: bool
  major_on_zero: bool
  masker: MaskingFilter
  no_git_verify: bool
  prerelease: bool
  project_metadata: dict[str, Any]
  repo_dir: Path
  static resolve_from_env(param: EnvConfigVar | str | None) → str | None
  static select_branch_options(choices: Dict[str, BranchConfig], active_branch: str) → BranchConfig
  template_dir: Path
  template_environment: Environment
  upload_to_vcs_release: bool
  version_declarations: Tuple[IVersionReplacer, ...]
  version_translator: VersionTranslator