Documentation
¶
Index ¶
- func VenvActivateCmd(venvDir string) string
- func VenvNameForDir(projectDir string) string
- func VenvPythonPath(venvDir string) string
- type Cli
- func (cli *Cli) CheckInstalled(ctx context.Context) error
- func (cli *Cli) CreateVirtualEnv(ctx context.Context, workingDir, name string, env []string) error
- func (cli *Cli) EnsureVirtualEnv(ctx context.Context, workingDir, name string, env []string) error
- func (cli *Cli) InstallDependencies(ctx context.Context, dir, venvName, depFile string, env []string) error
- func (cli *Cli) InstallProject(ctx context.Context, workingDir, environment string, env []string) error
- func (cli *Cli) InstallRequirements(ctx context.Context, workingDir, environment, requirementFile string, ...) error
- func (cli *Cli) InstallUrl() string
- func (cli *Cli) Name() string
- func (cli *Cli) ResolveCommand() (string, error)
- func (cli *Cli) Run(ctx context.Context, workingDir string, environment string, env []string, ...) (*exec.RunResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VenvActivateCmd ¶ added in v1.23.15
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
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
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) CreateVirtualEnv ¶
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) InstallUrl ¶
func (*Cli) ResolveCommand ¶ added in v1.23.15
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".