Skip to content

Latest commit

Β 

History

History
232 lines (158 loc) Β· 4.49 KB

File metadata and controls

232 lines (158 loc) Β· 4.49 KB

Contributing

Thank you for your interest in contributing to pynumaflow! This guide will help you get started.

Development Setup

Prerequisites

  • Python 3.10 or higher
  • uv for dependency management
  • Git

Clone and Install

# Clone the repository
git clone https://github.com/numaproj/numaflow-python.git
cd numaflow-python/packages/pynumaflow

# Install dependencies
make setup

This will install all development dependencies including testing and linting tools.

Verify Installation

# Run tests
make test

# Run linting
make lint

Code Style

We use Black for code formatting and Ruff for linting.

Format Code

make format

Lint Code

make lint

Pre-commit Hooks

We recommend setting up pre-commit hooks to automatically format and lint code before commits:

pre-commit install

Testing

Run All Tests

make test

Run Specific Tests

uv run pytest tests/test_mapper.py -v

Test Coverage

uv run pytest tests/ --cov=pynumaflow --cov-report=html

Project Structure

packages/pynumaflow/
β”œβ”€β”€ pynumaflow/           # Main package
β”‚   β”œβ”€β”€ mapper/           # Map UDF implementation
β”‚   β”œβ”€β”€ reducer/          # Reduce UDF implementation
β”‚   β”œβ”€β”€ mapstreamer/      # MapStream implementation
β”‚   β”œβ”€β”€ batchmapper/      # BatchMap implementation
β”‚   β”œβ”€β”€ sourcer/          # Source implementation
β”‚   β”œβ”€β”€ sinker/           # Sink implementation
β”‚   β”œβ”€β”€ sourcetransformer/# SourceTransform implementation
β”‚   β”œβ”€β”€ sideinput/        # SideInput implementation
β”‚   β”œβ”€β”€ reducestreamer/   # ReduceStream implementation
β”‚   β”œβ”€β”€ accumulator/      # Accumulator implementation
β”‚   β”œβ”€β”€ proto/            # Protocol buffer definitions
β”‚   β”œβ”€β”€ shared/           # Shared utilities
β”‚   └── types.py          # Common type definitions
β”œβ”€β”€ tests/                # Test files
β”œβ”€β”€ examples/             # Example implementations
β”œβ”€β”€ docs/                 # Documentation source
β”œβ”€β”€ pyproject.toml        # Project configuration
└── Makefile              # Development commands

Making Changes

1. Create a Branch

git checkout -b feature/your-feature-name

2. Make Your Changes

  • Write clear, documented code
  • Follow the existing code style
  • Add tests for new functionality
  • Update documentation as needed

3. Test Your Changes

make test
make lint

4. Commit Your Changes

Write clear commit messages:

git commit -m "Add feature: description of your change"

5. Push and Create PR

git push origin feature/your-feature-name

Then create a Pull Request on GitHub.

Protocol Buffers

If you need to modify protocol buffer definitions:

  1. Edit the .proto files in pynumaflow/proto/
  2. Regenerate Python files:
make proto

Documentation

Local Preview

# Install all dependencies (including docs)
make setup

# Serve locally
make docs-serve

Visit http://localhost:8000 to preview.

Writing Documentation

  • Documentation source files are in docs/
  • Use Markdown with MkDocs extensions
  • Include code examples
  • Keep explanations clear and concise

Pull Request Guidelines

Before Submitting

  • Tests pass (make test)
  • Code is formatted (make lint)
  • Documentation is updated (if applicable)
  • Commit messages are clear

PR Description

Include:

  • What the change does
  • Why the change is needed
  • How to test the change
  • Any breaking changes

Review Process

  1. A maintainer will review your PR
  2. Address any feedback
  3. Once approved, your PR will be merged

Reporting Issues

Bug Reports

Include:

  • Python version
  • pynumaflow version
  • Steps to reproduce
  • Expected behavior
  • Actual behavior
  • Error messages (if any)

Feature Requests

Include:

  • Use case description
  • Proposed solution
  • Alternatives considered

Code of Conduct

Please be respectful and constructive in all interactions. We're all here to build great software together.

Getting Help

License

By contributing, you agree that your contributions will be licensed under the Apache 2.0 License.