Skip to content

"Vibe-Trading: Your Personal Trading Agent"

build: install Black and Ruff for contributors

xkam7ar2ad7036d1c93
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 13ef08b4b..bbaa220c7 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -140,6 +140,14 @@ merging. Authors are strongly encouraged to self-check first.
## Code Style
- Format with `black`; lint with `ruff` (config in `pyproject.toml`).
+- Install both tools with the development extra: `pip install -e ".[dev]"`.
+- Run them on the Python files you changed, for example:
+ ```bash
+ black --check agent/src/example.py agent/tests/test_example.py
+ ruff check agent/src/example.py agent/tests/test_example.py
+ ```
+ The repository does not yet enforce a whole-tree Black or Ruff check, so
+ avoid mixing unrelated formatting cleanup into a focused pull request.
- Type-annotate all public function and method signatures.
- Google-style docstrings (`Args:` / `Returns:` / `Raises:`).
- Keep files under 400 lines where practical, 800 hard cap.
diff --git a/agent/tests/test_packaging_dependencies.py b/agent/tests/test_packaging_dependencies.py
index d1de9a6f3..f97ff39cd 100644
--- a/agent/tests/test_packaging_dependencies.py
+++ b/agent/tests/test_packaging_dependencies.py
@@ -136,3 +136,10 @@ def test_channel_optional_extras_cover_all_sdk_backed_adapters() -> None:
"wecom-aibot-sdk",
}
assert expected_packages.issubset(channel_extra)
+def test_development_extra_includes_bounded_style_tools() -> None:
+ """Contributor style commands should be installed by the dev extra."""
+ pyproject = tomllib.loads((ROOT / "pyproject.toml").read_text())
+ dev_extra = pyproject["project"]["optional-dependencies"]["dev"]
+
+ assert "black>=24.0,<27" in dev_extra
+ assert "ruff>=0.9,<1" in dev_extra
diff --git a/pyproject.toml b/pyproject.toml
index 632ff5789..0b76d3466 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -182,9 +182,11 @@ channels = [
"wecom-aibot-sdk>=1.0.0",
]
dev = [
+ "black>=24.0,<27",
"pytest>=7.0",
"pytest-cov>=4.0",
"pytest-socket>=0.7.0",
+ "ruff>=0.9,<1",
]
[tool.pytest.ini_options]