Dagger
Search

python

Package main provides a complete pipeline for Python projects using Poetry and PyPI.

Installation

dagger install github.com/felipepimentel/daggerverse/pipelines/python@f19fb238b88345af4483169cbd888897c8680d15

Entrypoint

Return Type
Python !
Arguments
NameTypeDefault ValueDescription
pythonVersionString "3.12-alpine"Python version to use
gitEmailString "github-actions[bot]@users.noreply.github.com"Git email for commits
gitNameString "github-actions[bot]"Git username for commits
dockerUsernameString -Docker Hub username
dockerPasswordSecret -Docker Hub password
skipTestsBoolean falseSkip running tests
skipLintBoolean falseSkip running linting checks
Example
dagger -m github.com/felipepimentel/daggerverse/pipelines/python@f19fb238b88345af4483169cbd888897c8680d15 call \
func (m *myModule) example() *Python  {
	return dag.
			Python()
}
@function
def example() -> dag.Python:
	return (
		dag.python()
	)
@func()
example(): Python {
	return dag
		.python()
}

Types

Python 🔗

Python orchestrates Python project workflows using Poetry and PyPI. It provides a complete CI/CD pipeline for Python projects, including testing, building, and publishing to PyPI.

publish() 🔗

Publish builds, tests, and publishes the Python package to PyPI. It returns the version of the published package or an error if any step fails.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-No description provided
tokenSecret !-No description provided
Example
dagger -m github.com/felipepimentel/daggerverse/pipelines/python@f19fb238b88345af4483169cbd888897c8680d15 call \
 publish --source DIR_PATH --token env:MYSECRET
func (m *myModule) example(ctx context.Context, source *Directory, token *Secret) string  {
	return dag.
			Python().
			Publish(ctx, source, token)
}
@function
async def example(source: dagger.Directory, token: dagger.Secret) -> str:
	return await (
		dag.python()
		.publish(source, token)
	)
@func()
async example(source: Directory, token: Secret): Promise<string> {
	return dag
		.python()
		.publish(source, token)
}

build() 🔗

Build creates a container with all dependencies installed and configured. It returns the configured container or nil if the build fails.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-No description provided
Example
dagger -m github.com/felipepimentel/daggerverse/pipelines/python@f19fb238b88345af4483169cbd888897c8680d15 call \
 build --source DIR_PATH
func (m *myModule) example(source *Directory) *Container  {
	return dag.
			Python().
			Build(source)
}
@function
def example(source: dagger.Directory) -> dagger.Container:
	return (
		dag.python()
		.build(source)
	)
@func()
example(source: Directory): Container {
	return dag
		.python()
		.build(source)
}

test() 🔗

Test runs all quality checks and returns the combined test output. It returns an error if any check fails.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-No description provided
Example
dagger -m github.com/felipepimentel/daggerverse/pipelines/python@f19fb238b88345af4483169cbd888897c8680d15 call \
 test --source DIR_PATH
func (m *myModule) example(ctx context.Context, source *Directory) string  {
	return dag.
			Python().
			Test(ctx, source)
}
@function
async def example(source: dagger.Directory) -> str:
	return await (
		dag.python()
		.test(source)
	)
@func()
async example(source: Directory): Promise<string> {
	return dag
		.python()
		.test(source)
}

lint() 🔗

Lint runs code quality checks using Ruff. It returns an error if any check fails.

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-No description provided
Example
dagger -m github.com/felipepimentel/daggerverse/pipelines/python@f19fb238b88345af4483169cbd888897c8680d15 call \
 lint --source DIR_PATH
func (m *myModule) example(ctx context.Context, source *Directory)   {
	return dag.
			Python().
			Lint(ctx, source)
}
@function
async def example(source: dagger.Directory) -> None:
	return await (
		dag.python()
		.lint(source)
	)
@func()
async example(source: Directory): Promise<void> {
	return dag
		.python()
		.lint(source)
}

buildEnv() 🔗

BuildEnv creates a development environment with all dependencies installed. It returns the configured container.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-No description provided
Example
dagger -m github.com/felipepimentel/daggerverse/pipelines/python@f19fb238b88345af4483169cbd888897c8680d15 call \
 build-env --source DIR_PATH
func (m *myModule) example(source *Directory) *Container  {
	return dag.
			Python().
			BuildEnv(source)
}
@function
def example(source: dagger.Directory) -> dagger.Container:
	return (
		dag.python()
		.build_env(source)
	)
@func()
example(source: Directory): Container {
	return dag
		.python()
		.buildEnv(source)
}