python
This module only supports python apps using UV for builds.Current linters supported: pylint, ruff, mypy, pytest, pyright
Installation
dagger install github.com/act3-ai/dagger/python@v0.1.5Entrypoint
Return Type
Python !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| src | Directory ! | - | top-level source code directory |
| base | Container | - | base development container |
| netrc | Secret | - | .netrc file for private modules can be passed as env var or file --netrc env:var_name, file:/filepath/.netrc |
| syncArgs | [String ! ] | - | extra arguments for uv sync command |
Example
dagger -m github.com/act3-ai/dagger/python@d7bdc90c237f40d55a647987a881129e93c46f18 call \
--src DIR_PATHfunc (m *MyModule) Example(src *dagger.Directory) *dagger.Python {
return dag.
Python(src)
}@function
def example(src: dagger.Directory, ) -> dagger.Python:
return (
dag.python(src)
)@func()
example(src: Directory, ): Python {
return dag
.python(src)
}Types
Python 🔗
unitTest() 🔗
Return the result of running unit test returns directory “results/” with xml, junit, and html reports
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| unitTestDir | String | "test" | unit test directory |
Example
dagger -m github.com/act3-ai/dagger/python@d7bdc90c237f40d55a647987a881129e93c46f18 call \
--src DIR_PATH unit-testfunc (m *MyModule) Example(src *dagger.Directory) *dagger.Directory {
return dag.
Python(src).
UnitTest()
}@function
def example(src: dagger.Directory, ) -> dagger.Directory:
return (
dag.python(src)
.unit_test()
)@func()
example(src: Directory, ): Directory {
return dag
.python(src)
.unitTest()
}pylint() 🔗
Return the result of running pylint
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| outputFormat | String | "text" | No description provided |
| ignoreError | Boolean | - | ignore errors and return result |
Example
dagger -m github.com/act3-ai/dagger/python@d7bdc90c237f40d55a647987a881129e93c46f18 call \
--src DIR_PATH pylintfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string {
return dag.
Python(src).
Pylint(ctx)
}@function
async def example(src: dagger.Directory, ) -> str:
return await (
dag.python(src)
.pylint()
)@func()
async example(src: Directory, ): Promise<string> {
return dag
.python(src)
.pylint()
}uv() 🔗
base UV container (with caching, source, and credentials injected)
Return Type
Container ! Example
dagger -m github.com/act3-ai/dagger/python@d7bdc90c237f40d55a647987a881129e93c46f18 call \
--src DIR_PATH uvfunc (m *MyModule) Example(src *dagger.Directory) *dagger.Container {
return dag.
Python(src).
Uv()
}@function
def example(src: dagger.Directory, ) -> dagger.Container:
return (
dag.python(src)
.uv()
)@func()
example(src: Directory, ): Container {
return dag
.python(src)
.uv()
}container() 🔗
build dev dependencies first before running test
Return Type
Container ! Example
dagger -m github.com/act3-ai/dagger/python@d7bdc90c237f40d55a647987a881129e93c46f18 call \
--src DIR_PATH containerfunc (m *MyModule) Example(src *dagger.Directory) *dagger.Container {
return dag.
Python(src).
Container()
}@function
def example(src: dagger.Directory, ) -> dagger.Container:
return (
dag.python(src)
.container()
)@func()
example(src: Directory, ): Container {
return dag
.python(src)
.container()
}withEnvVariable() 🔗
add an environment variable to the base container
Return Type
Python !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | String ! | - | No description provided |
| value | String ! | - | No description provided |
Example
dagger -m github.com/act3-ai/dagger/python@d7bdc90c237f40d55a647987a881129e93c46f18 call \
--src DIR_PATH with-env-variable --name string --value stringfunc (m *MyModule) Example(src *dagger.Directory, name string, value string) *dagger.Python {
return dag.
Python(src).
WithEnvVariable(name, value)
}@function
def example(src: dagger.Directory, name: str, value: str) -> dagger.Python:
return (
dag.python(src)
.with_env_variable(name, value)
)@func()
example(src: Directory, name: string, value: string): Python {
return dag
.python(src)
.withEnvVariable(name, value)
}checkLock() 🔗
check that the lockfile is in sync with pyproject.toml
Return Type
String ! Example
dagger -m github.com/act3-ai/dagger/python@d7bdc90c237f40d55a647987a881129e93c46f18 call \
--src DIR_PATH check-lockfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string {
return dag.
Python(src).
CheckLock(ctx)
}@function
async def example(src: dagger.Directory, ) -> str:
return await (
dag.python(src)
.check_lock()
)@func()
async example(src: Directory, ): Promise<string> {
return dag
.python(src)
.checkLock()
}lint() 🔗
Return the result of all lint checks
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ignoreError | Boolean | - | ignore errors and return result |
| skip | [String ! ] | - | skip any provided lint tests |
Example
dagger -m github.com/act3-ai/dagger/python@d7bdc90c237f40d55a647987a881129e93c46f18 call \
--src DIR_PATH lintfunc (m *MyModule) Example(src *dagger.Directory) *dagger.Directory {
return dag.
Python(src).
Lint()
}@function
def example(src: dagger.Directory, ) -> dagger.Directory:
return (
dag.python(src)
.lint()
)@func()
example(src: Directory, ): Directory {
return dag
.python(src)
.lint()
}test() 🔗
Return the result of running all tests(lint and unit test)
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ignoreError | Boolean | - | ignore errors and return result |
| unitTestDir | String | "test" | unit test directoy |
| skip | [String ! ] | - | skip any provided lint tests |
Example
dagger -m github.com/act3-ai/dagger/python@d7bdc90c237f40d55a647987a881129e93c46f18 call \
--src DIR_PATH testfunc (m *MyModule) Example(src *dagger.Directory) *dagger.Directory {
return dag.
Python(src).
Test()
}@function
def example(src: dagger.Directory, ) -> dagger.Directory:
return (
dag.python(src)
.test()
)@func()
example(src: Directory, ): Directory {
return dag
.python(src)
.test()
}pyright() 🔗
Return the result of running Pyright
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ignoreError | Boolean | - | ignore errors and return result |
Example
dagger -m github.com/act3-ai/dagger/python@d7bdc90c237f40d55a647987a881129e93c46f18 call \
--src DIR_PATH pyrightfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string {
return dag.
Python(src).
Pyright(ctx)
}@function
async def example(src: dagger.Directory, ) -> str:
return await (
dag.python(src)
.pyright()
)@func()
async example(src: Directory, ): Promise<string> {
return dag
.python(src)
.pyright()
}mypy() 🔗
Return the result of running mypy
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| outputFormat | String | - | No description provided |
| ignoreError | Boolean | - | ignore errors and return result |
Example
dagger -m github.com/act3-ai/dagger/python@d7bdc90c237f40d55a647987a881129e93c46f18 call \
--src DIR_PATH mypyfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string {
return dag.
Python(src).
Mypy(ctx)
}@function
async def example(src: dagger.Directory, ) -> str:
return await (
dag.python(src)
.mypy()
)@func()
async example(src: Directory, ): Promise<string> {
return dag
.python(src)
.mypy()
}ruffCheck() 🔗
Return the result of running ruff check
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| outputFormat | String | "full" | No description provided |
| ignoreError | Boolean | - | No description provided |
Example
dagger -m github.com/act3-ai/dagger/python@d7bdc90c237f40d55a647987a881129e93c46f18 call \
--src DIR_PATH ruff-checkfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string {
return dag.
Python(src).
RuffCheck(ctx)
}@function
async def example(src: dagger.Directory, ) -> str:
return await (
dag.python(src)
.ruff_check()
)@func()
async example(src: Directory, ): Promise<string> {
return dag
.python(src)
.ruffCheck()
}ruffFormat() 🔗
Return the result of running ruff format
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ignoreError | Boolean | - | ignore errors and return result |
Example
dagger -m github.com/act3-ai/dagger/python@d7bdc90c237f40d55a647987a881129e93c46f18 call \
--src DIR_PATH ruff-formatfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string {
return dag.
Python(src).
RuffFormat(ctx)
}@function
async def example(src: dagger.Directory, ) -> str:
return await (
dag.python(src)
.ruff_format()
)@func()
async example(src: Directory, ): Promise<string> {
return dag
.python(src)
.ruffFormat()
}publish() 🔗
publish python package/wheel
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| buildArgs | [String ! ] | - | extra args to pass into uv build |
| publishUrl | String ! | - | No description provided |
| username | String ! | - | No description provided |
| password | Secret ! | - | No description provided |
Example
dagger -m github.com/act3-ai/dagger/python@d7bdc90c237f40d55a647987a881129e93c46f18 call \
--src DIR_PATH publish --publish-url string --username string --password env:MYSECRETfunc (m *MyModule) Example(src *dagger.Directory, publishUrl string, username string, password *dagger.Secret) *dagger.Container {
return dag.
Python(src).
Publish(publishUrl, username, password)
}@function
def example(src: dagger.Directory, publish_url: str, username: str, password: dagger.Secret) -> dagger.Container:
return (
dag.python(src)
.publish(publish_url, username, password)
)@func()
example(src: Directory, publishUrl: string, username: string, password: Secret): Container {
return dag
.python(src)
.publish(publishUrl, username, password)
}service() 🔗
create function test service
Return Type
Service ! Example
dagger -m github.com/act3-ai/dagger/python@d7bdc90c237f40d55a647987a881129e93c46f18 call \
--src DIR_PATH servicefunc (m *MyModule) Example(src *dagger.Directory) *dagger.Service {
return dag.
Python(src).
Service()
}@function
def example(src: dagger.Directory, ) -> dagger.Service:
return (
dag.python(src)
.service()
)@func()
example(src: Directory, ): Service {
return dag
.python(src)
.service()
}functionTest() 🔗
Return the result of running function test
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| dir | String | "ftest" | function test directory |
Example
dagger -m github.com/act3-ai/dagger/python@d7bdc90c237f40d55a647987a881129e93c46f18 call \
--src DIR_PATH function-testfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string {
return dag.
Python(src).
FunctionTest(ctx)
}@function
async def example(src: dagger.Directory, ) -> str:
return await (
dag.python(src)
.function_test()
)@func()
async example(src: Directory, ): Promise<string> {
return dag
.python(src)
.functionTest()
}