flexlate_dev package

Development tools for template authors using Flexlate

Subpackages

Submodules

flexlate_dev.cli module

flexlate_dev.cli.pre_execute(version=<typer.models.OptionInfo object>)[source]
flexlate_dev.cli.publish(out_path=<typer.models.ArgumentInfo object>, run_config=<typer.models.ArgumentInfo object>, template_path=<typer.models.OptionInfo object>, config_path=<typer.models.OptionInfo object>, no_input=<typer.models.OptionInfo object>, save=<typer.models.OptionInfo object>, data=<typer.models.OptionInfo object>, folder_name=<typer.models.OptionInfo object>)[source]

Sync rendered output of a template

flexlate_dev.cli.publish_all(out_path=<typer.models.ArgumentInfo object>, template_path=<typer.models.OptionInfo object>, config_path=<typer.models.OptionInfo object>, always_include_default=<typer.models.OptionInfo object>, exclude=<typer.models.OptionInfo object>, no_input=<typer.models.OptionInfo object>, save=<typer.models.OptionInfo object>, data=<typer.models.OptionInfo object>)[source]

Sync rendered output of a template for all run configurations in the config file

flexlate_dev.cli.serve(run_config=<typer.models.ArgumentInfo object>, out_path=<typer.models.OptionInfo object>, back_sync=<typer.models.OptionInfo object>, template_path=<typer.models.OptionInfo object>, no_input=<typer.models.OptionInfo object>, no_auto_commit=<typer.models.OptionInfo object>, config_path=<typer.models.OptionInfo object>, save=<typer.models.OptionInfo object>, data=<typer.models.OptionInfo object>, folder_name=<typer.models.OptionInfo object>)[source]

Run a development server with auto-reloading to see rendered output of a template

flexlate_dev.cli_validators module

flexlate_dev.cli_validators.parse_data_from_str(data_str)[source]
Return type:

Dict[str, Any]

flexlate_dev.command_runner module

flexlate_dev.command_runner.run_command(cmd)[source]
flexlate_dev.command_runner.run_command_or_command_strs(cmds)[source]

flexlate_dev.config module

class flexlate_dev.config.DataConfiguration(**data)[source]

Bases: BaseModel

data: Dict[str, Any]
folder_name: Optional[str]
ignore: List[str]
property use_folder_name: str
Return type:

str

class flexlate_dev.config.FlexlateDevConfig(_env_file='<object object>', _env_file_encoding=None, _env_nested_delimiter=None, _secrets_dir=None, **values)[source]

Bases: BaseConfig

Flexlate Dev configuration.

commands: List[UserCommand]
data: Dict[str, UserDataConfiguration]
get_data_config(name)[source]
Return type:

DataConfiguration

get_default_data()[source]
Return type:

Optional[DataConfiguration]

get_full_run_config(command, name=None)[source]
Return type:

FullRunConfiguration

get_global_command_by_id(id)[source]
Return type:

UserCommand

get_run_config(command, name=None)[source]
Return type:

UserRunConfiguration

get_run_config_names(always_include_default=False)[source]
Return type:

List[str]

run_configs: Dict[str, UserRootRunConfiguration]
save(serializer_kwargs=None, **kwargs)[source]
save_data_for_run_config(run_config, data)[source]
class flexlate_dev.config.FullRunConfiguration(config, data)[source]

Bases: object

__init__(config, data)
config: RunConfiguration
data: Optional[DataConfiguration]
ignore_matches(to_match)[source]
Return type:

bool

to_jinja_data(context)[source]
Return type:

Dict[str, Any]

class flexlate_dev.config.UserDataConfiguration(**data)[source]

Bases: DataConfiguration

extends: Optional[str]
flexlate_dev.config.create_default_run_configs()[source]
Return type:

Dict[str, UserRootRunConfiguration]

flexlate_dev.config.load_config(config_path)[source]
Return type:

FlexlateDevConfig

flexlate_dev.config_schema module

flexlate_dev.config_schema.create_config_schema()[source]
Return type:

str

flexlate_dev.config_schema.main()[source]

flexlate_dev.dict_merge module

flexlate_dev.dict_merge.merge_dicts_preferring_non_none(*dicts)[source]

Merge multiple dictionaries, overriding previous values with later ones unless the value is None. None will only be the output value if all the dicts have the value None for that key.

Return type:

dict

flexlate_dev.dirutils module

flexlate_dev.dirutils.change_directory_to(path)[source]
flexlate_dev.dirutils.directory_has_files_or_directories(path)[source]

flexlate_dev.exc module

exception flexlate_dev.exc.FlexlateDevException[source]

Bases: Exception

exception flexlate_dev.exc.NoSuchCommandException[source]

Bases: UserInputException

exception flexlate_dev.exc.NoSuchDataException[source]

Bases: UserInputException

exception flexlate_dev.exc.NoSuchRunConfigurationException[source]

Bases: UserInputException

exception flexlate_dev.exc.UserInputException[source]

Bases: FlexlateDevException

flexlate_dev.ext_flexlate module

class flexlate_dev.ext_flexlate.FlexlateBranchNames(**data)[source]

Bases: BaseModel

merged_branch_name: str
template_branch_name: str
flexlate_dev.ext_flexlate.get_flexlate_branch_names_from_project_path(project_path)[source]
Return type:

FlexlateBranchNames

flexlate_dev.ext_flexlate.get_non_flexlate_commits_between_commits(repo, start, end, merged_branch_name, template_branch_name)[source]
Return type:

List[Commit]

flexlate_dev.ext_flexlate.get_render_relative_root_in_template_from_project_path(project_path)[source]
Return type:

Path

flexlate_dev.ext_flexlate.get_template_path_from_project_path(project_path)[source]
Return type:

str

flexlate_dev.ext_subprocess module

flexlate_dev.ext_subprocess.run_command_in_background_stream_output(cmd)[source]
flexlate_dev.ext_subprocess.run_command_stream_output(cmd)[source]

flexlate_dev.ext_threading module

class flexlate_dev.ext_threading.PropagatingThread(group=None, target=None, name=None, args=(), kwargs=None, *, daemon=None)[source]

Bases: Thread

join(timeout=None)[source]

Wait until the thread terminates.

This blocks the calling thread until the thread whose join() method is called terminates – either normally or through an unhandled exception or until the optional timeout occurs.

When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). As join() always returns None, you must call is_alive() after join() to decide whether a timeout happened – if the thread is still alive, the join() call timed out.

When the timeout argument is not present or None, the operation will block until the thread terminates.

A thread can be join()ed many times.

join() raises a RuntimeError if an attempt is made to join the current thread as that would cause a deadlock. It is also an error to join() a thread before it has been started and attempts to do so raises the same exception.

run()[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

flexlate_dev.external_command_type module

class flexlate_dev.external_command_type.ExternalCLICommandType(value)[source]

Bases: str, Enum

An enumeration.

PUBLISH = 'publish'
SERVE = 'serve'

flexlate_dev.get_version module

flexlate_dev.get_version.get_flexlate_dev_version()[source]
Return type:

str

flexlate_dev.gitutils module

class flexlate_dev.gitutils.BranchInfo(**data)[source]

Bases: BaseModel

commit_shas: List[str]
name: str
flexlate_dev.gitutils.create_branch_from_commits_get_new_shas(repo, branch_name, base_commit, commits)[source]
Return type:

List[str]

flexlate_dev.gitutils.stage_and_commit_all(repo, commit_message)[source]
flexlate_dev.gitutils.temporary_branch_from_commits(repo, base_commit, commits)[source]
Return type:

Iterator[BranchInfo]

flexlate_dev.ignore module

class flexlate_dev.ignore.IgnoreSpecification(ignore_list)[source]

Bases: object

__init__(ignore_list)
property all_ignores: List[str]
Return type:

List[str]

file_is_ignored(file_path)[source]
Return type:

bool

ignore_list: List[str]
flexlate_dev.ignore.parse_gitignore_list_into_matcher(gitignore_list)[source]
Return type:

Callable[[Union[str, Path]], bool]

flexlate_dev.logger module

class flexlate_dev.logger.LogLevel(value)[source]

Bases: str, Enum

An enumeration.

DEBUG = 'DEBUG'
INFO = 'INFO'
class flexlate_dev.logger.LoggingConfig(_env_file='<object object>', _env_file_encoding=None, _env_nested_delimiter=None, _secrets_dir=None, **values)[source]

Bases: BaseSettings

class Config[source]

Bases: object

env_prefix = 'FLEXLATE_DEV_LOG_'
classmethod cast_log_level(v)[source]
level: LogLevel

flexlate_dev.project_ops module

flexlate_dev.project_ops.initialize_project_get_folder(template_path, out_root, config, run_config, jinja_env, no_input=False, data=None, save=True, default_folder_name='project')[source]
Return type:

str

flexlate_dev.project_ops.update_or_initialize_project_get_folder(template_path, out_root, config, run_config, no_input=False, data=None, save=False, abort_on_conflict=False, auto_commit=True, known_folder_name=None, default_folder_name='project')[source]
Return type:

str

flexlate_dev.project_ops.update_project(out_path, config, run_config, jinja_env, data=None, no_input=False, abort_on_conflict=False, auto_commit=True, save=True)[source]

flexlate_dev.publish module

flexlate_dev.publish.publish_all_templates(template_path, out_root, config_path=None, always_include_default=False, exclude=None, no_input=False, save=False, abort_on_conflict=False, data=None, folder_name=None)[source]
flexlate_dev.publish.publish_template(template_path, out_root, run_config_name=None, config_path=None, no_input=False, save=False, abort_on_conflict=False, data=None, folder_name=None)[source]

flexlate_dev.render module

flexlate_dev.render.create_jinja_environment(**options)[source]

Creates a jinja environment for rendering templates. :rtype: Environment :return: jinja2 environment

flexlate_dev.styles module

flexlate_dev.styles.print_styled(message, style)[source]
flexlate_dev.styles.styled(message, style)[source]
Return type:

str

flexlate_dev.user_command module

class flexlate_dev.user_command.UserCommand(**data)[source]

Bases: BaseModel

background: Optional[bool]
property display_name: str
Return type:

str

classmethod from_string(command)[source]
Return type:

UserCommand

id: Optional[str]
property is_reference: bool
Return type:

bool

name: Optional[str]
run: Optional[str]
classmethod run_or_id_must_be_defined(v)[source]

flexlate_dev.user_runner module

Handles resolving commands referenced by id so that the command_runner module can focus on only running a sequence of commands. Also has context of the different configuration hooks so that the command_runner module can be focused on just running commands.

class flexlate_dev.user_runner.CommandContext(**data)[source]

Bases: BaseModel

Represents the context of a command that will be provided for the user to use in templated commands

classmethod create(template_root, out_root, no_input, save, abort_on_conflict=None, auto_commit=None)[source]
options: OptionsContext
paths: PathsContext
class flexlate_dev.user_runner.OptionsContext(**data)[source]

Bases: BaseModel

abort_on_conflict: Optional[bool]
auto_commit: Optional[bool]
no_input: bool
save: bool
class flexlate_dev.user_runner.PathsContext(**data)[source]

Bases: BaseModel

out_root: str
template_root: str
class flexlate_dev.user_runner.RunConfiguration(**data)[source]

Bases: BaseModel

auto_commit_message: Optional[str]
property commit_message: str
Return type:

str

data_name: Optional[str]
out_root: Optional[Path]
post_init: Optional[List[Union[UserCommand, str]]]
post_update: Optional[List[Union[UserCommand, str]]]
pre_check: Optional[List[Union[UserCommand, str]]]
pre_update: Optional[List[Union[UserCommand, str]]]
class flexlate_dev.user_runner.RunnerHookType(value)[source]

Bases: str, Enum

An enumeration.

POST_INIT = 'post_init'
POST_UPDATE = 'post_update'
PRE_CHECK = 'pre_check'
PRE_UPDATE = 'pre_update'
class flexlate_dev.user_runner.UserRootRunConfiguration(**data)[source]

Bases: UserRunConfiguration

get_run_config(command)[source]
Return type:

UserRunConfiguration

publish: Optional[UserRunConfiguration]
serve: Optional[UserRunConfiguration]
class flexlate_dev.user_runner.UserRunConfiguration(**data)[source]

Bases: RunConfiguration

extends: Optional[str]
flexlate_dev.user_runner.run_user_hook(hook_type, out_path, run_config, config, jinja_env, context)[source]

Runs a hook of the given type.