Skip to content

Commit

Permalink
Added setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
limingxinleo committed Nov 22, 2024
1 parent 106e7ac commit 206f3b9
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.idea
__pycache__
__pycache__
dist
roc_py.egg-info
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Hyperf 多路复用 RPC 组件 Python 版本

## 如何使用

```python
import asyncio

from roc.request import Request
from roc.socket import Client


async def main():
client = Client(host="127.0.0.1", port=9502)
while True:
req = Request(path="/test/test",
params={"mobile": "123123", "data": "HelloWorld"})
res = await client.request(req)
print(res.result)
await asyncio.sleep(1)


if __name__ == '__main__':
asyncio.run(main())

```
2 changes: 2 additions & 0 deletions roc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from roc.request import Request
from roc.socket import Client
34 changes: 34 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import setuptools

with open("README.md", "r") as fh:
long_description = fh.read()

setuptools.setup(
# 包的分发名称,使用字母、数字、_、-
name="roc-py",
# 版本号, 版本号规范:https://www.python.org/dev/peps/pep-0440/
version="0.1.0",
# 作者名
author="limingxinleo",
# 作者邮箱
author_email="[email protected]",
# 包的简介描述
description="Hyperf 多路复用 RPC 组件 Python 版本",
# 包的详细介绍(一般通过加载README.md)
long_description=long_description,
# 和上条命令配合使用,声明加载的是markdown文件
long_description_content_type="text/markdown",
# 项目开源地址
url="https://github.com/hyperf/roc-py",
# 如果项目由多个文件组成,我们可以使用find_packages()自动发现所有包和子包,而不是手动列出每个包,在这种情况下,包列表将是example_pkg
packages=setuptools.find_packages(),
# 关于包的其他元数据(metadata)
classifiers=[
# 该软件包仅与Python3兼容
"Programming Language :: Python :: 3",
# 根据MIT许可证开源
"License :: OSI Approved :: MIT License",
# 与操作系统无关
"Operating System :: OS Independent",
],
)
3 changes: 2 additions & 1 deletion tests/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ async def main():
await asyncio.sleep(1)


asyncio.run(main())
if __name__ == '__main__':
asyncio.run(main())

0 comments on commit 206f3b9

Please sign in to comment.