pyvider

0
0
0
Python
public
Forked

πŸπŸ—οΈ Pyvider

License
Python 3.11+
uv
Ruff
CI

Pyvider is a Python framework for building Terraform providers. Write infrastructure providers using Python’s elegance, type safety, and rich ecosystem while maintaining full compatibility with Terraform Plugin Protocol v6.

✨ Key Features

  • 🐍 Pure Python - Write providers using familiar Python patterns and libraries
  • 🎯 Type-Safe - Leverage type hints and attrs for robust code
  • πŸš€ Decorator-Based - Simple registration system handles protocol complexity
  • πŸ“¦ Protocol v6 - Full Terraform Plugin Protocol v6 implementation
  • ⚑ Async - Built on modern async/await for high performance
  • πŸ§ͺ Testable - Comprehensive testing with pytest integration

Quick Start

from pyvider.providers import register_provider, BaseProvider
from pyvider.resources import register_resource, BaseResource
from pyvider.schema import s_resource, a_str
import attrs

@register_provider("mycloud")
class MyCloudProvider(BaseProvider):
    """Your cloud provider"""
    pass

@register_resource("server")
class Server(BaseResource):
    """Manages a server"""

    @classmethod
    def get_schema(cls):
        return s_resource({
            "name": a_str(required=True),
            "id": a_str(computed=True),
        })

    async def _create_apply(self, ctx):
        # Create your resource
        return State(id="srv-123", name=ctx.config.name), None

    async def read(self, ctx):
        # Read current state
        return ctx.state

See the full example in the Quick Start Guide β†’

Documentation

πŸ“– Read the Full Documentation β†’

Development

Quick Start

# Set up environment
uv sync

# Run common tasks
we run test       # Run tests
we run lint       # Check code
we run format     # Format code
we tasks          # See all available commands

Available Commands

This project uses wrknv for task automation. Run we tasks to see all available commands.

Common tasks:

  • we run test - Run all tests
  • we run test.coverage - Run tests with coverage
  • we run test.parallel - Run tests in parallel
  • we run lint - Check code quality
  • we run lint.fix - Auto-fix linting issues
  • we run format - Format code
  • we typecheck - Run type checker

See CLAUDE.md for detailed development instructions and architecture information.

🀝 Contributing

Contributions welcome! See Contributing Guidelines and the Development section above for setup instructions.

πŸ“„ License

Apache 2.0 - See LICENSE for details.

πŸ“¦ Installation

# Using uv (recommended)
uv add pyvider

🚦 Project Status

Version: 0.0.x (Alpha)
Protocol: Terraform Plugin Protocol v6
Python: 3.11+

⚠️ Pre-release - APIs may change before 1.0 release. Best suited for internal tooling, experimentation, and learning.


Copyright Β© provide.io LLC.

v0.3.3[beta]