python

package
v0.0.0-...-d97b457 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package python is the build planner for Python projects.

Index

Constants

View Source
const (
	// ConfigStreamlitEntry is the key for specifying the streamlit entry explicitly
	// in the project configuration.
	ConfigStreamlitEntry = "streamlit.entry"
)

Variables

This section is empty.

Functions

func DetermineEntry

func DetermineEntry(ctx *pythonPlanContext) string

DetermineEntry determines the entry of the Python project.

func DetermineFramework

func DetermineFramework(ctx *pythonPlanContext) types.PythonFramework

DetermineFramework determines the framework of the Python project.

func DeterminePackageManager

func DeterminePackageManager(ctx *pythonPlanContext) types.PythonPackageManager

DeterminePackageManager determines the package manager of this Python project.

func DetermineWsgi

func DetermineWsgi(ctx *pythonPlanContext) string

DetermineWsgi determines the WSGI application filepath of a Python project.

func GenerateDockerfile

func GenerateDockerfile(meta types.PlanMeta) (string, error)

GenerateDockerfile generates the Dockerfile for Python projects.

func GetMeta

func GetMeta(opt GetMetaOptions) types.PlanMeta

GetMeta returns the metadata of a Python project.

func HasDependency

func HasDependency(ctx *pythonPlanContext, dependency string) bool

HasDependency checks if the specified dependency is in the project.

func HasExplicitDependency

func HasExplicitDependency(ctx *pythonPlanContext, dependency string) bool

HasExplicitDependency checks if the specified dependency is specified explicitly in the project.

func NewIdentifier

func NewIdentifier() plan.Identifier

NewIdentifier returns a new Python identifier.

func NewPacker

func NewPacker() packer.Packer

NewPacker returns a new Python packer.

Types

type GetMetaOptions

type GetMetaOptions struct {
	Src    afero.Fs
	Config plan.ImmutableProjectConfiguration
}

GetMetaOptions is the options for GetMeta.

type StaticFlag

type StaticFlag uint64

StaticFlag is the static flag of a Python project.

const (
	// StaticModeDisabled indicates that no static files should be
	// generated or hosted.
	StaticModeDisabled StaticFlag = 0

	// StaticModeDjango indicates that we need to prepare the
	// static assets for a Django project.
	StaticModeDjango StaticFlag = 1 << (iota - 1)

	// StaticModeNginx indicates that we need to host the static
	// files with Nginx. The Python or WSGI server must be listened
	// on 8000 for reverse proxying by Nginx. The "8000" is
	// configured by our nginx.conf in `python.go`.
	StaticModeNginx StaticFlag = 1 << (iota - 1)
)

type StaticInfo

type StaticInfo struct {
	// Flag indicates the static flag of a Python project.
	Flag StaticFlag

	// StaticURLPath indicates where the static files can be
	// accessed from the web. For example, `/static` means that
	// the static files can be accessed from `http://example.com/static`.
	StaticURLPath string

	// StaticHostDir indicates where the static files are located
	// in the host. For example, `/app/static` means that the static
	// files are located at `/app/static` in the container.
	StaticHostDir string
}

StaticInfo is the static info of a Python project.

func DetermineStaticInfo

func DetermineStaticInfo(ctx *pythonPlanContext) StaticInfo

DetermineStaticInfo determines the static path for Nginx to host. If this returns "", it means that we don't need to host static files with Nginx; otherwise, it returns the path to the static files.

func (StaticInfo) DjangoEnabled

func (i StaticInfo) DjangoEnabled() bool

DjangoEnabled returns true if the static files should be prepared for a Django project.

func (StaticInfo) Enabled

func (i StaticInfo) Enabled() bool

Enabled returns true if the static files should be hosted with Nginx.

func (StaticInfo) Meta

func (i StaticInfo) Meta() types.PlanMeta

Meta turns this structure into a partial PlanMeta.

func (StaticInfo) NginxEnabled

func (i StaticInfo) NginxEnabled() bool

NginxEnabled returns true if the static files should be hosted with Nginx.

Jump to

Keyboard shortcuts

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