Documentation
¶
Overview ¶
Package python is the build planner for Python projects.
Index ¶
- Constants
- func DetermineEntry(ctx *pythonPlanContext) string
- func DetermineFramework(ctx *pythonPlanContext) types.PythonFramework
- func DeterminePackageManager(ctx *pythonPlanContext) types.PythonPackageManager
- func DetermineWsgi(ctx *pythonPlanContext) string
- func GenerateDockerfile(meta types.PlanMeta) (string, error)
- func GetMeta(opt GetMetaOptions) types.PlanMeta
- func HasDependency(ctx *pythonPlanContext, dependency string) bool
- func HasExplicitDependency(ctx *pythonPlanContext, dependency string) bool
- func NewIdentifier() plan.Identifier
- func NewPacker() packer.Packer
- type GetMetaOptions
- type StaticFlag
- type StaticInfo
Constants ¶
const ( // ConfigStreamlitEntry is the key for specifying the streamlit entry explicitly // in the project configuration. ConfigStreamlitEntry = "streamlit.entry" // ConfigPythonEntry is the key for specifying the Python entry explicitly // in the project configuration. If there is `__init__.py`, you should also // write down the `__init__.py` in the entry. For example: `app/__init__.py`. ConfigPythonEntry = "python.entry" // ConfigPythonVersion is the key for specifying the Python version explicitly // in the project configuration. ConfigPythonVersion = "python.version" // ConfigPythonPackageManager is the key for specifying the Python package manager // explicitly in the project configuration. // Note that it should be one of the values in `types.PythonPackageManager`. ConfigPythonPackageManager = "python.package_manager" )
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 ¶
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 ¶
HasDependency checks if the specified dependency is in the project.
func HasExplicitDependency ¶
HasExplicitDependency checks if the specified dependency is specified explicitly in the project.
func NewIdentifier ¶
func NewIdentifier() plan.Identifier
NewIdentifier returns a new Python identifier.
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.