Documentation ¶
Index ¶
- Variables
- func AddRequirements(unit *core.ExecutionUnit, requirements string)
- func AddRuntimeFile(unit *core.ExecutionUnit, templateData any, path string, content []byte) error
- func AddRuntimeFiles(unit *core.ExecutionUnit, files embed.FS, templateData any) error
- func AddRuntimeImport(importString string, file *core.SourceFile) error
- func DoQuery(c *sitter.Node, q string) query.NextMatchFunc
- func NewFile(path string, content io.Reader) (f *core.SourceFile, err error)
- func ResolveFileDependencies(files map[string]core.File) (execunit.FileDependencies, error)
- func RuntimePath(sourcePath string, runtimeModule string) (string, error)
- func UnitFileDependencyResolver(unit *core.ExecutionUnit) (execunit.FileDependencies, error)
- type AddExecRuntimeFiles
- type Attribute
- type Expose
- type FunctionArg
- type FunctionCallDetails
- type Import
- type Imports
- type KVConfig
- type Persist
- type PythonExecutable
- type PythonPlugins
- type RequirementsTxt
- type Runtime
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //go:embed queries/find_qualified_attr_usage.scm FindQualifiedAttrUsage string )
View Source
var Language = core.SourceLanguage{ ID: py, Sitter: python.GetLanguage(), CapabilityFinder: lang.NewCapabilityFinder("comment", lang.RegexpRemovePreprocessor(`^#\s*`)), TurnIntoComment: lang.MakeLineCommenter("# "), }
Functions ¶
func AddRequirements ¶
func AddRequirements(unit *core.ExecutionUnit, requirements string)
func AddRuntimeFile ¶
func AddRuntimeFiles ¶
func AddRuntimeImport ¶
func AddRuntimeImport(importString string, file *core.SourceFile) error
AddRuntimeImport injects the supplied import string above the first non-comment statement in the supplied file.
func DoQuery ¶
func DoQuery(c *sitter.Node, q string) query.NextMatchFunc
DoQuery is a thin wrapper around `query.Exec` to use python as the Language.
func ResolveFileDependencies ¶
func UnitFileDependencyResolver ¶
func UnitFileDependencyResolver(unit *core.ExecutionUnit) (execunit.FileDependencies, error)
Types ¶
type AddExecRuntimeFiles ¶
type AddExecRuntimeFiles struct {
// contains filtered or unexported fields
}
func (*AddExecRuntimeFiles) Name ¶
func (p *AddExecRuntimeFiles) Name() string
func (*AddExecRuntimeFiles) Transform ¶
func (p *AddExecRuntimeFiles) Transform(result *core.CompilationResult, deps *core.Dependencies) error
type Expose ¶
type Expose struct{}
func (Expose) Transform ¶
func (p Expose) Transform(result *core.CompilationResult, deps *core.Dependencies) error
type FunctionArg ¶
func AddOrReplaceArg ¶
func AddOrReplaceArg(arg FunctionArg, args []FunctionArg) []FunctionArg
func (FunctionArg) String ¶
func (a FunctionArg) String() string
type FunctionCallDetails ¶
type FunctionCallDetails struct { Name string Arguments []FunctionArg }
type Import ¶
type Import struct { ParentModule string Name string // ImportedAttributes is a map from attribute name, to information about that attribute. // Given a statement `from foo import bar as the_bar` the attribute name is `bar`. ImportedAttributes map[string]Attribute Node *sitter.Node ImportedSelf bool Alias string }
TODO: capture import scope (e.g. IsGlobal/IsLocal)
func (Import) ImportedAs ¶
ImportedAs returns the name of the module as it will be used in the (python) code. This is either the (possibly qualified) module name, or the alias.
type Imports ¶
func FindImports ¶
func FindImports(file *core.SourceFile) Imports
FindImports returns a map containing each import statement within the file, as a map keyed by the import's qualified name.
For example:
import module_a # key is "module_a" import module_b as the_b # key is "module_b" import module_c.module_cc as the_c # key is "module_c.module_cc"
type KVConfig ¶
type KVConfig struct { Imports string CacheClassArg FunctionArg AdditionalCacheConstructorArgs []FunctionArg }
type Persist ¶
type Persist struct {
// contains filtered or unexported fields
}
func (Persist) Transform ¶
func (p Persist) Transform(result *core.CompilationResult, deps *core.Dependencies) error
type PythonExecutable ¶
type PythonExecutable struct { }
func (PythonExecutable) Name ¶
func (l PythonExecutable) Name() string
func (PythonExecutable) Transform ¶
func (l PythonExecutable) Transform(result *core.CompilationResult, dependencies *core.Dependencies) error
type PythonPlugins ¶
func NewPythonPlugins ¶
func NewPythonPlugins(cfg *config.Application, runtime Runtime) *PythonPlugins
func (PythonPlugins) Name ¶
func (c PythonPlugins) Name() string
func (PythonPlugins) Transform ¶
func (c PythonPlugins) Transform(result *core.CompilationResult, deps *core.Dependencies) error
type RequirementsTxt ¶
type RequirementsTxt struct {
// contains filtered or unexported fields
}
func NewRequirementsTxt ¶
func NewRequirementsTxt(path string, content io.Reader) (*RequirementsTxt, error)
func (*RequirementsTxt) AddLine ¶
func (pf *RequirementsTxt) AddLine(text string)
func (*RequirementsTxt) Clone ¶
func (pf *RequirementsTxt) Clone() core.File
func (*RequirementsTxt) Path ¶
func (pf *RequirementsTxt) Path() string
type Runtime ¶
type Runtime interface { AddExecRuntimeFiles(*core.ExecutionUnit, *core.CompilationResult, *core.Dependencies) error AddExposeRuntimeFiles(*core.ExecutionUnit) error AddKvRuntimeFiles(unit *core.ExecutionUnit) error AddFsRuntimeFiles(unit *core.ExecutionUnit, envVarName string, id string) error AddOrmRuntimeFiles(unit *core.ExecutionUnit) error AddProxyRuntimeFiles(unit *core.ExecutionUnit, proxyType string) error AddSecretRuntimeFiles(unit *core.ExecutionUnit) error GetKvRuntimeConfig() KVConfig GetFsRuntimeImportClass(id string, varName string) string GetSecretRuntimeImportClass(varName string) string GetAppName() string }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.