معرفی شرکت ها


fastmicro-0.3.2


Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر

توضیحات

Fast, simple microservice framework
ویژگی مقدار
سیستم عامل -
نام فایل fastmicro-0.3.2
نام fastmicro
نسخه کتابخانه 0.3.2
نگهدارنده []
ایمیل نگهدارنده []
نویسنده larmoreg
ایمیل نویسنده larmoreg@gmail.com
آدرس صفحه اصلی https://github.com/larmoreg/fastmicro
آدرس اینترنتی https://pypi.org/project/fastmicro/
مجوز MIT
# FastMicro <p align="center"> <em>Fast, simple microservice framework</em> </p> <p align="center"> <a href="https://github.com/larmoreg/fastmicro/actions/workflows/main.yml" target="_blank"> <img src="https://github.com/larmoreg/fastmicro/actions/workflows/main.yml/badge.svg" alt="Test"> </a> <a href="https://codecov.io/gh/larmoreg/fastmicro" target="_blank"> <img src="https://codecov.io/gh/larmoreg/fastmicro/branch/master/graph/badge.svg?token=YRMGejrLMC" alt="Coverage"> </a> <a href="https://pypi.org/project/fastmicro" target="_blank"> <img src="https://img.shields.io/pypi/v/fastmicro?color=%2334D058&label=pypi%20package" alt="Package version"> </a> </p> --- FastMicro is a modern, fast (high-performance) framework for building microservices with Python 3.7+ based on asyncio. ## Install To install FastMicro run the following: <div class="termy"> ```console $ pip install fastmicro[redis] ``` </div> ## Example This example shows how to use the default in-memory backend for evaluation and testing. **Note**: The in-memory backend cannot be used for inter-process communication. ### Create it * Create a file `hello.py` with: ```Python #!/usr/bin/env python3 import asyncio from pydantic import BaseModel from fastmicro.messaging.memory import Messaging from fastmicro.service import Service class User(BaseModel): name: str class Greeting(BaseModel): name: str greeting: str service = Service("test") loop = asyncio.get_event_loop() messaging = Messaging(loop=loop) user_topic = messaging.topic("user", User) greeting_topic = messaging.topic("greeting", Greeting) @service.entrypoint(user_topic, greeting_topic) async def greet(user: User) -> Greeting: greeting = Greeting(name=user.name, greeting=f"Hello, {user.name}!") return greeting async def main() -> None: await service.start() async with messaging: user = User(name="Greg") print(user) greeting = await service.greet(user) print(greeting) await service.stop() if __name__ == "__main__": loop.run_until_complete(main()) ``` ### Run it ```console $ python hello.py {'name': 'Greg'} {'name': 'Greg', 'greeting': 'Hello, Greg!'} ``` ## Backends FastMicro supports the following backends: * <a href="https://pypi.org/project/aiokafka/" class="external-link" target="_blank">Kafka</a> * <a href="https://pypi.org/project/aioredis/" class="external-link" target="_blank">Redis</a> To install FastMicro with one of these backends run one of the following: <div class="termy"> ```console $ pip install fastmicro[kafka] $ pip install fastmicro[redis] ``` ## Another Example This example shows how to use the Redis backend for inter-process communication. ### Create it * Create a file `example.py` with: ```Python #!/usr/bin/env python3 import asyncio from pydantic import BaseModel from fastmicro.messaging.redis import Messaging from fastmicro.service import Service class User(BaseModel): name: str class Greeting(BaseModel): name: str greeting: str service = Service("test") loop = asyncio.get_event_loop() messaging = Messaging(loop=loop) user_topic = messaging.topic("user", User) greeting_topic = messaging.topic("greeting", Greeting) @service.entrypoint(user_topic, greeting_topic) async def greet(user: User) -> Greeting: print(user) greeting = Greeting(name=user.name, greeting=f"Hello, {user.name}!") print(greeting) return greeting if __name__ == "__main__": service.run() ``` * Create a file `test.py` with: ```python #!/usr/bin/env python3 import asyncio from pydantic import BaseModel from fastmicro.messaging.redis import Messaging from fastmicro.service import Service class User(BaseModel): name: str class Greeting(BaseModel): name: str greeting: str service = Service("test") loop = asyncio.get_event_loop() messaging = Messaging(loop=loop) user_topic = messaging.topic("user", User) greeting_topic = messaging.topic("greeting", Greeting) @service.entrypoint(user_topic, greeting_topic) async def greet(user: User) -> Greeting: ... async def main() -> None: async with messaging: user = User(name="Greg") print(user) greeting = await service.greet(user) print(greeting) if __name__ == "__main__": loop.run_until_complete(main()) ``` ### Run it * In a terminal run: <div class="termy"> ```console $ python example.py {'name': 'Greg'} {'name': 'Greg', 'greeting': 'Hello, Greg!'} ^C ``` * In another terminal run: <div class="termy"> ```console $ python test.py {'name': 'Greg'} {'name': 'Greg', 'greeting': 'Hello, Greg!'} ``` </div> ## License This project is licensed under the terms of the MIT license.


نیازمندی

مقدار نام
>=1.8.2,<2.0.0 pydantic
>=0.15.3,<0.16.0 uvloop
>=0.7.2,<0.8.0) aiokafka
>=1.0.3,<2.0.0) msgpack
>=2.0.1,<3.0.0) aioredis


زبان مورد نیاز

مقدار نام
>=3.7,<3.11 Python


نحوه نصب


نصب پکیج whl fastmicro-0.3.2:

    pip install fastmicro-0.3.2.whl


نصب پکیج tar.gz fastmicro-0.3.2:

    pip install fastmicro-0.3.2.tar.gz