Skip to content

bumpversion.click_config ​

A configuration option for click.

logger ​

python
logger = get_indented_logger(__name__)

BoolOrStr ​

python
BoolOrStr = Union[bool, str]

StrSequence ​

python
StrSequence = Sequence[str]

ConfigOption ​

python
class ConfigOption(param_decls: Optional[StrSequence] = None, show_default: Optional[BoolOrStr] = None, allow_from_autoenv: bool = True, help: Optional[str] = None, show_envvar: bool = False, attrs = {})

A configuration option for click.

process_value ​

python
def process_value(ctx: Context, value: Any) -> Optional[Path]

Process the value of the option.

config_option ​

python
def config_option(param_decls: str = (), attrs: Any = {}) -> Callable[[FC], FC]

Attaches a ConfigOption to the command.

All positional arguments are passed as parameter declarations to ConfigOption.

All keyword arguments are forwarded unchanged (except cls). This is equivalent to creating a ConfigOption instance manually and attaching it to the Command.params list.

For the default option class, refer to ConfigOption and Parameter for descriptions of parameters.

Parameters

  • *param_decls: Passed as positional arguments to the constructor of cls.
  • cls: the option class to instantiate. This defaults to ConfigOption.
  • **attrs: Passed as keyword arguments to the constructor of cls.

Returns

  • A decorated function.

resolve_conf_location ​

python
def resolve_conf_location(url_or_path: str) -> Path

Resolve a URL or path.

The path is considered a URL if it is parseable as such and starts with http:// or https://.

Parameters

  • url_or_path: The URL or path to resolve.

Returns

  • The contents of the location.

Raises

  • BumpVersionError: if the file does not exist.

download_url ​

python
def download_url(url: str) -> Path

Download the contents of a URL.

Parameters

  • url: The URL to download

Returns

  • The Path to the downloaded file.

Raises

  • BadInputError: if there is a problem downloading the URL

get_file_name_from_url ​

python
def get_file_name_from_url(url: str) -> str

Extracts the file name from a URL.

Parameters

  • url: The URL to extract the file name from.

Returns

  • The file name from the URL, or an empty string if there is no file name.