Skip to main content

Protocol Pact: Universal Markdown for Shell/MCP/REST/WS

Project description

Propact 🚀 Protocol Pact via Markdown

PyPI Python License Code Style Type Checking Tests Coverage Documentation Poetry Pydantic Async

Markdown speaks all protocols! Shell → MCP → REST/WS without conversion.

propact pozwala na wymiane danych markdown z roznymi rpotokołami pozwalającymi na przesyłanie całych markdown z zwartoscia z roznymi plikami audio video embedded oraz danymi w codeblock w prosty sposob, aby od strony cli to było proste a zeby mozna bylo dowolnie zmieniac endpointy. Chodzi o to, że mam plik markdown np z plikiem img wewnatrz w base64 i chce to wysłać na jakiś endpoint, np upload, ale musze oddzielnie wysłać obraz a oddzielnie tekst, czyli musze to podzielić, wedle tego co pozwlaa api na endpoint i trzeba to algorytmicznie, inteligentnie rozdzielić i dlatego jest potrzebny propact

np przy załozeniu że musimy wysłac dane do openapi, mamy do dyspozycji dokuemntacji API i propact musi zrozumieć jak działa endpoint i dopasowac do niego treści, kt©óe zostamą do niego wysłane i tak samo, gdy otrrzymujemy jakies tresci z endpointu to musimy je zmianieć na markdown, nie sototne jaki był format źródłowy

chodzi o to, ze markdown jest podstaowywm formatem z metadanymi, a codeblock służy do trzyemania tych danych lub specjalne tagi dla mediów, więce finalnie trzymamy jeden format danych markdown, ale z odpowiednim przygotowaniem przed wysłaniem i po otrzymaniu na dysku, aby dla każdego oendpointu w zalęznosci od SCHEMA, cyzli np oopenapi lub cli shell lub innego API strony www, czy email, itd w zlaęznosci od rpototkołu, któryr też ma specyficzne schema przygotować markdown do trasnportu i z transportu do markdown, w zasadzie każdy plik markdown moze być też serverem danych i każdy mardkown moze być do niego wysłany w celu nadpisania, stwórz takie przykłady

pip install propact
propact README.md  # Run this file!

🚀 Quick Start

echo "Shell → MCP → REST pipeline works!"

Features

  • Universal Protocol Support: Execute Shell, MCP, REST, and WebSocket protocols directly from Markdown
  • Schema-Aware Processing: Intelligently parse OpenAPI, CLI, and MCP schemas to adapt content
  • Smart Content Splitting: Automatically separate attachments, code blocks, and text based on endpoint requirements
  • Attachment Handling: Manage binary files, images, audio, and video within your protocol documents
  • Async Execution: Full async/await support for concurrent protocol execution
  • Type Safety: Full type annotations with Pydantic integration
  • Modern Python: Built with Python 3.10+ and the latest best practices
  • MD-as-Server: Markdown files can act as servers that update themselves

Example Usage

import asyncio
from propact import ToonPact

async def main():
    # Load a Protocol Pact document
    pact = ToonPact("README.md")
    
    # Execute all protocols
    results = await pact.execute()
    print(results)
    
    # Execute only shell protocols
    shell_results = await pact.execute(protocol=ProtocolType.SHELL)
    print(shell_results)

asyncio.run(main())

Protocol Blocks

Shell Protocol

echo "Hello from shell!"
ls -la

MCP Protocol

{
  "method": "tools/call",
  "params": {
    "name": "example_tool",
    "arguments": {"input": "test"}
  }
}

REST Protocol

GET https://api.example.com/data
Content-Type: application/json

WebSocket Protocol

{
  "type": "subscribe",
  "channel": "updates"
}

Installation

pip install propact

Or with Poetry:

poetry add propact

Development

# Clone the repository
git clone https://github.com/wronai/propact.git
cd propact

# Install development dependencies
poetry install --with dev

# Run tests
make test

# Run linting
make lint

License

Licensed under Apache-2.0.

Licensed under Apache-2.0.

Licensed under Apache-2.0.

Licensed under Apache-2.0.

Licensed under Apache-2.0.

Apache-2.0 © Tom Sapletta

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

propact-0.0.6.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

propact-0.0.6-py3-none-any.whl (34.0 kB view details)

Uploaded Python 3

File details

Details for the file propact-0.0.6.tar.gz.

File metadata

  • Download URL: propact-0.0.6.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for propact-0.0.6.tar.gz
Algorithm Hash digest
SHA256 bf55fdf2de59678ea6cb53eb7d442d9bbbc837b8ab8a26dcfa49d90b62b2914d
MD5 f67ffe13f2b12faa5219acb21bc3659f
BLAKE2b-256 7094127d976d8406a27037bc83887b9ab32d9f963cf33ea81af02f0a3dbc7cfd

See more details on using hashes here.

File details

Details for the file propact-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: propact-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 34.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for propact-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a1bfdb7bcda12bb05b19ffa8dbd1baa27c89d4ca166c944c9d92236c075ab080
MD5 108c2fe164c5d5075de9b893ad24b69b
BLAKE2b-256 367d7e6936f7d0327728dcb28baba39a16515d1ae64652ccfdab719f836bec66

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page