cookiecutter_python.backend.hosting_services package

Submodules

cookiecutter_python.backend.hosting_services.check_engine module

class cookiecutter_python.backend.hosting_services.check_engine.Engine(config_file: None | str, default_config: None | bool, services_info: Tuple, checker: Checker = NOTHING, handlers: Handlers = NOTHING)[source]

Bases: object

check(servers: List[str])[source]

Request Future per supported server, for web hosting service checks

For each server the dedicated ‘checker’ is called, which tries to return a Future.

Returns None checker’s ‘activation’ boolean flag was off at runtime. Returns None if internal mechanism for determining server URL fails to derive the URL (atm URL is only trie d to be read from User Config yaml)

Parameters:

servers (List[str]) – [description]

Returns:

[description]

Return type:

[type]

checker: Checker
config_file: None | str
static create(config_file: str, default_config: bool)[source]

Initialize objects, for Asynchronous http with 3rd-party Services

Objects are designed to Ask PyPI and Read The Docs, if the soon to be generated package name, and readthedocs project slug are available.

These ‘Checker’ objects make asynchronous http requests to PyPI and RTD web servers, for non-blocking IO, and to avoid blocking the main thread.

Checkers are initialized as ‘Activated’ if User Config is given and Default Config is False.

Then each Checker (pypi, rtd) requires: - PyPI requires the ‘pkg_name’ in User’s yaml Config - RTD requires the ‘readthedocs_project_slug’ in User’s yaml Config

to derive the URLs for Future Requests

Parameters:
  • config_file (str) – user’s yaml config file

  • default_config (bool) – default config flag

default_config: None | bool
handle(request_result)[source]
handlers: Handlers
services_info: Tuple

cookiecutter_python.backend.hosting_services.check_service module

class cookiecutter_python.backend.hosting_services.check_service.ServiceChecker(name_extractor: Callable[[str], str], web_service_checker: WebHostingServiceChecker, activate_flag: bool, config_file_path: str)[source]

Bases: object

activate_flag: bool
config_file_path: str
static create(hosting_service_info, activate_flag: bool, config_file_path)[source]
name_extractor: Callable[[str], str]
property service_name
web_service_checker: WebHostingServiceChecker

cookiecutter_python.backend.hosting_services.check_web_hosting_service module

class cookiecutter_python.backend.hosting_services.check_web_hosting_service.WebHostingServiceChecker(url_getter: Callable[[str], str])[source]

Bases: object

Check if CI config is out-of-the-box ok to integrate with hosting services

static create(hosting_service)[source]
url_getter: Callable[[str], str]

cookiecutter_python.backend.hosting_services.checker module

class cookiecutter_python.backend.hosting_services.checker.Checker(config_file: None | str, default_config: None | bool, checkers: Checkers)[source]

Bases: object

checkers: Checkers
config_file: None | str
default_config: None | bool
static from_hosting_info(config_file, default_config, hosting_infos)[source]

Activate Web Host Checks if user config and NOT default config

cookiecutter_python.backend.hosting_services.checkers module

class cookiecutter_python.backend.hosting_services.checkers.Checkers(checkers: MutableMapping)[source]

Bases: object

static from_hosting_info(hosting_infos, activate_flag, config_file)[source]

cookiecutter_python.backend.hosting_services.exceptions module

exception cookiecutter_python.backend.hosting_services.exceptions.ContextVariableDoesNotExist[source]

Bases: Exception

Raised when a Context Variable does not exist, in a dict-like object.

cookiecutter_python.backend.hosting_services.extract_name module

class cookiecutter_python.backend.hosting_services.extract_name.NameExtractor(name_extractor: Callable[[Mapping], str])[source]

Bases: object

Extract Context Value, from a User’s Config (YAML) file.

static create(hosting_service_info)[source]
name_extractor: Callable[[Mapping], str]

cookiecutter_python.backend.hosting_services.handle_hosting_service_check module

class cookiecutter_python.backend.hosting_services.handle_hosting_service_check.CheckHostingServiceHandler(check_hosting_service: Callable[[str], bool], service_name: str = NOTHING)[source]

Bases: object

check_hosting_service: Callable[[str], bool]
package_name: str
service_name: str

cookiecutter_python.backend.hosting_services.handler module

class cookiecutter_python.backend.hosting_services.handler.CheckHostingServiceResultHandler(service_name: str)[source]

Bases: object

static is_future_response_200(result) bool[source]
service_name: str
class cookiecutter_python.backend.hosting_services.handler.Handlers(handlers: Mapping)[source]

Bases: object

static from_checkers(checkers)[source]
handlers: Mapping

cookiecutter_python.backend.hosting_services.value_extractor module

class cookiecutter_python.backend.hosting_services.value_extractor.BaseValueExtractor(key_name: str)[source]

Bases: ValueExtractor

key_name: str
class cookiecutter_python.backend.hosting_services.value_extractor.ValueExtractor[source]

Bases: object

cookiecutter_python.backend.hosting_services.web_hosting_service module

class cookiecutter_python.backend.hosting_services.web_hosting_service.HostingServiceInfo[source]

Bases: object

create(*args, **kwargs)[source]

Factory method for creating WebHostingService instances.

Raises:

NotImplementedError – [description]

property service
property variable_name: str
class cookiecutter_python.backend.hosting_services.web_hosting_service.HostingServices[source]

Bases: object

subclasses: Dict[str, type] = {'pypi': <class 'cookiecutter_python.backend.hosting_services.web_hosting_service.PyPIServerFactory'>, 'readthedocs': <class 'cookiecutter_python.backend.hosting_services.web_hosting_service.ReadTheDocsServerFactory'>}
class cookiecutter_python.backend.hosting_services.web_hosting_service.HostingServicesInfo(*args)[source]

Bases: SubclassRegistry[HostingServiceInfo]

class cookiecutter_python.backend.hosting_services.web_hosting_service.PyPIServerFactory[source]

Bases: HostingServiceInfo

create(*args, **kwargs)[source]

Factory method for creating WebHostingService instances.

Raises:

NotImplementedError – [description]

property variable_name: str
class cookiecutter_python.backend.hosting_services.web_hosting_service.ReadTheDocsServerFactory[source]

Bases: HostingServiceInfo

create(*args, **kwargs)[source]

Factory method for creating WebHostingService instances.

Raises:

NotImplementedError – [description]

property variable_name: str
class cookiecutter_python.backend.hosting_services.web_hosting_service.URLGetter(url_pattern: str, service_name: str)[source]

Bases: object

service_name: str
url_pattern: str
class cookiecutter_python.backend.hosting_services.web_hosting_service.WebHostingService(url: URLGetter)[source]

Bases: object

static create(url_pattern: str, service_name: str)[source]
url: URLGetter

Module contents

class cookiecutter_python.backend.hosting_services.Engine(config_file: None | str, default_config: None | bool, services_info: Tuple, checker: Checker = NOTHING, handlers: Handlers = NOTHING)[source]

Bases: object

check(servers: List[str])[source]

Request Future per supported server, for web hosting service checks

For each server the dedicated ‘checker’ is called, which tries to return a Future.

Returns None checker’s ‘activation’ boolean flag was off at runtime. Returns None if internal mechanism for determining server URL fails to derive the URL (atm URL is only trie d to be read from User Config yaml)

Parameters:

servers (List[str]) – [description]

Returns:

[description]

Return type:

[type]

checker: Checker
config_file: None | str
static create(config_file: str, default_config: bool)[source]

Initialize objects, for Asynchronous http with 3rd-party Services

Objects are designed to Ask PyPI and Read The Docs, if the soon to be generated package name, and readthedocs project slug are available.

These ‘Checker’ objects make asynchronous http requests to PyPI and RTD web servers, for non-blocking IO, and to avoid blocking the main thread.

Checkers are initialized as ‘Activated’ if User Config is given and Default Config is False.

Then each Checker (pypi, rtd) requires: - PyPI requires the ‘pkg_name’ in User’s yaml Config - RTD requires the ‘readthedocs_project_slug’ in User’s yaml Config

to derive the URLs for Future Requests

Parameters:
  • config_file (str) – user’s yaml config file

  • default_config (bool) – default config flag

default_config: None | bool
handle(request_result)[source]
handlers: Handlers
services_info: Tuple