build: install Black and Ruff for contributors
Signed-off-by: xkam7ar <kmoteallemi@icloud.com>
This commit is contained in:
1 parent
db2ff578ae
commit
2ad7036d1c
3 files changed
+17
No files matched your search
@@ -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.
|
||||
|
||||
@@ -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
|
||||
@@ -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]
|
||||
|
||||
Reference in new issue
Block a user