-
Notifications
You must be signed in to change notification settings - Fork 13
Expose __version__ in agentunit package #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose __version__ in agentunit package #44
Conversation
Learn moreAll Green is an AI agent that automatically: ✅ Addresses code review comments ✅ Fixes failing CI checks ✅ Resolves merge conflicts |
WalkthroughAdds local CI instructions to README, extends public exports in Changes
Sequence Diagram(s)(omitted — changes are documentation, API re-exports, and a unit test; no new multi-component control flow) Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (3 warnings, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (3)
src/agentunit/__init__.py (1)
21-22: Implementation approved; version matches pyproject.toml.The
__version__attribute is correctly exposed and meets the acceptance criteria (import agentunit; print(agentunit.__version__)).Consider using importlib.metadata to access metadata of an installed Distribution Package, which would eliminate the need to manually keep this in sync with
pyproject.toml:from importlib.metadata import version __version__ = version("agentunit")tests/test_reporting.py (2)
5-6: Avoid manualsys.pathmanipulation in tests.Modifying
sys.pathis fragile and non-standard for pytest. Instead, ensure the package is installed in development mode (pip install -e .) or configure pytest'spythonpathinpyproject.toml.🔎 Suggested approach
Remove lines 5-6 and configure pytest properly:
# In pyproject.toml [tool.pytest.ini_options] pythonpath = ["src"]Or install the package in editable mode:
pip install -e .
37-38: UTF-8 encoding check should verify no exception is raised.The
encode("utf-8")call discards its result. While calling it will raise if encoding fails, the intent would be clearer with an explicit assertion or a comment explaining the check.🔎 Suggested improvement
# UTF-8 safety - markdown.encode("utf-8") + # Verify markdown can be encoded as UTF-8 (raises UnicodeEncodeError if it cannot) + _ = markdown.encode("utf-8")Or use a try/except to make the assertion explicit:
# UTF-8 safety try: markdown.encode("utf-8") except UnicodeEncodeError: pytest.fail("Markdown output is not valid UTF-8")
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
README.md(1 hunks)src/agentunit/__init__.py(1 hunks)src/agentunit/adapters/base.py(1 hunks)src/agentunit/core/__init__.py(1 hunks)src/agentunit/core/exceptions.py(1 hunks)src/agentunit/core/replay.py(2 hunks)src/agentunit/core/runner.py(1 hunks)src/agentunit/core/scenario.py(4 hunks)src/agentunit/core/trace.py(3 hunks)src/agentunit/py.typed(0 hunks)tests/test_reporting.py(1 hunks)
💤 Files with no reviewable changes (1)
- src/agentunit/py.typed
🧰 Additional context used
🧬 Code graph analysis (2)
tests/test_reporting.py (4)
src/agentunit/reporting/results.py (1)
SuiteResult(70-129)src/agentunit/comparison/comparator.py (1)
RunResult(21-43)src/agentunit/datasets/base.py (1)
name(38-39)src/agentunit/collaboration/branch.py (1)
status(173-195)
src/agentunit/adapters/base.py (3)
tests/test_runner.py (2)
execute(30-38)cleanup(40-41)src/agentunit/datasets/base.py (1)
DatasetCase(19-27)src/agentunit/core/trace.py (1)
TraceLog(26-78)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test (Python 3.10)
🔇 Additional comments (7)
src/agentunit/core/runner.py (1)
1-3: LGTM!The multi-line docstring format is consistent with Python documentation conventions.
src/agentunit/core/scenario.py (1)
1-3: LGTM!Docstring reformatting to multi-line format improves readability and follows Python documentation conventions consistently across the module.
Also applies to: 24-26, 82-84, 100-102
src/agentunit/core/exceptions.py (1)
1-23: LGTM!Docstring reformatting is consistent with the rest of the PR and follows Python documentation conventions.
src/agentunit/core/trace.py (1)
1-3: LGTM!The multi-line docstring reformatting improves readability and is consistent across the module.
Also applies to: 16-18, 27-29
src/agentunit/core/__init__.py (1)
1-3: LGTM!The multi-line docstring formatting is consistent with other modules in this PR.
src/agentunit/core/replay.py (1)
1-3: LGTM!The multi-line docstring formatting is consistent with the pattern applied across the codebase in this PR.
Also applies to: 13-15
src/agentunit/adapters/base.py (1)
35-42: LGTM!The expanded docstrings with Args and Returns sections improve API documentation for implementers of the
BaseAdapterinterface.Also applies to: 46-55, 58-66
Signed-off-by: Jagriti-student <jagriti7989@gmail.com>
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/agentunit/__init__.py (1)
21-21: Consider usingimportlib.metadatato avoid version drift.The hardcoded version string requires manual updates whenever the version changes in
pyproject.toml, creating a maintenance burden and risk of version drift. Issue #11 mentionedimportlib.metadataas an alternative that automatically reads from package metadata.🔎 Proposed refactor using importlib.metadata
+from importlib.metadata import version, PackageNotFoundError + +try: + __version__ = version("agentunit") +except PackageNotFoundError: + # Fallback for development installs + __version__ = "0.0.0+dev" -__version__ = "0.7.0"This approach eliminates the need to manually sync versions between
pyproject.tomland the source code.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
report.mdsrc/agentunit/__init__.pytests/test_reporting.py
✅ Files skipped from review due to trivial changes (1)
- report.md
🚧 Files skipped from review as they are similar to previous changes (1)
- tests/test_reporting.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test (Python 3.10)
| """AgentUnit - pytest-style evaluation harness for agentic AI and RAG workflows.""" | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the module docstring to the correct position.
Module docstrings must be the first statement in a file (immediately after from __future__ imports). When placed after regular imports, the string becomes a discarded literal and won't be accessible via help(agentunit) or agentunit.__doc__.
🔎 Proposed fix
from __future__ import annotations
+"""AgentUnit - pytest-style evaluation harness for agentic AI and RAG workflows."""
+
from .core.runner import Runner, run_suite
from .core.scenario import Scenario
from .datasets.base import DatasetCase, DatasetSource
from .reporting.results import ScenarioResult, SuiteResult
-"""AgentUnit - pytest-style evaluation harness for agentic AI and RAG workflows."""
-
__all__ = [
"DatasetCase",
"DatasetSource",🤖 Prompt for AI Agents
In src/agentunit/__init__.py around lines 9-10, the module docstring is placed
after regular imports so it becomes a discarded literal; move the triple-quoted
docstring to be the very first statement in the file (immediately after any from
__future__ imports if present) so it becomes the module-level docstring
accessible via help() and __doc__.
|
I have solve the issue. |
aviralgarg05
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!

Added version attribute to agentunit package.
Version matches pyproject.toml.
closes #11
Summary by CodeRabbit
Documentation
New Features
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.