Skip to content

Commit 9bbc453

Browse files
committed
use poetry to manage metagpt project packaging
1 parent 36f1f12 commit 9bbc453

File tree

9 files changed

+14111
-0
lines changed

9 files changed

+14111
-0
lines changed

metagpt/core/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# MetaGPT Core
2+
3+
MetaGPT Core is the core component of the MetaGPT framework, providing basic functionality and tools. As the foundation of a multi-agent framework, this package provides the core tools and interfaces needed to build complex AI applications.
4+
5+
## Installation
6+
7+
```bash
8+
pip install metagpt-core
9+
```
10+
11+
## Features
12+
13+
- Provides the basic components and abstract interfaces of the MetaGPT framework
14+
- Lightweight core library with minimal dependencies
15+
- Can be used independently or integrated with the complete MetaGPT framework
16+
- Contains core tool classes, basic AI interfaces, and extension systems
17+
18+
## Main Components
19+
20+
- Basic Abstraction Layer: Provides unified interfaces
21+
- Tool Set: Common AI development tools
22+
- Configuration System: Simplifies complex application configuration
23+
- Memory Management: Efficiently processes data
24+
25+
## Optional Features
26+
27+
Install optional dependencies:
28+
29+
```bash
30+
# Install development tools
31+
pip install metagpt-core[dev]
32+
33+
# Install testing tools
34+
pip install metagpt-core[test]
35+
36+
# Install pyppeteer support
37+
pip install metagpt-core[pyppeteer]
38+
```
39+
40+
## Dependencies
41+
42+
This package only includes minimal core dependencies:
43+
- aiohttp: Async HTTP client/server
44+
- loguru: Logging system
45+
- pydantic: Data validation
46+
- PyYAML: YAML parsing
47+
- tenacity: Retry library
48+
- tiktoken: Tokenization tool
49+
- and other essential libraries
50+
51+
## License
52+
53+
MIT

metagpt/core/poetry.lock

Lines changed: 4952 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

metagpt/core/pyproject.toml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
[build-system]
2+
requires = ["poetry-core"]
3+
build-backend = "poetry.core.masonry.api"
4+
5+
# 包基本信息
6+
[tool.poetry]
7+
name = "metagpt-core"
8+
version = "1.0.0"
9+
description = "The core package of The Multi-Agent Framework"
10+
authors = ["Alexander Wu <alexanderwu@deepwisdom.ai>"]
11+
readme = "README.md"
12+
license = "MIT"
13+
repository = "https://github.com/geekan/MetaGPT"
14+
keywords = ["metagpt", "core", "llm", "multi-agent", "multi-role", "programming", "gpt", "metaprogramming"]
15+
classifiers = [
16+
"Development Status :: 4 - Beta",
17+
"Programming Language :: Python :: 3",
18+
"Programming Language :: Python :: 3.9",
19+
"Programming Language :: Python :: 3.10",
20+
"Programming Language :: Python :: 3.11",
21+
"License :: OSI Approved :: MIT License",
22+
]
23+
# 简化包配置,只包含当前目录下的Python文件
24+
packages = [
25+
{ include = "metagpt/core/**/*.py", from = "../.." }
26+
]
27+
28+
[tool.poetry.dependencies]
29+
python = ">=3.9,<3.12"
30+
aiohttp = "3.8.6"
31+
loguru = "0.6.0"
32+
pydantic = ">=2.5.3"
33+
PyYAML = "6.0.1"
34+
setuptools = "65.6.3"
35+
tenacity = "8.2.3"
36+
tiktoken = "0.7.0"
37+
aiofiles = "23.2.1"
38+
rank-bm25 = "0.2.2"
39+
tree_sitter = "~0.23.2"
40+
tree_sitter_python = "~0.23.2"
41+
42+
# 可选依赖
43+
[tool.poetry.group.pyppeteer.dependencies]
44+
pyppeteer = ">=1.0.2"
45+
46+
[tool.poetry.group.test.dependencies]
47+
pytest = "*"
48+
pytest-asyncio = "*"
49+
pytest-cov = "*"
50+
pytest-mock = "*"
51+
pytest-html = "*"
52+
pytest-xdist = "*"
53+
pytest-timeout = "*"
54+
connexion = {extras = ["uvicorn"], version = "^3.0.5"}
55+
azure-cognitiveservices-speech = "^1.31.0"
56+
aioboto3 = "^12.4.0"
57+
gradio = "3.0.0"
58+
google-api-core = "2.17.1"
59+
protobuf = "^4.25.5"
60+
pylint = "3.0.3"
61+
pybrowsers = "*"
62+
63+
[tool.poetry.group.dev.dependencies]
64+
pylint = "^3.0.3"
65+
black = "^23.3.0"
66+
isort = "^5.12.0"
67+
pre-commit = "^3.6.0"

poetry.lock

Lines changed: 8339 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
[build-system]
2+
requires = ["poetry-core"]
3+
build-backend = "poetry.core.masonry.api"
4+
5+
[tool.poetry]
6+
name = "metagpt"
7+
version = "1.0.0"
8+
description = "The Multi-Agent Framework"
9+
authors = ["Alexander Wu <alexanderwu@deepwisdom.ai>"]
10+
readme = "README.md"
11+
license = "MIT"
12+
repository = "https://github.com/geekan/MetaGPT"
13+
keywords = ["metagpt", "multi-agent", "multi-role", "programming", "gpt", "llm", "metaprogramming"]
14+
classifiers = [
15+
"Development Status :: 4 - Beta",
16+
"Programming Language :: Python :: 3",
17+
"Programming Language :: Python :: 3.9",
18+
"Programming Language :: Python :: 3.10",
19+
"Programming Language :: Python :: 3.11",
20+
"License :: OSI Approved :: MIT License",
21+
]
22+
exclude = ["metagpt/core/**", "examples/**", "tests/**", "scripts/**"]
23+
packages = [
24+
{ include = "metagpt" }
25+
]
26+
27+
[tool.poetry.dependencies]
28+
python = ">=3.9,<3.12"
29+
# 明确将metagpt-core作为依赖,使用path确保开发模式下也能正确工作
30+
metagpt-core = { path = "metagpt/core", develop = true }
31+
channels = "4.0.0"
32+
faiss_cpu = "1.7.4"
33+
fire = "0.4.0"
34+
typer = "0.9.0"
35+
lancedb = "0.4.0"
36+
meilisearch = "0.21.0"
37+
openai = "^1.64.0"
38+
openpyxl = "^3.1.5"
39+
beautifulsoup4 = "4.12.3"
40+
pandas = "2.1.1"
41+
python_docx = "0.8.11"
42+
tqdm = "4.66.2"
43+
anthropic = "0.47.2"
44+
numpy = "^1.26.4"
45+
typing-inspect = "0.8.0"
46+
libcst = "1.0.1"
47+
qdrant-client = "1.7.0"
48+
grpcio = "^1.67.0"
49+
grpcio-tools = "^1.62.3"
50+
grpcio-status = "^1.62.3"
51+
ta = "0.10.2"
52+
semantic-kernel = "0.4.3.dev0"
53+
wrapt = "1.15.0"
54+
redis = "^5.0.0"
55+
curl-cffi = "^0.7.0"
56+
httplib2 = "^0.22.0"
57+
websocket-client = "^1.8.0"
58+
gitpython = "3.1.40"
59+
zhipuai = "^2.1.5"
60+
rich = "13.6.0"
61+
nbclient = "0.9.0"
62+
nbformat = "5.9.2"
63+
ipython = "8.17.2"
64+
ipykernel = "6.27.1"
65+
scikit_learn = "1.3.2"
66+
typing-extensions = "4.11.0"
67+
socksio = "^1.0.0"
68+
gitignore-parser = "0.1.9"
69+
websockets = ">=10.0,<12.0"
70+
networkx = "^3.2.1"
71+
google-generativeai = "0.4.1"
72+
playwright = ">=1.26"
73+
anytree = "*"
74+
ipywidgets = "8.1.1"
75+
pillow = "*"
76+
imap_tools = "1.5.0"
77+
pylint = "^3.0.3"
78+
pygithub = "^2.3"
79+
htmlmin = "*"
80+
fsspec = "*"
81+
grep-ast = "^0.3.3"
82+
unidiff = "0.7.5"
83+
qianfan = "^0.4.4"
84+
dashscope = "^1.19.3"
85+
jieba = "0.42.1"
86+
volcengine-python-sdk = {extras = ["ark"], version = "^1.0.94"}
87+
gymnasium = "0.29.1"
88+
boto3 = "^1.34.69"
89+
spark_ai_python = "^0.3.30"
90+
httpx = "0.28.1"
91+
92+
[tool.poetry.group.selenium.dependencies]
93+
selenium = ">4"
94+
webdriver_manager = "*"
95+
beautifulsoup4 = "*"
96+
97+
[tool.poetry.group.search-google.dependencies]
98+
google-api-python-client = "2.94.0"
99+
100+
[tool.poetry.group.search-ddg.dependencies]
101+
duckduckgo-search = "^4.1.1"
102+
103+
[tool.poetry.group.test.dependencies]
104+
pytest = "*"
105+
pytest-asyncio = "*"
106+
pytest-cov = "*"
107+
pytest-mock = "*"
108+
pytest-html = "*"
109+
pytest-xdist = "*"
110+
pytest-timeout = "*"
111+
connexion = {extras = ["uvicorn"], version = "^3.0.5"}
112+
azure-cognitiveservices-speech = "^1.31.0"
113+
aioboto3 = "^12.4.0"
114+
gradio = "3.0.0"
115+
google-api-core = "2.17.1"
116+
protobuf = "^4.25.5"
117+
pylint = "3.0.3"
118+
pybrowsers = "*"
119+
120+
[tool.poetry.group.dev.dependencies]
121+
pylint = "^3.0.3"
122+
black = "^23.3.0"
123+
isort = "^5.12.0"
124+
pre-commit = "^3.6.0"
125+
126+
[tool.poetry.scripts]
127+
metagpt = "metagpt.software_company:app"
128+
install-mermaid = "scripts.install_mermaid:install_mermaid_cli"
129+
130+
[tool.poetry.group.pyppeteer.dependencies]
131+
pyppeteer = ">=1.0.2"

scripts/README.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# MetaGPT Poetry Scripts Guide
2+
3+
This directory contains scripts for building and installing MetaGPT using Poetry.
4+
5+
install poetry and loguru, before start: `pip install poetry loguru`
6+
7+
## Build Script (build.py)
8+
9+
`build.py` is used to build the MetaGPT package with Poetry, including both the core sub-package and the main package.
10+
11+
### Usage
12+
13+
```bash
14+
python scripts/build.py
15+
```
16+
17+
### Features
18+
19+
- Automatically cleans the dist directory to ensure clean build results
20+
- Automatically detects the core package (metagpt/core) and builds it first
21+
- Then builds the main package (metagpt)
22+
- Outputs all build results to the dist directory in the project root
23+
- Displays the filenames and sizes of the build results
24+
- Records detailed logs during the build process
25+
26+
## Installation Script (install.py)
27+
28+
`install.py` is used to install MetaGPT and its dependencies using Poetry.
29+
30+
### Usage
31+
32+
```bash
33+
python scripts/install.py [options]
34+
```
35+
36+
### Options
37+
38+
- `--dev`: Install development dependencies
39+
- `--groups GROUP1,GROUP2,...`: Install specified dependency groups, comma-separated, e.g., 'test,selenium'
40+
- `--editable` or `-e`: Install in editable mode (recommended for development testing)
41+
- `--core-only`: Only install the metagpt-core sub-package
42+
- `--no-core`: Do not install the metagpt-core sub-package (only the main package)
43+
- `--no-deps`: Do not install dependencies, only the project itself
44+
- `--sync`: Synchronize all dependency versions in the lock file
45+
- `--skip-env-check`: Skip virtual environment check
46+
47+
### Security Checks
48+
49+
- The script checks if it's running in a virtual environment
50+
- After installation, an import test is performed to confirm successful installation
51+
52+
### Examples
53+
54+
Install the basic package:
55+
```bash
56+
python scripts/install.py
57+
```
58+
59+
Install development dependencies:
60+
```bash
61+
python scripts/install.py --dev
62+
```
63+
64+
Install specific dependency groups:
65+
```bash
66+
python scripts/install.py --groups test,selenium
67+
```
68+
69+
Install in editable mode:
70+
```bash
71+
python scripts/install.py --editable
72+
```
73+
74+
Only install the core package:
75+
```bash
76+
python scripts/install.py --core-only
77+
```
78+
79+
Install the project while skipping dependencies:
80+
```bash
81+
python scripts/install.py --no-deps
82+
```
83+
84+
## Dependencies
85+
86+
These scripts depend on the following Python packages:
87+
88+
- loguru: For logging
89+
- poetry: For building and installation
90+
91+
If poetry is not installed, the script will automatically install it.
92+
93+
## Development Workflow Example
94+
95+
Here's a typical development workflow example:
96+
97+
1. After code changes, install in the development environment for testing:
98+
```bash
99+
python scripts/install.py --dev
100+
```
101+
102+
2. After testing is successful, build the distribution package:
103+
```bash
104+
python scripts/build.py
105+
```
106+
107+
3. View the build results:
108+
```bash
109+
ls -l dist/
110+
```

0 commit comments

Comments
 (0)