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].

This replaces Model.__fields__ from Pydantic V1.

prerelease: bool#
prerelease_token: str#
class semantic_release.cli.config.ChangelogConfig(*, template_dir: str = 'templates', changelog_file: str = 'CHANGELOG.md', exclude_commit_patterns: Tuple[str, ...] = (), environment: 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=True))[source]#

Bases: BaseModel

changelog_file: str#
environment: ChangelogEnvironmentConfig#
exclude_commit_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]] = {'changelog_file': FieldInfo(annotation=str, required=False, default='CHANGELOG.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=True)), 'exclude_commit_patterns': FieldInfo(annotation=Tuple[str, ...], required=False, default=()), '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].

This replaces Model.__fields__ from Pydantic V1.

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 = True)[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=True), '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].

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.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].

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=None, *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].

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, changelog: ~semantic_release.cli.config.ChangelogConfig = ChangelogConfig(template_dir='templates', changelog_file='CHANGELOG.md', exclude_commit_patterns=(), 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=True)), 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: str = '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, 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), 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#
changelog: ChangelogConfig#
commit_author: MaybeFromEnv#
commit_message: str#
commit_parser: NonEmptyString#
commit_parser_options: Dict[str, Any]#
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), 'changelog': FieldInfo(annotation=ChangelogConfig, required=False, default=ChangelogConfig(template_dir='templates', changelog_file='CHANGELOG.md', exclude_commit_patterns=(), 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=True))), '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), '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)), '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].

This replaces Model.__fields__ from Pydantic V1.

publish: PublishConfig#
remote: RemoteConfig#
set_default_opts() Self[source]#
tag_format: str#
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].

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: 'Repo', commit_parser: 'CommitParser[ParseResult, ParserOptions]', version_translator: 'VersionTranslator', major_on_zero: 'bool', allow_zero_version: 'bool', prerelease: '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_file: 'Path', ignore_token_for_push: 'bool', template_environment: 'Environment', template_dir: 'Path', build_command: 'Optional[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#
changelog_excluded_commit_patterns: Tuple[Pattern[str], ...]#
changelog_file: Path#
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#
prerelease: bool#
repo: Repo#
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#