semantic_release.cli.config module

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

Bases: BaseModel

match: str
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[Dict[str, FieldInfo]] = {'match': FieldInfo(annotation=str, required=False, default='(main|master)'), 'prerelease': FieldInfo(annotation=bool, required=False, default=False), 'prerelease_token': FieldInfo(annotation=str, required=False, default='rc')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

prerelease: bool
prerelease_token: str
classmethod validate_match(match: str) str[source]
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'>), 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.INIT, insertion_flag: str = '', template_dir: str = 'templates')[source]

Bases: BaseModel

changelog_file: str

Deprecated! Moved to ‘default_templates.changelog_file’

classmethod changelog_file_deprecation_warning(val: str) str[source]
default_templates: DefaultChangelogTemplatesConfig
environment: ChangelogEnvironmentConfig
exclude_commit_patterns: Tuple[str, ...]
insertion_flag: str
load_default_insertion_flag_on_missing() Self[source]
mode: ChangelogMode
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[Dict[str, FieldInfo]] = {'changelog_file': FieldInfo(annotation=str, required=False, default=''), 'default_templates': FieldInfo(annotation=DefaultChangelogTemplatesConfig, required=False, default=DefaultChangelogTemplatesConfig(changelog_file='CHANGELOG.md', output_format=<ChangelogOutputFormat.MARKDOWN: 'md'>)), 'environment': FieldInfo(annotation=ChangelogEnvironmentConfig, required=False, default=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': FieldInfo(annotation=Tuple[str, ...], required=False, default=()), 'insertion_flag': FieldInfo(annotation=str, required=False, default=''), 'mode': FieldInfo(annotation=ChangelogMode, required=False, default=<ChangelogMode.INIT: 'init'>), 'template_dir': FieldInfo(annotation=str, required=False, default='templates')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

move_changelog_file() Self[source]
template_dir: 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)[source]

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_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[Dict[str, FieldInfo]] = {'autoescape': FieldInfo(annotation=Union[bool, str], required=False, default=False), 'block_end_string': FieldInfo(annotation=str, required=False, default='%}'), 'block_start_string': FieldInfo(annotation=str, required=False, default='{%'), 'comment_end_string': FieldInfo(annotation=str, required=False, default='#}'), 'comment_start_string': FieldInfo(annotation=str, required=False, default='{#'), 'extensions': FieldInfo(annotation=Tuple[str, ...], required=False, default=()), 'keep_trailing_newline': FieldInfo(annotation=bool, required=False, default=False), 'line_comment_prefix': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'line_statement_prefix': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'lstrip_blocks': FieldInfo(annotation=bool, required=False, default=False), 'newline_sequence': FieldInfo(annotation=Literal['\n', '\r', '\r\n'], required=False, default='\n'), 'trim_blocks': FieldInfo(annotation=bool, required=False, default=False), 'variable_end_string': FieldInfo(annotation=str, required=False, default='}}'), 'variable_start_string': FieldInfo(annotation=str, required=False, default='{{')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

newline_sequence: Literal['\n', '\r', '\r\n']
trim_blocks: bool
variable_end_string: str
variable_start_string: str
class semantic_release.cli.config.ChangelogOutputFormat(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

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

Bases: BaseModel

changelog_file: str
interpret_output_format() Self[source]
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[Dict[str, FieldInfo]] = {'changelog_file': FieldInfo(annotation=str, required=False, default='CHANGELOG.md'), 'output_format': FieldInfo(annotation=ChangelogOutputFormat, required=False, default=<ChangelogOutputFormat.NONE: ''>)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

output_format: ChangelogOutputFormat
class semantic_release.cli.config.EnvConfigVar(*, env: str, default: str | None = None, default_env: str | None = None)[source]

Bases: BaseModel

default: str | None
default_env: str | None
env: str
getvalue() str | None[source]
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[Dict[str, FieldInfo]] = {'default': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'default_env': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'env': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

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

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(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

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

Bases: BaseModel

dist_glob_patterns: Tuple[str, ...]
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[Dict[str, FieldInfo]] = {'dist_glob_patterns': FieldInfo(annotation=Tuple[str, ...], required=False, default=('dist/*',)), 'upload_to_vcs_release': FieldInfo(annotation=bool, required=False, default=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

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'>), 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.INIT: 'init'>, 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)] = 'angular', commit_parser_options: ~typing.Dict[str, ~typing.Any] = {}, logging_use_named_masks: bool = False, major_on_zero: bool = True, allow_zero_version: bool = True, 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}', 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)[source]

Bases: BaseModel

allow_zero_version: bool
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[source]
logging_use_named_masks: bool
major_on_zero: bool
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[Dict[str, FieldInfo]] = {'allow_zero_version': FieldInfo(annotation=bool, required=False, default=True), 'assets': FieldInfo(annotation=List[str], required=False, default=[]), 'branches': FieldInfo(annotation=Dict[str, BranchConfig], required=False, default={'main': BranchConfig(match='(main|master)', prerelease_token='rc', prerelease=False)}), 'build_command': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'build_command_env': FieldInfo(annotation=List[str], required=False, default=[]), 'changelog': FieldInfo(annotation=ChangelogConfig, required=False, default=ChangelogConfig(changelog_file='', default_templates=DefaultChangelogTemplatesConfig(changelog_file='CHANGELOG.md', output_format=<ChangelogOutputFormat.MARKDOWN: 'md'>), 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.INIT: 'init'>, insertion_flag='<!-- version list -->', template_dir='templates')), 'commit_author': FieldInfo(annotation=Union[EnvConfigVar, str], required=False, default=EnvConfigVar(env='GIT_COMMIT_AUTHOR', default='semantic-release <semantic-release>', default_env=None)), 'commit_message': FieldInfo(annotation=str, required=False, default='{version}\n\nAutomatically generated by python-semantic-release'), 'commit_parser': FieldInfo(annotation=str, required=False, default='angular', metadata=[MinLen(min_length=1)]), 'commit_parser_options': FieldInfo(annotation=Dict[str, Any], required=False, default={}), 'logging_use_named_masks': FieldInfo(annotation=bool, required=False, default=False), 'major_on_zero': FieldInfo(annotation=bool, required=False, default=True), 'no_git_verify': FieldInfo(annotation=bool, required=False, default=False), 'publish': FieldInfo(annotation=PublishConfig, required=False, default=PublishConfig(dist_glob_patterns=('dist/*',), upload_to_vcs_release=True)), 'remote': FieldInfo(annotation=RemoteConfig, required=False, default=RemoteConfig(name='origin', token=None, url=None, type=<HvcsClient.GITHUB: 'github'>, domain=None, api_domain=None, ignore_token_for_push=False, insecure=False)), 'repo_dir': FieldInfo(annotation=Path, required=False, default=PosixPath('.'), validate_default=True), 'tag_format': FieldInfo(annotation=str, required=False, default='v{version}'), 'version_toml': FieldInfo(annotation=Union[Tuple[str, ...], NoneType], required=False, default=None), 'version_variables': FieldInfo(annotation=Union[Tuple[str, ...], NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

no_git_verify: bool
publish: PublishConfig
remote: RemoteConfig
classmethod remove_whitespace(val: list[str]) list[str][source]
repo_dir: Annotated[Path, Field(validate_default=True)]
set_default_opts() Self[source]
classmethod tag_commit_parser_deprecation_warning(val: str) str[source]
tag_format: str
classmethod verify_git_repo_dir(dir_path: Path) Path[source]
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)[source]

Bases: BaseModel

api_domain: str | None
check_insecure_flag(url_str: str, field_name: str) None[source]
check_url_scheme() Self[source]
domain: str | None
ignore_token_for_push: bool
insecure: bool
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

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

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[Dict[str, FieldInfo]] = {'api_domain': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'domain': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'ignore_token_for_push': FieldInfo(annotation=bool, required=False, default=False), 'insecure': FieldInfo(annotation=bool, required=False, default=False), 'name': FieldInfo(annotation=str, required=False, default='origin'), 'token': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'type': FieldInfo(annotation=HvcsClient, required=False, default=<HvcsClient.GITHUB: 'github'>), 'url': FieldInfo(annotation=Union[str, NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

name: str
classmethod resolve_env_vars(val: Any) str | None[source]
set_default_token() Self[source]
token: str | None
type: HvcsClient
url: str | None
class semantic_release.cli.config.RuntimeContext(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[re.Pattern[str], ...]', version_declarations: 'Tuple[VersionDeclarationABC, ...]', hvcs_client: 'hvcs.HvcsBase', changelog_insertion_flag: 'str', 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')[source]

Bases: object

allow_zero_version: bool
apply_log_masking(masker: MaskingFilter) MaskingFilter[source]
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_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[source]
global_cli_options: GlobalCommandLineOptions
hvcs_client: HvcsBase
ignore_token_for_push: bool
major_on_zero: bool
masker: MaskingFilter
no_git_verify: bool
prerelease: bool
repo_dir: Path
static resolve_from_env(param: EnvConfigVar | str | None) str | None[source]
static select_branch_options(choices: Dict[str, BranchConfig], active_branch: str) BranchConfig[source]
template_dir: Path
template_environment: Environment
upload_to_vcs_release: bool
version_declarations: Tuple[VersionDeclarationABC, ...]
version_translator: VersionTranslator