fix(api): replace deprecated log.warn() with log.warning() - #6233
fix(api): replace deprecated log.warn() with log.warning()#6233shafeeq27edu-ai wants to merge 2 commits into
Conversation
logging.warn() is deprecated since Python 3.3. Uses ruff --select G010 to auto-fix across api/oss/src/ and api/ee/src/. No behavior change — only API deprecation compliance.
|
@shafeeq27edu-ai is attempting to deploy a commit to the agenta projects Team on Vercel. A member of the Team first needs to authorize it. |
|
✅ Thanks @shafeeq27edu-ai! This PR now meets the contribution requirements and has been reopened. A maintainer will review it soon. |
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis change replaces deprecated ChangesWarning logger migration
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: 🔵 Low · up to One authentication-path log.warn(...) call remains and may continue producing deprecation warnings or become incompatible with a future Python version. The fix is localized, so the PR is mergeable with explicit owner follow-up to replace it. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: bbfed65e-98ae-4bf9-82bc-2a20c9d3f6ec
📒 Files selected for processing (29)
api/ee/src/apis/fastapi/billing/router.pyapi/ee/src/apis/fastapi/events/router.pyapi/ee/src/apis/fastapi/sessions/records/router.pyapi/ee/src/apis/fastapi/spans/router.pyapi/ee/src/core/meters/service.pyapi/ee/src/core/subscriptions/service.pyapi/ee/src/dbs/postgres/meters/dao.pyapi/oss/src/apis/fastapi/access/router.pyapi/oss/src/apis/fastapi/applications/utils.pyapi/oss/src/apis/fastapi/environments/utils.pyapi/oss/src/apis/fastapi/evaluators/utils.pyapi/oss/src/apis/fastapi/otlp/extractors/adapters/openinference_adapter.pyapi/oss/src/apis/fastapi/otlp/extractors/adapters/openllmetry_adapter.pyapi/oss/src/apis/fastapi/otlp/extractors/span_data_builders.pyapi/oss/src/apis/fastapi/otlp/extractors/span_processor.pyapi/oss/src/apis/fastapi/otlp/opentelemetry/otlp.pyapi/oss/src/apis/fastapi/queries/utils.pyapi/oss/src/apis/fastapi/testsets/utils.pyapi/oss/src/apis/fastapi/tracing/utils.pyapi/oss/src/apis/fastapi/workflows/utils.pyapi/oss/src/core/evaluations/service.pyapi/oss/src/core/tracing/utils/trees.pyapi/oss/src/dbs/postgres/blobs/dao.pyapi/oss/src/middlewares/auth.pyapi/oss/src/services/commoners.pyapi/oss/src/utils/caching.pyapi/oss/src/utils/exceptions.pyapi/oss/src/utils/lazy.pyapi/oss/src/utils/locking.py
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.
Description
logging.warn()is deprecated since Python 3.3 and will be removed in future Python versions. This PR auto-fixes all occurrences across the API codebase usingruff --select G010.Summary
What changed? Replaced all
log.warn()calls withlog.warning()acrossapi/oss/src/andapi/ee/src/.Why was this change needed?
logging.warn()is a deprecated alias forlogging.warning(). Using it generates deprecation warnings and will break when Python removes the alias.What problem does it solve? Eliminates ~30+ uses of a deprecated API, ensuring forward compatibility with future Python versions.
How the change addresses the root cause:
ruff --select G010automatically identifies and replaces the deprecated calls with the correct method name. No logic changes — only method name updates.Testing
Verified locally
ruff check --select G010 oss/src/ ee/src/— zero errors after fixruff check oss/src/ ee/src/— no new lint errors introducedruff format --check oss/src/ ee/src/— no formatting issues introducedAdded or updated tests
N/A — This is a deprecation compliance fix with no behavior change. Existing logging tests cover the functional path.
QA follow-up
N/A — The fix is self-contained and verified by static analysis.
Demo
BEFORE FIX :
AFTER FIX :
Checklist