PythonAppResource
Handle
interface PythonAppResource extends IComputeResource, IContainerFilesDestinationResource, IResource, IResourceWithArgs, IResourceWithEndpoints, IResourceWithEnvironment, IResourceWithProbes, IResourceWithWaitSupport, IResourceWithServiceDiscovery { withDebugging(): PythonAppResource; withEntrypoint( entrypointType: EntrypointType, entrypoint: string): PythonAppResource; withPip( install?: boolean, installArgs?: string[]): PythonAppResource; withUv( install?: boolean, args?: string[]): PythonAppResource; withVirtualEnvironment( virtualEnvironmentPath: string, createIfNotExists?: boolean): PythonAppResource;}5 members
Methods
Enables debugging support for the Python application.
withDebugging(): PythonAppResourceReturns
PythonAppResource Configures the entrypoint for the Python application.
withEntrypoint( entrypointType: EntrypointType, entrypoint: string): PythonAppResourceParameters
entrypointType EntrypointType The type of entrypoint (Script, Module, or Executable).entrypointstringThe entrypoint value (script path, module name, or executable name).Returns
PythonAppResource Configures the Python resource to use pip as the package manager and optionally installs packages before the application starts.
withPip( install?: boolean, installArgs?: string[]): PythonAppResourceParameters
installbooleanoptional= TrueWhen true (default), automatically installs packages before the application starts. When false, only sets the package manager annotation without creating an installer resource.installArgs string[]optionalThe command-line arguments passed to pip install command.Returns
PythonAppResource Adds a UV environment setup task to ensure the virtual environment exists before running the Python application.
withUv( install?: boolean, args?: string[]): PythonAppResourceParameters
installbooleanoptional= TrueWhen true (default), automatically runs uv sync before the application starts. When false, only sets the package manager annotation without creating an installer resource.argsstring[]optionalOptional custom arguments to pass to the uv command. If not provided, defaults to ["sync"].Returns
PythonAppResource Configures a custom virtual environment path for the Python application.
withVirtualEnvironment( virtualEnvironmentPath: string, createIfNotExists?: boolean): PythonAppResourceParameters
virtualEnvironmentPath stringThe path to the virtual environment. Can be absolute or relative to the app directory. When relative, it is resolved from the working directory of the Python application. Common values include ".venv", "venv", or "myenv".createIfNotExists booleanoptional= TrueWhether to automatically create the virtual environment if it doesn't exist. Defaults to `true`. Set to `false` to disable automatic venv creation (the venv must already exist).Returns
PythonAppResource