buildenv.manager

Attributes

BUILDENV_OK

Valid buildenv tag file

Classes

BuildEnvManager

buildenv manager entry point

Module Contents

buildenv.manager.BUILDENV_OK = 'buildenvOK'

Valid buildenv tag file

class buildenv.manager.BuildEnvManager(project_path: pathlib.Path, venv_bin_path: pathlib.Path = None)

buildenv manager entry point

Parameters:
  • project_path – Path to the current project root folder

  • venv_bin_path – Path to venv binary folder to be used (mainly for test purpose; if None, will use current venv executable)

venv_bin_path
venv_path
venv_root_path
project_path
project_script_path
loader
is_windows
venv_context
buildenv_ok
project_buildenv_ok
is_valid_projet = True
renderer
init(options: argparse.Namespace = None)

Build environment initialization.

This method generates loading scripts in current project folder (if not invoked from loading scripts; can’t update them while they’re running).

If the buildenv is not marked as ready yet, this method also:

  • verify recommended git files

  • invoke extra environment initializers defined by sub-classes

  • mark buildenv as ready

Parameters:

options – Input command line parsed options

register_completion(command: str)

Register a new command for completion in activation scripts. This command must be a python entry point supporting argcomplete completion.

Parameters:

command – New command to be registered

register_ignored_pattern(pattern: str)

Register a new pattern to be added to generated .gitignore file

Parameters:

pattern – New pattern to be ignored

add_activation_file(name: str, extension: str, template: str, keywords: Dict[str, str] = None)

Add activation file in venv (in “<venv>/<bin or Script>/activate.d” folder). This file will be loaded each time the venv is activated.

Parameters:
  • name – Name of the activation script

  • extension – Extension of the activation script

  • template – Path to Jinja template file to be rendered for this script

  • keyword – Map of keywords provided to template

shell(options: argparse.Namespace)

Verify that the context is OK to run a shell, then throws a specific return code so that loading script is told to spawn an interactive shell.

Parameters:

options – Input command line parsed options

run(options: argparse.Namespace)

Verify that the context is OK to run a command, then:

  • generates command script containing the command to be executed

  • throws a specific return code so that loading script is told to execute the generated command script

Parameters:

options – Input command line parsed options

upgrade(options: argparse.Namespace)

Upgrade python venv installed packages to latest version

Parameters:

options – Input command line parsed options