python-build
Python build, lint, test, and typecheck utilities for Dagger pipelines.
Installation
dagger install github.com/telchak/daggerverse/python-build@v0.1.0Entrypoint
Return Type
PythonBuild ! Example
dagger -m github.com/telchak/daggerverse/python-build@010621c997378db92da5969584001be575c5e5a7 call \
func (m *MyModule) Example() *dagger.PythonBuild {
return dag.
PythonBuild()
}@function
def example() -> dagger.PythonBuild:
return (
dag.python_build()
)@func()
example(): PythonBuild {
return dag
.pythonBuild()
}Types
PythonBuild 🔗
Python build, lint, test, and typecheck utilities for Dagger pipelines.
build() 🔗
Build a Python project and return the source with dist/.
Auto-detects the build system or runs a custom command.
Defaults to python -m build if no build command is specified.
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | - | Python project source directory |
| command | String ! | "" | Custom build command (auto-detects if empty) |
| pythonVersion | String ! | "3.13" | Python version |
| pipCache | CacheVolume | null | Custom pip cache volume (uses default if not provided) |
| uvCache | CacheVolume | null | Custom uv cache volume (uses default if not provided) |
Example
dagger -m github.com/telchak/daggerverse/python-build@010621c997378db92da5969584001be575c5e5a7 call \
build --command string --python-version stringfunc (m *MyModule) Example(command string, pythonVersion string) *dagger.Directory {
return dag.
PythonBuild().
Build(command, pythonVersion)
}@function
def example(command: str, python_version: str) -> dagger.Directory:
return (
dag.python_build()
.build(command, python_version)
)@func()
example(command: string, pythonVersion: string): Directory {
return dag
.pythonBuild()
.build(command, pythonVersion)
}install() 🔗
Install Python project dependencies.
Auto-detects the package manager (pyproject.toml, requirements.txt, setup.py) and installs dependencies. Returns the source directory with deps installed.
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | - | Python project source directory |
| pythonVersion | String ! | "3.13" | Python version |
| pipCache | CacheVolume | null | Custom pip cache volume (uses default if not provided) |
| uvCache | CacheVolume | null | Custom uv cache volume (uses default if not provided) |
Example
dagger -m github.com/telchak/daggerverse/python-build@010621c997378db92da5969584001be575c5e5a7 call \
install --python-version stringfunc (m *MyModule) Example(pythonVersion string) *dagger.Directory {
return dag.
PythonBuild().
Install(pythonVersion)
}@function
def example(python_version: str) -> dagger.Directory:
return (
dag.python_build()
.install(python_version)
)@func()
example(pythonVersion: string): Directory {
return dag
.pythonBuild()
.install(pythonVersion)
}lint() 🔗
Lint a Python project.
Returns the lint output.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | - | Python project source directory |
| tool | String ! | "ruff" | Lint tool to use: 'ruff', 'flake8', 'pylint' |
| fix | Boolean ! | false | Automatically fix lint errors (ruff only) |
| pythonVersion | String ! | "3.13" | Python version |
| pipCache | CacheVolume | null | Custom pip cache volume (uses default if not provided) |
| uvCache | CacheVolume | null | Custom uv cache volume (uses default if not provided) |
Example
dagger -m github.com/telchak/daggerverse/python-build@010621c997378db92da5969584001be575c5e5a7 call \
lint --tool string --fix boolean --python-version stringfunc (m *MyModule) Example(ctx context.Context, tool string, fix bool, pythonVersion string) string {
return dag.
PythonBuild().
Lint(ctxtool, fix, pythonVersion)
}@function
async def example(tool: str, fix: bool, python_version: str) -> str:
return await (
dag.python_build()
.lint(tool, fix, python_version)
)@func()
async example(tool: string, fix: boolean, pythonVersion: string): Promise<string> {
return dag
.pythonBuild()
.lint(tool, fix, pythonVersion)
}test() 🔗
Run tests for a Python project.
Auto-detects pytest or unittest, or runs a custom command. Returns the test output.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | - | Python project source directory |
| command | String ! | "" | Custom test command (auto-detects if empty) |
| pythonVersion | String ! | "3.13" | Python version |
| pipCache | CacheVolume | null | Custom pip cache volume (uses default if not provided) |
| uvCache | CacheVolume | null | Custom uv cache volume (uses default if not provided) |
Example
dagger -m github.com/telchak/daggerverse/python-build@010621c997378db92da5969584001be575c5e5a7 call \
test --command string --python-version stringfunc (m *MyModule) Example(ctx context.Context, command string, pythonVersion string) string {
return dag.
PythonBuild().
Test(ctxcommand, pythonVersion)
}@function
async def example(command: str, python_version: str) -> str:
return await (
dag.python_build()
.test(command, python_version)
)@func()
async example(command: string, pythonVersion: string): Promise<string> {
return dag
.pythonBuild()
.test(command, pythonVersion)
}typecheck() 🔗
Type-check a Python project.
Returns the type checker output.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | - | Python project source directory |
| tool | String ! | "mypy" | Type checker to use: 'mypy', 'pyright' |
| pythonVersion | String ! | "3.13" | Python version |
| pipCache | CacheVolume | null | Custom pip cache volume (uses default if not provided) |
| uvCache | CacheVolume | null | Custom uv cache volume (uses default if not provided) |
Example
dagger -m github.com/telchak/daggerverse/python-build@010621c997378db92da5969584001be575c5e5a7 call \
typecheck --tool string --python-version stringfunc (m *MyModule) Example(ctx context.Context, tool string, pythonVersion string) string {
return dag.
PythonBuild().
Typecheck(ctxtool, pythonVersion)
}@function
async def example(tool: str, python_version: str) -> str:
return await (
dag.python_build()
.typecheck(tool, python_version)
)@func()
async example(tool: string, pythonVersion: string): Promise<string> {
return dag
.pythonBuild()
.typecheck(tool, pythonVersion)
}