PY

python-development

A developer guide for contributing to and using the Python SDK in Apache Beam projects.

Install

mkdir -p .claude/skills/python-development-qpwo && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/9839" && unzip -o skill.zip -d .claude/skills/python-development-qpwo && rm skill.zip

Installs to .claude/skills/python-development-qpwo

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Guides Python SDK development in Apache Beam, including environment setup, testing, building, and running pipelines. Use when working with Python code in sdks/python/.
167 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Environment setup with pyenv
  • Editable SDK installation
  • Unit and integration testing
  • SDK container building
  • Code quality linting and type checking

How it works

The skill provides structured commands for managing the Apache Beam Python SDK lifecycle, including environment isolation, build automation via Gradle, and test execution using pytest.

Inputs & outputs

You give it
Python source code in sdks/python/
You get back
Built SDK distribution or container

When to use python-development

  • Setting up development environment for Beam
  • Running test suites for pipelines
  • Configuring build tools for Beam SDK

About this skill

Python Development in Apache Beam

Project Structure

Key Directories

  • sdks/python/ - Python SDK root
    • apache_beam/ - Main Beam package
      • transforms/ - Core transforms (ParDo, GroupByKey, etc.)
      • io/ - I/O connectors
      • ml/ - Beam ML code (RunInference, etc.)
      • runners/ - Runner implementations and wrappers
      • runners/worker/ - SDK worker harness
    • container/ - Docker container configuration
    • test-suites/ - Test configurations
    • scripts/ - Utility scripts

Configuration Files

  • setup.py - Package configuration
  • pyproject.toml - Build configuration
  • tox.ini - Test automation
  • pytest.ini - Pytest configuration
  • .pylintrc - Linting rules
  • .isort.cfg - Import sorting
  • mypy.ini - Type checking

Environment Setup

Using pyenv (Recommended)

# Install Python
pyenv install 3.X  # Use supported version from gradle.properties

# Create virtual environment
pyenv virtualenv 3.X beam-dev
pyenv activate beam-dev

Install in Editable Mode

cd sdks/python
pip install -e .[gcp,test]

Enable Pre-commit Hooks

pip install pre-commit
pre-commit install

# To disable
pre-commit uninstall

Running Tests

Unit Tests (filename: *_test.py)

# Run all tests in a file
pytest -v apache_beam/io/textio_test.py

# Run tests in a class
pytest -v apache_beam/io/textio_test.py::TextSourceTest

# Run a specific test
pytest -v apache_beam/io/textio_test.py::TextSourceTest::test_progress

Integration Tests (filename: *_it_test.py)

On Direct Runner

python -m pytest -o log_cli=True -o log_level=Info \
  apache_beam/ml/inference/pytorch_inference_it_test.py::PyTorchInference \
  --test-pipeline-options='--runner=TestDirectRunner'

On Dataflow Runner

# First build SDK tarball
pip install build && python -m build --sdist

# Run integration test
python -m pytest -o log_cli=True -o log_level=Info \
  apache_beam/ml/inference/pytorch_inference_it_test.py::PyTorchInference \
  --test-pipeline-options='--runner=TestDataflowRunner --project=<project>
                           --temp_location=gs://<bucket>/tmp
                           --sdk_location=dist/apache-beam-2.XX.0.dev0.tar.gz
                           --region=us-central1'

Building Python SDK

Build Source Distribution

cd sdks/python
pip install build && python -m build --sdist
# Output: sdks/python/dist/apache-beam-X.XX.0.dev0.tar.gz

Build Wheel (faster installation)

./gradlew :sdks:python:bdistPy311linux  # For Python 3.11 on Linux

Build SDK Container

./gradlew :sdks:python:container:py39:docker \
  -Pdocker-repository-root=gcr.io/your-project -Pdocker-tag=custom

Running Pipelines with Modified Code

# Install modified SDK
pip install /path/to/apache-beam.tar.gz[gcp]

# Run pipeline
python my_pipeline.py \
  --runner=DataflowRunner \
  --sdk_location=/path/to/apache-beam.tar.gz \
  --project=my_project \
  --region=us-central1 \
  --temp_location=gs://my-bucket/temp

Common Issues

NameError when running DoFn

Global imports, functions, and variables in the main pipeline module are not serialized by default. Use:

--save_main_session

Specifying Additional Dependencies

Use --requirements_file=requirements.txt or custom containers.

Test Markers

  • @pytest.mark.it_postcommit - Include in PostCommit test suite

Gradle Commands for Python

# Run WordCount
./gradlew :sdks:python:wordCount

# Check environment
./gradlew :checkSetup

Code Quality Tools

# Linting
pylint apache_beam/

# Type checking
mypy apache_beam/

# Formatting (via yapf)
yapf -i apache_beam/file.py

# Import sorting
isort apache_beam/file.py

When not to use it

  • Production pipeline execution without proper configuration
  • Running tests without environment activation

Prerequisites

pyenvgradlepip

Limitations

  • Requires specific Python versions defined in gradle.properties
  • Integration tests require external runner configuration

How it compares

Unlike manual script execution, this skill provides a standardized directory-aware workflow for Beam-specific development tasks.

Compared to similar skills

python-development side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
python-development (this skill)06moReviewIntermediate
fastapi-templates5202moNo flagsIntermediate
architecture-patterns552moNo flagsAdvanced
fastapi-pro794moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

5201,086

architecture-patterns

wshobson

Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use when architecting complex backend systems or refactoring existing applications for better maintainability.

55214

fastapi-pro

sickn33

Build high-performance async APIs with FastAPI, SQLAlchemy 2.0, and Pydantic V2. Master microservices, WebSockets, and modern Python async patterns. Use PROACTIVELY for FastAPI development, async optimization, or API architecture.

79181

telegram-bot-builder

davila7

Expert in building Telegram bots that solve real problems - from simple automation to complex AI-powered bots. Covers bot architecture, the Telegram Bot API, user experience, monetization strategies, and scaling bots to thousands of users. Use when: telegram bot, bot api, telegram automation, chat bot telegram, tg bot.

106130

stripe-integration

wshobson

Implement Stripe payment processing for robust, PCI-compliant payment flows including checkout, subscriptions, and webhooks. Use when integrating Stripe payments, building subscription systems, or implementing secure checkout flows.

48165

azure-functions

aj-geddes

Create serverless functions on Azure with triggers, bindings, authentication, and monitoring. Use for event-driven computing without managing infrastructure.

10104

Search skills

Search the agent skills registry