Skip to content

updating communication shared code to use the isodate instead of the … #42085

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

v-dharmarajv
Copy link
Member

…date util

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces the python-dateutil library with isodate for datetime parsing across all Azure Communication Services SDK packages. The change standardizes datetime parsing using isodate.parse_datetime() instead of dateutil.parser.parse() while removing the external dependency from development requirements.

  • Updates shared token utility modules to use isodate for parsing datetime strings
  • Removes python-dateutil dependency from dev_requirements.txt files
  • Maintains consistent datetime parsing functionality across all communication service packages

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

File Description
*/dev_requirements.txt Removes python-dateutil dependency from development requirements
*/token_utils.py Replaces dateutil.parser with isodate for datetime parsing functionality

@v-dharmarajv v-dharmarajv marked this pull request as draft July 17, 2025 23:59
@cemateia
Copy link
Member

the failures in the tests pipeline should be fixed with adding this

[tool.pytest.ini_options]
asyncio_default_fixture_loop_scope = "function"

to the pyproject.toml files

image

@cemateia
Copy link
Member

I did some manual tests with the isdate change and everything works fine

@v-dharmarajv v-dharmarajv marked this pull request as ready for review July 18, 2025 19:08
@cemateia
Copy link
Member

/check-enforcer override

@v-dharmarajv v-dharmarajv enabled auto-merge (squash) July 21, 2025 17:59
@v-dharmarajv v-dharmarajv disabled auto-merge July 21, 2025 18:19
assert utc_time_in_sec == 0
# UTC naive (without a timezone specified)
utc_naive_time_in_sec = _convert_datetime_to_utc_int(datetime(1970, 1, 1, 0, 0, 0, 0))
assert utc_naive_time_in_sec == 0
# PST is UTC-8
# PST is UTC-8 (Vancouver/Pacific Time)
pst_tz = timezone(timedelta(hours=-8)) # PST is UTC-8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit for timezone info

Suggested change
pst_tz = timezone(timedelta(hours=-8)) # PST is UTC-8
pst_tz = ZoneInfo("America/Los_Angeles")

@@ -8,7 +8,7 @@
import json
from datetime import datetime, timezone
from typing import Tuple, Any, List, Optional
from dateutil import parser as dateutil_parser # type: ignore
import isodate # type: ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know why this needs a type: ignore?

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

Successfully merging this pull request may close these issues.

6 participants