# 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/4b/5f/1182e42d647faa7178233158f0e1b61339b1f75584fb76e5b82cce4418aa/imesh-0.0.45.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.45",
"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": "67173e80a3add9a714c8e379db34798f45727316ea850b3be7afd2e82ec5d24d",
"md5": "91371d390e91c8cbb992f66cada8ced1",
"sha256": "0298598f0db8ef8cb1b0f5e4f27ed1a5be87592127f784ced39bfc0d6611acab"
},
"downloads": -1,
"filename": "imesh-0.0.45-py3-none-any.whl",
"has_sig": false,
"md5_digest": "91371d390e91c8cbb992f66cada8ced1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.7",
"size": 41149362,
"upload_time": "2024-10-10T04:27:36",
"upload_time_iso_8601": "2024-10-10T04:27:36.464280Z",
"url": "https://files.pythonhosted.org/packages/67/17/3e80a3add9a714c8e379db34798f45727316ea850b3be7afd2e82ec5d24d/imesh-0.0.45-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4b5f1182e42d647faa7178233158f0e1b61339b1f75584fb76e5b82cce4418aa",
"md5": "edd53d98024b8043c0069237bd8faac6",
"sha256": "f9bb26d66b4b72ba357504cac4f60c45a63ff86450c74705ec1ce33b4b007aef"
},
"downloads": -1,
"filename": "imesh-0.0.45.tar.gz",
"has_sig": false,
"md5_digest": "edd53d98024b8043c0069237bd8faac6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.7",
"size": 40940366,
"upload_time": "2024-10-10T04:27:46",
"upload_time_iso_8601": "2024-10-10T04:27:46.743957Z",
"url": "https://files.pythonhosted.org/packages/4b/5f/1182e42d647faa7178233158f0e1b61339b1f75584fb76e5b82cce4418aa/imesh-0.0.45.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-10 04:27:46",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "imesh"
}