imesh


Nameimesh JSON
Version 0.0.30 PyPI version JSON
download
home_pagehttps://mesh.github.com
SummaryA lightweight, distributed, relational network architecture for MPC.
upload_time2024-03-27 02:04:34
maintainercoyzeng
docs_urlNone
authorcoyzeng
requires_python<4.0,>=3.7
licenseLICENSE
keywords servicemesh rpc cluster registry mesh
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Mesh Python Client

[![Build Status](https://travis-ci.org/ducesoft/babel.svg?branch=master)](https://travis-ci.org/ducesoft/babel)
[![Financial Contributors on Open Collective](https://opencollective.com/babel/all/badge.svg?label=financial+contributors)](https://opencollective.com/babel) [![codecov](https://codecov.io/gh/babel/babel/branch/master/graph/badge.svg)](https://codecov.io/gh/babel/babel)
![license](https://img.shields.io/github/license/ducesoft/babel.svg)

中文版 [README](README_CN.md)

## Introduction

Mesh is a standard implementation for [Private Transmission Protocol](Specifications.md) specification.

Mesh Python develop kits base on Python3.6. Recommend use [poetry](https://github.com/python-poetry/poetry) to manage
dependencies.

## Features

As an open source Internet of Data infrastructure develop kits, Mesh has the following core functions:

* Minimal kernel with SPI plugin architecture, everything is replacement.
* Support full stack of service mesh architecture.
* Support full stack of service oriented architecture.
* Support transport with TCP, HTTP, or other RPC protocols.
* Support rich routing features.
* Support reliable upstream management and load balancing capabilities.
* Support network and protocol layer observability.
* Support mTLS and protocols on TLS.
* Support rich extension mechanism to provide highly customizable expansion capabilities.
* Support process smooth upgrade.

## Get Started

```bash
poetry add imesh
```

or

```bash
pip install imesh
```

### RPC

Declared rpc interface Facade.

```python

from abc import ABC, abstractmethod

from mesh import spi, mpi


@spi("mesh")
class Tokenizer(ABC):

    @abstractmethod
    @mpi("mesh.trust.apply")
    def apply(self, kind: str, duration: int) -> str:
        """
        Apply a node token.
        :param kind:
        :param duration:
        :return:
        """
        pass

    @abstractmethod
    @mpi("mesh.trust.verify")
    def verify(self, token: str) -> bool:
        """
        Verify some token verifiable.
        :param token:
        :return:
        """
        pass
```

Declared rpc service Implement.

```python

from mesh import mps, Tokenizer


@mps
class MeshTokenizer(Tokenizer):

    def apply(self, kind: str, duration: int) -> str:
        return "foo"

    def verify(self, token: str) -> bool:
        return True
```

Remote reference procedure call.

```python

from mesh import mpi, Tokenizer


class Component:

    @mpi
    def tokenizer(self) -> Tokenizer:
        pass

    def invoke(self) -> bool:
        token = self.tokenizer().apply('PERMIT', 1000 * 60 * 5)
        return self.tokenizer().verify(token)


```

### Transport

Transport is a full duplex communication stream implement.

```python
import mesh
from mesh import Mesh, log, ServiceLoader, Transport, Routable
from mesh.prsim import Metadata


def main():
    mesh.start()

    transport = Routable.of(ServiceLoader.load(Transport).get("mesh"))
    session = transport.with_address("10.99.1.33:570").local().open('session_id_008', {
        Metadata.MESH_VERSION.key(): '',
        Metadata.MESH_TECH_PROVIDER_CODE.key(): 'LX',
        Metadata.MESH_TRACE_ID.key(): Mesh.context().get_trace_id(),
        Metadata.MESH_TOKEN.key(): 'x',
        Metadata.MESH_SESSION_ID.key(): 'session_id_008',
        Metadata.MESH_TARGET_INST_ID.key(): 'JG0100000100000000',
    })
    for index in range(100):
        inbound = f"节点4发送给节点5报文{index}"
        log.info(f"节点4发送:{inbound}")
        session.push(inbound.encode('utf-8'), {}, "topic")
        outbound = session.pop(10000, "topic")
        if outbound:
            log.info(f"节点4接收:{outbound.decode('utf-8')}")

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://mesh.github.com",
    "name": "imesh",
    "maintainer": "coyzeng",
    "docs_url": null,
    "requires_python": "<4.0,>=3.7",
    "maintainer_email": "coyzeng@gmail.com",
    "keywords": "servicemesh, rpc, cluster, registry, mesh",
    "author": "coyzeng",
    "author_email": "coyzeng@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/cb/ab/1215dd1582929d9e7374f7d84a76c1c14756b58c3092b4c773de5301b4c8/imesh-0.0.30.tar.gz",
    "platform": null,
    "description": "# Mesh Python Client\n\n[![Build Status](https://travis-ci.org/ducesoft/babel.svg?branch=master)](https://travis-ci.org/ducesoft/babel)\n[![Financial Contributors on Open Collective](https://opencollective.com/babel/all/badge.svg?label=financial+contributors)](https://opencollective.com/babel) [![codecov](https://codecov.io/gh/babel/babel/branch/master/graph/badge.svg)](https://codecov.io/gh/babel/babel)\n![license](https://img.shields.io/github/license/ducesoft/babel.svg)\n\n\u4e2d\u6587\u7248 [README](README_CN.md)\n\n## Introduction\n\nMesh is a standard implementation for [Private Transmission Protocol](Specifications.md) specification.\n\nMesh Python develop kits base on Python3.6. Recommend use [poetry](https://github.com/python-poetry/poetry) to manage\ndependencies.\n\n## Features\n\nAs an open source Internet of Data infrastructure develop kits, Mesh has the following core functions:\n\n* Minimal kernel with SPI plugin architecture, everything is replacement.\n* Support full stack of service mesh architecture.\n* Support full stack of service oriented architecture.\n* Support transport with TCP, HTTP, or other RPC protocols.\n* Support rich routing features.\n* Support reliable upstream management and load balancing capabilities.\n* Support network and protocol layer observability.\n* Support mTLS and protocols on TLS.\n* Support rich extension mechanism to provide highly customizable expansion capabilities.\n* Support process smooth upgrade.\n\n## Get Started\n\n```bash\npoetry add imesh\n```\n\nor\n\n```bash\npip install imesh\n```\n\n### RPC\n\nDeclared rpc interface Facade.\n\n```python\n\nfrom abc import ABC, abstractmethod\n\nfrom mesh import spi, mpi\n\n\n@spi(\"mesh\")\nclass Tokenizer(ABC):\n\n    @abstractmethod\n    @mpi(\"mesh.trust.apply\")\n    def apply(self, kind: str, duration: int) -> str:\n        \"\"\"\n        Apply a node token.\n        :param kind:\n        :param duration:\n        :return:\n        \"\"\"\n        pass\n\n    @abstractmethod\n    @mpi(\"mesh.trust.verify\")\n    def verify(self, token: str) -> bool:\n        \"\"\"\n        Verify some token verifiable.\n        :param token:\n        :return:\n        \"\"\"\n        pass\n```\n\nDeclared rpc service Implement.\n\n```python\n\nfrom mesh import mps, Tokenizer\n\n\n@mps\nclass MeshTokenizer(Tokenizer):\n\n    def apply(self, kind: str, duration: int) -> str:\n        return \"foo\"\n\n    def verify(self, token: str) -> bool:\n        return True\n```\n\nRemote reference procedure call.\n\n```python\n\nfrom mesh import mpi, Tokenizer\n\n\nclass Component:\n\n    @mpi\n    def tokenizer(self) -> Tokenizer:\n        pass\n\n    def invoke(self) -> bool:\n        token = self.tokenizer().apply('PERMIT', 1000 * 60 * 5)\n        return self.tokenizer().verify(token)\n\n\n```\n\n### Transport\n\nTransport is a full duplex communication stream implement.\n\n```python\nimport mesh\nfrom mesh import Mesh, log, ServiceLoader, Transport, Routable\nfrom mesh.prsim import Metadata\n\n\ndef main():\n    mesh.start()\n\n    transport = Routable.of(ServiceLoader.load(Transport).get(\"mesh\"))\n    session = transport.with_address(\"10.99.1.33:570\").local().open('session_id_008', {\n        Metadata.MESH_VERSION.key(): '',\n        Metadata.MESH_TECH_PROVIDER_CODE.key(): 'LX',\n        Metadata.MESH_TRACE_ID.key(): Mesh.context().get_trace_id(),\n        Metadata.MESH_TOKEN.key(): 'x',\n        Metadata.MESH_SESSION_ID.key(): 'session_id_008',\n        Metadata.MESH_TARGET_INST_ID.key(): 'JG0100000100000000',\n    })\n    for index in range(100):\n        inbound = f\"\u8282\u70b94\u53d1\u9001\u7ed9\u8282\u70b95\u62a5\u6587{index}\"\n        log.info(f\"\u8282\u70b94\u53d1\u9001:{inbound}\")\n        session.push(inbound.encode('utf-8'), {}, \"topic\")\n        outbound = session.pop(10000, \"topic\")\n        if outbound:\n            log.info(f\"\u8282\u70b94\u63a5\u6536:{outbound.decode('utf-8')}\")\n\n```\n",
    "bugtrack_url": null,
    "license": "LICENSE",
    "summary": "A lightweight, distributed, relational network architecture for MPC.",
    "version": "0.0.30",
    "project_urls": {
        "Documentation": "https://mesh.github.com/docs",
        "Homepage": "https://mesh.github.com",
        "Repository": "https://mesh.github.com"
    },
    "split_keywords": [
        "servicemesh",
        " rpc",
        " cluster",
        " registry",
        " mesh"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4968f1d6cfbbf1dc195a74fd61809ffbeeb9617782b4c295b0e7a3fea7539319",
                "md5": "fa104399f83f6e676566b1988334e597",
                "sha256": "321876ab3613b391190d6ca9b5b47a02736947a92c8d7afa84a563f511b11faf"
            },
            "downloads": -1,
            "filename": "imesh-0.0.30-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fa104399f83f6e676566b1988334e597",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.7",
            "size": 193755,
            "upload_time": "2024-03-27T02:04:32",
            "upload_time_iso_8601": "2024-03-27T02:04:32.103657Z",
            "url": "https://files.pythonhosted.org/packages/49/68/f1d6cfbbf1dc195a74fd61809ffbeeb9617782b4c295b0e7a3fea7539319/imesh-0.0.30-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cbab1215dd1582929d9e7374f7d84a76c1c14756b58c3092b4c773de5301b4c8",
                "md5": "665e9a9b5d3d2de88d633719a12016ac",
                "sha256": "e4b2f0bd96fc8925bbd50dfb24afc08d02cdcaf03d9af99449f7ac11fe7d6c4b"
            },
            "downloads": -1,
            "filename": "imesh-0.0.30.tar.gz",
            "has_sig": false,
            "md5_digest": "665e9a9b5d3d2de88d633719a12016ac",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.7",
            "size": 118809,
            "upload_time": "2024-03-27T02:04:34",
            "upload_time_iso_8601": "2024-03-27T02:04:34.620741Z",
            "url": "https://files.pythonhosted.org/packages/cb/ab/1215dd1582929d9e7374f7d84a76c1c14756b58c3092b4c773de5301b4c8/imesh-0.0.30.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-27 02:04:34",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "imesh"
}
        
Elapsed time: 0.21440s