Work-around slow import issue for google-adk#1192
Work-around slow import issue for google-adk#1192rapids-bot[bot] merged 3 commits intoNVIDIA:developfrom
Conversation
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
WalkthroughAdds an autouse, session-scoped pytest fixture Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Pytest as Pytest (session start)
participant Fixture as import_adk_early fixture
participant ADK as google.adk
participant Tests as Tests (collection & run)
rect rgb(240,248,255)
Pytest->>Fixture: invoke at session start (autouse)
end
rect rgb(240,255,240)
Fixture->>ADK: try import google.adk
alt import succeeds
ADK-->>Fixture: module loaded
else ImportError
ADK-->>Fixture: raises ImportError (caught & suppressed)
end
end
Fixture-->>Pytest: fixture completes
Pytest->>Tests: continue collection & run
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)**/*⚙️ CodeRabbit configuration file
Files:
packages/**/*⚙️ CodeRabbit configuration file
Files:
🪛 Ruff (0.14.5)packages/nvidia_nat_test/src/nat/test/plugin.py833-833: Unused Remove unused (RUF100) 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.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/nvidia_nat_test/src/nat/test/plugin.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*
⚙️ CodeRabbit configuration file
**/*: # Code Review Instructions
- Ensure the code follows best practices and coding standards. - For Python code, follow
PEP 20 and
PEP 8 for style guidelines.- Check for security vulnerabilities and potential issues. - Python methods should use type hints for all parameters and return values.
Example:def my_function(param1: int, param2: str) -> bool: pass- For Python exception handling, ensure proper stack trace preservation:
- When re-raising exceptions: use bare
raisestatements to maintain the original stack trace,
and uselogger.error()(notlogger.exception()) to avoid duplicate stack trace output.- When catching and logging exceptions without re-raising: always use
logger.exception()
to capture the full stack trace information.Documentation Review Instructions - Verify that documentation and comments are clear and comprehensive. - Verify that the documentation doesn't contain any TODOs, FIXMEs or placeholder text like "lorem ipsum". - Verify that the documentation doesn't contain any offensive or outdated terms. - Verify that documentation and comments are free of spelling mistakes, ensure the documentation doesn't contain any
words listed in the
ci/vale/styles/config/vocabularies/nat/reject.txtfile, words that might appear to be
spelling mistakes but are listed in theci/vale/styles/config/vocabularies/nat/accept.txtfile are OK.Misc. - All code (except .mdc files that contain Cursor rules) should be licensed under the Apache License 2.0,
and should contain an Apache License 2.0 header comment at the top of each file.
- Confirm that copyright years are up-to date whenever a file is changed.
Referenced Documentation Contents
ci/vale/styles/config/vocabularies/nat/reject.txt:
Contains regex patterns (case-insensitive) for terms we want to reject (e.g., Agent-IQ, blacklist, TODO). Actio...
Files:
packages/nvidia_nat_test/src/nat/test/plugin.py
packages/**/*
⚙️ CodeRabbit configuration file
packages/**/*: - This directory contains optional plugin packages for the toolkit, each should contain apyproject.tomlfile. - Thepyproject.tomlfile should declare a dependency onnvidia-nator another package with a name starting
withnvidia-nat-. This dependency should be declared using~=<version>, and the version should be a two
digit version (ex:~=1.0).
- Not all packages contain Python code, if they do they should also contain their own set of tests, in a
tests/directory at the same level as thepyproject.tomlfile.
Files:
packages/nvidia_nat_test/src/nat/test/plugin.py
🧠 Learnings (2)
📚 Learning: 2025-11-14T20:33:53.944Z
Learnt from: AnuradhaKaruppiah
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 1181
File: packages/nvidia_nat_test/tests/test_test_llm.py:419-484
Timestamp: 2025-11-14T20:33:53.944Z
Learning: The NVIDIA NeMo-Agent-Toolkit project uses pytest-asyncio in strict mode (the default), which requires pytest.mark.asyncio decorator on all async test functions. All async tests in packages/nvidia_nat_test/tests/test_test_llm.py consistently follow this pattern.
Applied to files:
packages/nvidia_nat_test/src/nat/test/plugin.py
📚 Learning: 2025-10-09T22:21:15.944Z
Learnt from: onkkul
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 859
File: packages/nvidia_nat_autogen/src/nat/plugins/autogen/tool_wrapper.py:115-118
Timestamp: 2025-10-09T22:21:15.944Z
Learning: In `packages/nvidia_nat_autogen/src/nat/plugins/autogen/tool_wrapper.py`, when extracting parameters from input_schema at line 136, the code must handle both dataclasses (standard and Pydantic) and Pydantic BaseModels differently. Pydantic dataclasses have `__pydantic_fields__` (not `model_fields`), so use `dataclasses.fields()` for dataclasses and `model_fields` for BaseModels to properly extract function parameters.
Applied to files:
packages/nvidia_nat_test/src/nat/test/plugin.py
|
/merge |
* Reduce test runtime by 60s by importing google-adk early. Explanation: `google-adk` has a known slow import issue (google/adk-python#2433), where the library takes ~8 seconds to import. However since we run the tests in the `packages` dir last (after `tests` and `examples`), the ADK related tests run close to last. For some reason when ADK is imported late, it takes 60-70s. ## By Submitting this PR I confirm: - I am familiar with the [Contributing Guidelines](https://github.com/NVIDIA/NeMo-Agent-Toolkit/blob/develop/docs/source/resources/contributing.md). - We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license. - Any contribution which contains commits that are not Signed-Off will not be accepted. - When the PR is ready for review, new or existing tests cover these changes. - When the PR is ready for review, the documentation is up to date with these changes. ## Summary by CodeRabbit * **Tests** * Added a session-scoped, automatically applied test fixture that attempts an early ADK import during test collection/run and silently ignores ImportError when ADK is not present, improving test initialization stability and reliability without affecting outcomes if ADK is absent. Authors: - David Gardner (https://github.com/dagardner-nv) Approvers: - Will Killian (https://github.com/willkill07) URL: NVIDIA#1192 Signed-off-by: Sangharsh Aglave <aglave@synopsys.com>
Description
Explanation:
google-adkhas a known slow import issue (google/adk-python#2433), where the library takes ~8 seconds to import. However since we run the tests in thepackagesdir last (aftertestsandexamples), the ADK related tests run close to last. For some reason when ADK is imported late, it takes 60-70s.By Submitting this PR I confirm:
Summary by CodeRabbit