python

package
v1.23.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VenvActivateCmd added in v1.23.15

func VenvActivateCmd(venvDir string) string

VenvActivateCmd returns the shell command or path used to activate the given virtual environment. On Windows it returns the Scripts/activate path; on other platforms it returns ". bin/activate" suitable for sourcing.

func VenvNameForDir added in v1.23.15

func VenvNameForDir(projectDir string) string

VenvNameForDir computes a virtual environment directory name from the given project directory path, using the naming convention {baseName}_env. Both the framework service and the hook executor share this convention.

func VenvPythonPath added in v1.23.15

func VenvPythonPath(venvDir string) string

VenvPythonPath returns the path to the Python executable inside the given virtual environment directory. On Windows this is Scripts/python.exe; on other platforms bin/python.

Types

type Cli

type Cli struct {
	// contains filtered or unexported fields
}

func NewCli

func NewCli(commandRunner exec.CommandRunner) *Cli

func (*Cli) CheckInstalled

func (cli *Cli) CheckInstalled(ctx context.Context) error

func (*Cli) CreateVirtualEnv

func (cli *Cli) CreateVirtualEnv(ctx context.Context, workingDir, name string, env []string) error

func (*Cli) EnsureVirtualEnv added in v1.23.15

func (cli *Cli) EnsureVirtualEnv(
	ctx context.Context,
	workingDir, name string,
	env []string,
) error

EnsureVirtualEnv creates the virtual environment if it does not already exist. If the venv directory exists, creation is skipped. Non-directory paths and inaccessible paths are reported as errors.

func (*Cli) InstallDependencies added in v1.23.15

func (cli *Cli) InstallDependencies(
	ctx context.Context,
	dir, venvName, depFile string,
	env []string,
) error

InstallDependencies dispatches dependency installation based on the given dependency file name. It calls Cli.InstallRequirements for "requirements.txt" and Cli.InstallProject for "pyproject.toml". Unrecognized file names are logged and skipped.

func (*Cli) InstallProject

func (cli *Cli) InstallProject(ctx context.Context, workingDir, environment string, env []string) error

InstallProject installs dependencies from pyproject.toml using pip.

func (*Cli) InstallRequirements

func (cli *Cli) InstallRequirements(
	ctx context.Context, workingDir, environment, requirementFile string, env []string,
) error

func (*Cli) InstallUrl

func (cli *Cli) InstallUrl() string

func (*Cli) Name

func (cli *Cli) Name() string

func (*Cli) ResolveCommand added in v1.23.15

func (cli *Cli) ResolveCommand() (string, error)

ResolveCommand returns the platform-appropriate Python command name. On Windows it prefers "py" (PEP 397 launcher), falling back to "python"; on other platforms it uses "python3".

func (*Cli) Run

func (cli *Cli) Run(
	ctx context.Context,
	workingDir string,
	environment string,
	env []string,
	args ...string,
) (*exec.RunResult, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL