Skip to content

[MNT] Modernize datetime handling and standardize error logging - Closes #737#738

Open
MOHITKOURAV01 wants to merge 2 commits intoaiondemand:developfrom
MOHITKOURAV01:modernize-datetime-and-cleanup
Open

[MNT] Modernize datetime handling and standardize error logging - Closes #737#738
MOHITKOURAV01 wants to merge 2 commits intoaiondemand:developfrom
MOHITKOURAV01:modernize-datetime-and-cleanup

Conversation

@MOHITKOURAV01
Copy link

LLM generated content, by Gemini 3 Flash

Changes

This PR modernizes the timestamp handling across the codebase and improves the internal logging and synchronization logic for better reliability.

Change Type: Changed/Fixed

Change Category: Internal/Other

Changelog Entry:
Modernized datetime handling by replacing deprecated methods with timezone-aware alternatives and standardized error logging.

  • Replaced deprecated datetime.utcnow() and datetime.utcfromtimestamp() with timezone-aware datetime.now(UTC) in core models (aiod_entry.py, bookmark.py), routers, and connectors to ensure Python 3.12+ compatibility.
  • Updated error_handling.py to use logging.exception() instead of traceback.print_exc(), providing better traceability in production logs.
  • Refactored synchronization.py to utilize the csv module for robust error reporting and removed redundant logic.
  • Updated test_bookmark_endpoints.py to support timezone-aware timestamp comparisons.

How to Test

The changes can be verified by running the existing test suite. No special environment setup is required beyond the standard development installation.

  1. Install the package in editable mode: pip install -e .
  2. Run the tests: python -m pytest src/tests/
  3. Result: Verified that all 30 relevant tests in the src/tests/ directory pass successfully without timezone mismatch errors.

Checklist

  • Tests have been added or updated to reflect the changes, or their absence is explicitly explained.
  • Documentation has been added or updated to reflect the changes, or their absence is explicitly explained.
  • A self-review has been conducted checking:
    • No unintended changes have been committed.
    • The changes in isolation seem reasonable.
  • All CI checks pass before pinging a reviewer, or provide an explanation if they do not.
  • The PR title matches the changelog entry's one-line description.

Related Issues

Closes #737

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MNT] Deprecation of datetime.utcnow() and improvement of synchronization logic

1 participant