Watch Aspire live streamsDocsTry Aspire

PythonAppResource

Handle
📦 Aspire.Hosting.Python v13.6.4
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;
}

Methods

methodwithDebuggingbuilder
Enables debugging support for the Python application.
withDebugging(): PythonAppResource
PythonAppResource
methodwithEntrypointbuilder
Configures the entrypoint for the Python application.
withEntrypoint(
entrypointType: EntrypointType,
entrypoint: string): PythonAppResource
entrypointTypeEntrypointTypeThe type of entrypoint (Script, Module, or Executable).
entrypointstringThe entrypoint value (script path, module name, or executable name).
PythonAppResource
methodwithPipbuilder
Configures the Python resource to use pip as the package manager and optionally installs packages before the application starts.
withPip(
install?: boolean,
installArgs?: string[]): PythonAppResource
installbooleanoptional= TrueWhen true (default), automatically installs packages before the application starts. When false, only sets the package manager annotation without creating an installer resource.
installArgsstring[]optionalThe command-line arguments passed to pip install command.
PythonAppResource
methodwithUvbuilder
Adds a UV environment setup task to ensure the virtual environment exists before running the Python application.
withUv(
install?: boolean,
args?: string[]): PythonAppResource
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"].
PythonAppResource
Configures a custom virtual environment path for the Python application.
withVirtualEnvironment(
virtualEnvironmentPath: string,
createIfNotExists?: boolean): PythonAppResource
virtualEnvironmentPathstringThe 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".
createIfNotExistsbooleanoptional= 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).
PythonAppResource