Metadata-Version: 2.4
Name: bykpy
Version: 0.2.0
Summary: Python Plugin infrastructure for byk
Author-email: fcbyk <731240932@qq.com>
License: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: click>=8.0.0
Provides-Extra: test
Requires-Dist: pytest<8.0.0,>=7.0.0; extra == "test"
Requires-Dist: pytest-cov<5.0.0,>=4.0.0; extra == "test"
Provides-Extra: build
Requires-Dist: commitizen; extra == "build"
Requires-Dist: build; extra == "build"
Requires-Dist: twine; extra == "build"

# bykpy

[![Python](https://img.shields.io/badge/python-%E2%89%A53.10-blue?logo=python&logoColor=white)](https://www.python.org/downloads/)
[![License](https://img.shields.io/github/license/fcbyk/bykcli.svg)](https://github.com/fcbyk/byk/blob/main/LICENSE)

Plugin infrastructure for [byk](https://github.com/fcbyk/byk).

## Install

```bash
pip install bykpy
```

## Usage

Implement `PluginProtocol` and register your commands:

```python
# my_plugin.py
import click
from bykpy import PluginProtocol

class MyPlugin(PluginProtocol):
    commands = {"hello": "say hello"}

    def register(self, cli: click.Group) -> None:
        @cli.command()
        @click.pass_context
        def hello(ctx):
            click.echo("Hello from my plugin!")
```

## API

- **PluginProtocol** — class-based plugin registration protocol
- **CommandContext / pass_command_context / get_app_context** — command runtime context
- **get_private_networks / ensure_port_available** — network utilities
- **StateStore** — persistent key-value storage per command

## License

MIT
