Documentation
¶
Index ¶
- func ActivateVenvIfPresent(fs afero.Fs, osClient types.Os, projectDir string) (bool, error)
- func IsRuntimeForProject(ctx context.Context, fs afero.Fs, dirPath string, sdkConfig hooks.SDKCLIConfig) bool
- type Python
- func (p *Python) HooksJSONTemplate() []byte
- func (p *Python) IgnoreDirectories() []string
- func (p *Python) InstallProjectDependencies(ctx context.Context, projectDirPath string, hookExecutor hooks.HookExecutor, ...) (output string, err error)
- func (p *Python) Name() string
- func (p *Python) PreparePackage(ctx context.Context, sdkConfig hooks.SDKCLIConfig, ...) error
- func (p *Python) SetVersion(version string)
- func (p *Python) Version() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActivateVenvIfPresent ¶
ActivateVenvIfPresent sets the process environment variables that a Python virtual environment's activate script would set, so that child processes (hook scripts) inherit the activated venv. This is a no-op when no .venv directory exists in projectDir.
The three env vars (VIRTUAL_ENV, PATH, PYTHONHOME) are the stable contract defined by PEP 405 (Python 3.3, 2012). Other tools (Poetry, tox, pipx) use the same approach. Sourcing the shell-specific activate script (activate, activate.fish, Activate.ps1) would be higher maintenance because it varies by shell.
func IsRuntimeForProject ¶
func IsRuntimeForProject(ctx context.Context, fs afero.Fs, dirPath string, sdkConfig hooks.SDKCLIConfig) bool
IsRuntimeForProject returns true if dirPath is a Python project
Types ¶
type Python ¶
type Python struct {
}
Python runtime type
func (*Python) HooksJSONTemplate ¶
HooksJSONTemplate returns the default hooks.json template
func (*Python) IgnoreDirectories ¶
IgnoreDirectories is a list of directories to ignore when packaging the runtime for deployment.
func (*Python) InstallProjectDependencies ¶
func (p *Python) InstallProjectDependencies(ctx context.Context, projectDirPath string, hookExecutor hooks.HookExecutor, ios iostreams.IOStreamer, fs afero.Fs, os types.Os) (output string, err error)
InstallProjectDependencies creates a virtual environment and installs project dependencies.
func (*Python) PreparePackage ¶
func (p *Python) PreparePackage(ctx context.Context, sdkConfig hooks.SDKCLIConfig, hookExecutor hooks.HookExecutor, opts types.PreparePackageOpts) error
PreparePackage will prepare and copy the app in projectDirPath to tmpDirPath as a release-ready bundle.
func (*Python) SetVersion ¶
SetVersion sets the Version value