pkg

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 19 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpectMicromamba

func ExpectMicromamba(binFolder string, feedback CreateEnvironmentOptions) (string, error)

func ExtractURLComponent

func ExtractURLComponent(urlStr string) (string, error)

func NewGitRepo

func NewGitRepo(url string, directory string, branch string) (*git.Repository, string, error)

func RunReadStdout

func RunReadStdout(binPath string, args ...string) (string, error)

Types

type CreateEnvironmentOptions

type CreateEnvironmentOptions int

user feedback options for CreateEnvironment

const (
	// Show progress bar
	ShowProgressBar CreateEnvironmentOptions = iota
	// Show progress bar and verbose output
	ShowProgressBarVerbose
	// Show verbose output
	ShowVerbose
	// Show nothing
	ShowNothing
)

type Environment

type Environment struct {
	Name              string  // Name of the environment
	RootDir           string  // Root directory of the environment
	EnvPath           string  // Path to the environment
	EnvBinPath        string  // Path to the bin directory within the environment
	EnvLibPath        string  // Path to the lib directory within the environment
	PythonVersion     Version // Version of the Python environment
	MicromambaVersion Version // Version of the micromamba executable
	PipVersion        Version // Version of the pip executable
	MicromambaPath    string  // Path to the micromamba executable
	PythonPath        string  // Path to the Python executable within the environment
	PythonLibPath     string  // Path to the Python library within the environment
	PipPath           string  // Path to the pip executable within the environment
	PythonHeadersPath string  // Path to the Python headers within the environment
	SitePackagesPath  string  // Path to the site-packages directory within the environment
}

func CreateEnvironment

func CreateEnvironment(envName string, rootDir string, pythonVersion string, channel string, feedback CreateEnvironmentOptions) (*Environment, error)

func (*Environment) BoundRunPythonScriptFromFile

func (env *Environment) BoundRunPythonScriptFromFile(scriptPath string, args ...string) error

BoundRunPythonScriptFromFile runs a Python script from a file with the given arguments. It ensures that the child process is killed if the parent process is killed.

func (*Environment) MicromambaInstallPackage

func (env *Environment) MicromambaInstallPackage(packageToInstall string, channel string) error

micromamba commands need to have rc files disabled and prefix specified

func (*Environment) PipInstallPackage

func (env *Environment) PipInstallPackage(packageToInstall string, index_url string, extra_index_url string, no_cache bool, feedback CreateEnvironmentOptions) error

func (*Environment) PipInstallPackages

func (env *Environment) PipInstallPackages(packages []string, index_url string, extra_index_url string, no_cache bool, feedback CreateEnvironmentOptions) error

func (*Environment) PipInstallRequirmements

func (env *Environment) PipInstallRequirmements(requirementsPath string, feedback CreateEnvironmentOptions) error

func (*Environment) RunPythonReadCombined

func (env *Environment) RunPythonReadCombined(scriptPath string, args ...string) (string, error)

func (*Environment) RunPythonReadStdout

func (env *Environment) RunPythonReadStdout(scriptPath string, args ...string) (string, error)

func (*Environment) RunPythonScriptFromFile

func (env *Environment) RunPythonScriptFromFile(scriptPath string, args ...string) error

type Version

type Version struct {
	Major int
	Minor int // -1 if not specified
	Patch int // -1 if not specified
}

func ParsePipVersion

func ParsePipVersion(versionStr string) (Version, error)

func ParsePythonVersion

func ParsePythonVersion(versionStr string) (Version, error)

func ParseVersion

func ParseVersion(versionStr string) (Version, error)

ParseVersion parses a version string in the format "X.Y.Z" and returns a Version object.

func (*Version) Compare

func (v *Version) Compare(other Version) int

Compare compares the version with another version and returns: -1 if the version is less than the other version 0 if the version is equal to the other version 1 if the version is greater than the other version

func (*Version) MinorString

func (v *Version) MinorString() string

func (*Version) MinorStringCompact

func (v *Version) MinorStringCompact() string

func (*Version) String

func (v *Version) String() string

String returns the string representation of the version. We'll ignore -1 values.

Jump to

Keyboard shortcuts

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