whisk.setup
¶
Module Contents¶
Functions¶
|
Calls the logger on each of the log_lines. The log lines are prefixed with |
|
Executes the cmd, and logs desc prior to execution and "DONE" after. |
|
Sets up an environment for the given project. |
|
|
|
Updates the |
|
Logs that the setup completed successfully and provides next steps. |
Logs the output of |
|
|
Sets up the project environment. |
Attributes¶
- whisk.setup.log_subprocess_output(logger_with_level, log_lines)[source]¶
Calls the logger on each of the log_lines. The log lines are prefixed with
whisk.cli.log_tree.CHILD_TREE_NODE_PREFIX
.- logger_with_levelLogger
A logger instance (ex:
logger.debug
).- log_linesstr
A string of log lines separated with
\n
.
- whisk.setup.exec(desc, cmd)[source]¶
Executes the cmd, and logs desc prior to execution and “DONE” after. If the cmd has stdout or stderr output this is logged as well.
If the exit code is nonzero, raises a
SystemExit
execption.- descstr
A description of the command operation.
- cmdstr
The command to execute.
- whisk.setup.exec_setup(project)[source]¶
Sets up an environment for the given project.
- projectwhisk.project.Project
A whisk project.
- whisk.setup.set_example_notebook_kernel(nbenv)[source]¶
Updates the
NOTEBOOK_EXAMPLE_PATH
notebook kernel to use the kernel with namenbenv
.
- whisk.setup.log_success(dir)[source]¶
Logs that the setup completed successfully and provides next steps.
- whisk.setup.setup(dir)[source]¶
Sets up the project environment.
Setup performs the following actions after changing the working directory to
dir
:Creates a Python3 venv named “venv”
Installs the dependencies listed in the project’s requirements.txt.
Initializes a Git repo
Creates an iPython kernel for use in Jupyter notebooks with name = <project_name>.
Creates a
.envrc
file based on.envrc.example
for use with direnv. direnv loads environment variables listed in.envrc
into the shell and is also used to auto-activate and deactivate the venv when entering and exiting the project directory.Calls
direnv allow .
so the.envrc
file can be loaded.Makes an initial Git commit
- dirstr
The full path to the project directory.