mloq.commands#

Contains all the defined mloq Commands.

Submodules#

Package Contents#

Classes#

CiCMD

Implement the functionality of the ci Command.

DockerCMD

Implement the functionality of the docker Command.

DocsCMD

Implement the functionality of the docs Command.

GlobalsCMD

Implement the functionality of the globals Command.

LicenseCMD

Implement the functionality of the license Command.

LintCMD

Implement the functionality of the lint Command.

PackageCMD

Implement the functionality of the package Command.

ProjectCMD

Implement the functionality of the project Command.

RequirementsCMD

Implement the functionality of the requirements Command.

SetupCMD

Implement the functionality of the setup Command.

class mloq.commands.CiCMD(record, interactive=False, **kwargs)[source]#

Bases: mloq.command.Command

Implement the functionality of the ci Command.

Parameters
  • record (mloq.writer.CMDRecord) –

  • interactive (bool) –

cmd_name :str = ci#
ubuntu_version#
disable#
docker#
project_name#
default_branch#
docker_org#
bot_name#
bot_email#
ci_python_version#
python_versions#
ci_extra#
vendor#
open_source#
author#
owner#
email#
project_url#
files#
property directories#

Tuple containing Paths objects representing the directories created by the command.

Return type

Tuple[pathlib.Path]

interactive_config()[source]#

Generate the configuration of the project interactively.

Return type

omegaconf.DictConfig

record_files()[source]#

Register the files that will be generated by mloq.

Return type

None

class mloq.commands.DockerCMD(record, interactive=False, **kwargs)[source]#

Bases: mloq.command.Command

Implement the functionality of the docker Command.

Parameters
  • record (mloq.writer.CMDRecord) –

  • interactive (bool) –

cmd_name = docker#
files#
disable#
cuda#
cuda_image_type#
cuda_version#
ubuntu_version#
project_name#
docker_org#
python_version#
base_image#
test#
lint#
jupyter#
jupyter_password#
requirements#
extra#
makefile#
static require_cuda_from_requirements(project_config=None)[source]#

Return True if any of the project dependencies require CUDA.

Parameters

project_config (Optional[omegaconf.DictConfig]) –

Return type

bool

requires_cuda()[source]#

Return True if the Docker container requires CUDA.

Return type

bool

get_base_image()[source]#

Return the name of the base image for the project Docker container.

parse_config()[source]#

Update the configuration dictionary from the data entered by the user.

Return type

omegaconf.DictConfig

interactive_config()[source]#

Generate the configuration of the project interactively.

Return type

omegaconf.DictConfig

record_files()[source]#

Register the files that will be generated by mloq.

Return type

None

class mloq.commands.DocsCMD(record, interactive=False, **kwargs)[source]#

Bases: mloq.command.Command

Implement the functionality of the docs Command.

Parameters
  • record (mloq.writer.CMDRecord) –

  • interactive (bool) –

cmd_name = docs#
disable#
project_name#
description#
author#
copyright_year#
copyright_holder#
deploy_docs#
default_branch#
project_url#
files#
property directories#

Tuple containing Paths objects representing the directories created by the command.

Return type

Tuple[pathlib.Path]

interactive_config()[source]#

Generate the configuration of the project interactively.

Return type

omegaconf.DictConfig

record_files()[source]#

Register the files that will be generated by mloq.

Return type

None

class mloq.commands.GlobalsCMD(record, interactive=False, **kwargs)[source]#

Bases: mloq.command.Command

Implement the functionality of the globals Command.

Parameters
  • record (mloq.writer.CMDRecord) –

  • interactive (bool) –

cmd_name = globals#
project_name#
description#
author#
owner#
email#
open_source#
project_url#
default_branch#
license#
use_poetry#
main_python_version#
interactive_config()[source]#

Generate the configuration of the project interactively.

Return type

omegaconf.DictConfig

parse_config()[source]#

Generate the configuration of the project via a configuration file.

Return type

omegaconf.DictConfig

class mloq.commands.LicenseCMD(record, interactive=False, **kwargs)[source]#

Bases: mloq.command.Command

Implement the functionality of the license Command.

Parameters
  • record (mloq.writer.CMDRecord) –

  • interactive (bool) –

cmd_name = license#
files#
LICENSES#
disable#
license#
copyright_year#
copyright_holder#
project_name#
project_url#
email#
interactive_config()[source]#

Generate the configuration of the project interactively.

Return type

omegaconf.DictConfig

record_files()[source]#

Register the files that will be generated by mloq.

Return type

None

class mloq.commands.LintCMD(record, interactive=False, **kwargs)[source]#

Bases: mloq.command.Command

Implement the functionality of the lint Command.

Parameters
  • record (mloq.writer.CMDRecord) –

  • interactive (bool) –

cmd_name = lint#
files#
disable#
black#
isort#
linters#
docstring_checks#
pyproject_extra#
project_name#
makefile#
poetry_requirements#
ignore_files#
interactive_config()[source]#

Generate the configuration of the project interactively.

Return type

omegaconf.DictConfig

record_files()[source]#

Register the files that will be generated by mloq.

Return type

None

class mloq.commands.PackageCMD(record, interactive=False, **kwargs)[source]#

Bases: mloq.command.Command

Implement the functionality of the package Command.

Parameters
  • record (mloq.writer.CMDRecord) –

  • interactive (bool) –

cmd_name = package#
files#
LICENSE_CLASSIFIERS#
disable#
pyproject_extra#
project_name#
license#
license_classifier#
description#
default_branch#
project_url#
owner#
author#
email#
main_python_version#
python_versions#
use_poetry#
parse_config()[source]#

Update the configuration DictConfig with the Command parameters.

Return type

omegaconf.DictConfig

interactive_config()[source]#

Generate the configuration of the project interactively.

Return type

omegaconf.DictConfig

record_files()[source]#

Register the files that will be generated by mloq.

Return type

None

class mloq.commands.ProjectCMD(record, interactive=False, **kwargs)[source]#

Bases: mloq.command.Command

Implement the functionality of the project Command.

Parameters
  • record (mloq.writer.CMDRecord) –

  • interactive (bool) –

cmd_name = project#
files#
disable#
project_name#
owner#
description#
project_url#
license#
tests#
property directories#

Tuple containing Paths objects representing the directories created by the command.

Return type

Tuple[pathlib.Path]

record_files()[source]#

Register the files that will be generated by mloq.

Return type

None

class mloq.commands.RequirementsCMD(record, interactive=False)[source]#

Bases: mloq.command.Command

Implement the functionality of the requirements Command.

Parameters
cmd_name = requirements#
files#
disable#
requirements#
REQUIREMENTS_ALIASES#
__del__()[source]#

Remove the temporary directory when the instance is deleted.

Return type

None

classmethod get_aliased_requirements_file(option)[source]#

Get requirement file from aliased name.

Parameters

option (str) –

Return type

mloq.files.File

classmethod read_requirements_file(option)[source]#

Return the content of the target requirements file form an aliased name.

Parameters

option (str) –

Return type

str

classmethod compose_requirements(options)[source]#

Return the content requirements.txt file with pinned dependencies.

The returned string contains the combined dependencies for the different options sorted alphabetically.

Parameters

options (Iterable[str]) – Iterable containing the aliased names of the target dependencies for the project.

Returns

str containing the pinned versions of all the selected requirements.

Return type

str

interactive_config()[source]#

Generate the configuration of the project interactively.

Return type

omegaconf.DictConfig

static requirements_is_empty(options)[source]#

Return True if no requirements are specified for the project.

Parameters

options (Union[List[str], str]) –

Return type

bool

record_files()[source]#

Register the files that will be generated by mloq.

Return type

None

class mloq.commands.SetupCMD(record, interactive=False)[source]#

Bases: mloq.command.CommandMixin

Implement the functionality of the setup Command.

Parameters
cmd_name = setup#
files#
SUB_COMMAND_CLASSES#
property config#

List of all the commands that will be executed when running mloq setup.

Return type

omegaconf.DictConfig

property sub_commands#

List of all the commands that will be executed when running mloq setup.

Return type

List[mloq.command.Command]

property directories#

Tuple containing Paths objects representing the directories created by the command.

Return type

Tuple[pathlib.Path]

interactive_config()[source]#

Generate the configuration of the project interactively.

Return type

omegaconf.DictConfig

parse_config()[source]#

Update the configuration DictConfig with the Command parameters.

Return type

omegaconf.DictConfig

run_side_effects()[source]#

Apply additional configuration methods.

Return type

None

record_files()[source]#

Register the files that will be generated by mloq.

Return type

None