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.zipInstalls 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/.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
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 rootapache_beam/- Main Beam packagetransforms/- Core transforms (ParDo, GroupByKey, etc.)io/- I/O connectorsml/- Beam ML code (RunInference, etc.)runners/- Runner implementations and wrappersrunners/worker/- SDK worker harness
container/- Docker container configurationtest-suites/- Test configurationsscripts/- Utility scripts
Configuration Files
setup.py- Package configurationpyproject.toml- Build configurationtox.ini- Test automationpytest.ini- Pytest configuration.pylintrc- Linting rules.isort.cfg- Import sortingmypy.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
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.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| python-development (this skill) | 0 | 6mo | Review | Intermediate |
| fastapi-templates | 520 | 2mo | No flags | Intermediate |
| architecture-patterns | 55 | 2mo | No flags | Advanced |
| fastapi-pro | 79 | 4mo | No flags | Advanced |
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.
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.
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.
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.
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.
azure-functions
aj-geddes
Create serverless functions on Azure with triggers, bindings, authentication, and monitoring. Use for event-driven computing without managing infrastructure.