Dagger
Search

python

This module has been generated via dagger init and serves as a reference to basic module structure as you get started with Dagger.

Two functions have been pre-created. You can modify, delete, or add to them, as needed. They demonstrate usage of arguments and return types using simple echo and grep commands. The functions can be called from the dagger CLI or from one of the SDKs.

The first line in this comment block is a short description line and the rest is a long description with more detail on the module's purpose or usage, if appropriate. All modules should have a short description.

Installation

dagger install github.com/francoissharpe/daggerverse/python@a7f6d0118c410be1d14d2b41827c9779ade37cdd

Entrypoint

Return Type
Python
Example
func (m *myModule) example() *Python  {
	return dag.
			Python()
}
@function
def example() -> dag.Python:
	return (
		dag.python()
	)
@func()
example(): Python {
	return dag
		.python()
}

Types

Python 🔗

container() 🔗

Return Type
Container !
Example
func (m *myModule) example() *Container  {
	return dag.
			Python().
			Container()
}
@function
def example() -> dagger.Container:
	return (
		dag.python()
		.container()
	)
@func()
example(): Container {
	return dag
		.python()
		.container()
}

directory() 🔗

Directory Return the current working directory

Return Type
Directory !
Example
func (m *myModule) example() *Directory  {
	return dag.
			Python().
			Directory()
}
@function
def example() -> dagger.Directory:
	return (
		dag.python()
		.directory()
	)
@func()
example(): Directory {
	return dag
		.python()
		.directory()
}

withVersion() 🔗

Return Type
Python !
Arguments
NameTypeDefault ValueDescription
imageString "python"The image to use
versionString !-The version of Python to use
packages[String ! ] []Additional APT packages to install
cacheEnabledBoolean trueEnable caching for the container
commands[String ! ] []Commands to run in the container
caFileFile nullCA File to use for SSL
pipIndexUrlString "https://pypi.org/simple"Pip index URL
httpProxyString ""http_proxy environment variable
httpsProxyString ""https_proxy environment variable
noProxyString ""no_proxy environment variable
Example
func (m *myModule) example(version string) *Python  {
	return dag.
			Python().
			WithVersion(version)
}
@function
def example(version: str) -> dag.Python:
	return (
		dag.python()
		.with_version(version)
	)
@func()
example(version: string): Python {
	return dag
		.python()
		.withVersion(version)
}

withPackageManager() 🔗

Return Type
Python !
Arguments
NameTypeDefault ValueDescription
packageManagerString "pip"The package manager to use
Example
func (m *myModule) example() *Python  {
	return dag.
			Python().
			WithPackageManager()
}
@function
def example() -> dag.Python:
	return (
		dag.python()
		.with_package_manager()
	)
@func()
example(): Python {
	return dag
		.python()
		.withPackageManager()
}

withPip() 🔗

Return Type
Python !
Arguments
NameTypeDefault ValueDescription
versionString ""The version of pip to use
Example
func (m *myModule) example() *Python  {
	return dag.
			Python().
			WithPip()
}
@function
def example() -> dag.Python:
	return (
		dag.python()
		.with_pip()
	)
@func()
example(): Python {
	return dag
		.python()
		.withPip()
}

withPoetry() 🔗

Return Type
Python !
Arguments
NameTypeDefault ValueDescription
versionString "1.6.1"The version of poetry to use
plugins[String ! ] []Additional poetry plugins to install
Example
func (m *myModule) example() *Python  {
	return dag.
			Python().
			WithPoetry()
}
@function
def example() -> dag.Python:
	return (
		dag.python()
		.with_poetry()
	)
@func()
example(): Python {
	return dag
		.python()
		.withPoetry()
}

withPypaBuild() 🔗

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
buildVersionString "1.2.1"The version of the build package
srcDirectory !-Directory containing the source code
Example
func (m *myModule) example(src *Directory) *Directory  {
	return dag.
			Python().
			WithPypaBuild(src)
}
@function
def example(src: dagger.Directory) -> dagger.Directory:
	return (
		dag.python()
		.with_pypa_build(src)
	)
@func()
example(src: Directory): Directory {
	return dag
		.python()
		.withPypaBuild(src)
}

withTwineUpload() 🔗

Return Type
Python !
Arguments
NameTypeDefault ValueDescription
twineVersionString "5.0.0"The version of the build package
distDirectory !-Directory containing the distribution files to upload to the repository
repositoryUrlString "https://test.pypi.org/legacy/"The repository (package index) URL to upload the package to
usernameSecret !-The username to authenticate with the repository
passwordSecret !-The password to authenticate with the repository
bustCacheBoolean falseForce execution of the step even if the cache is present
Example
func (m *myModule) example(dist *Directory, username *Secret, password *Secret) *Python  {
	return dag.
			Python().
			WithTwineUpload(dist, username, password)
}
@function
def example(dist: dagger.Directory, username: dagger.Secret, password: dagger.Secret) -> dag.Python:
	return (
		dag.python()
		.with_twine_upload(dist, username, password)
	)
@func()
example(dist: Directory, username: Secret, password: Secret): Python {
	return dag
		.python()
		.withTwineUpload(dist, username, password)
}

do() 🔗

Return Type
String !
Example
func (m *myModule) example(ctx context.Context) string  {
	return dag.
			Python().
			Do(ctx)
}
@function
async def example() -> str:
	return await (
		dag.python()
		.do()
	)
@func()
async example(): Promise<string> {
	return dag
		.python()
		.do()
}