pythonstart

package module
v0.14.19 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

Python Start Cloud Native Buildpack

gcr.io/paketo-buildpacks/python

The Paketo Python Start CNB sets the start command for a given python application. It sets python as the default start command, which will start the Python REPL (read-eval-print loop) at launch.

Behavior

This buildpack participates if it identifies certain python-related files (e.g. *.py files) in the app source code directory.

The buildpack will do the following:

  • At build time:
    • Assigns launch process to python
  • At run time:
    • Does nothing

Enabling reloadable process types

You can configure this buildpack to wrap the entrypoint process of your app such that it kills and restarts the process whenever files in the app's working directory in the container change. With this feature enabled, copying new verisons of source code into the running container will trigger your app's process to restart. Set the environment variable BP_LIVE_RELOAD_ENABLED=true at build time to enable this feature.

Integration

This CNB writes a start command, so there's currently no scenario we can imagine that you would need to require it as dependency. If a user likes to include some other functionality, it can be done independent of the Python Start CNB without requiring a dependency of it.

Usage

To package this buildpack for consumption:

$ ./scripts/package.sh --version <version-number>

This will create a buildpackage.cnb file under the build directory which you can use to build your app as follows:

pack build <app-name> -p <path-to-app> -b <path/to/cpython.cnb> -b build/buildpackage.cnb

Run Tests

To run all unit tests, run:

./scripts/unit.sh

To run all integration tests, run:

/scripts/integration.sh

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(logger scribe.Emitter) packit.BuildFunc

Build will return a packit.BuildFunc that will be invoked during the build phase of the buildpack lifecycle.

Build assigns the image a launch process to run the Python REPL.

func Detect

func Detect() packit.DetectFunc

Detect will return a packit.DetectFunc that will be invoked during the detect phase of the buildpack lifecycle.

If this buildpack detects files that indicate your app is a Python project, it will pass detection. It will require "cpython" OR "cpython" and "site-packages" OR "conda-environment" as launch-time build plan requirements, depending on whether it detects files indicating the use of different package managers.

If BP_LIVE_RELOAD_ENABLED=true in the build environment, it will additionally require "watchexec" at launch-time

Types

type BuildPlanMetadata

type BuildPlanMetadata struct {

	// Launch flag requests the given requirement be made available during the
	// launch phase of the buildpack lifecycle.
	Launch bool `toml:"launch"`
}

BuildPlanMetadata is the buildpack specific data included in build plan requirements.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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