Skip to content
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

DeprecationWarning for datetime methods in Python 3.12 #5953

Open
14 tasks
dsotirho-ucsc opened this issue Feb 13, 2024 · 4 comments
Open
14 tasks

DeprecationWarning for datetime methods in Python 3.12 #5953

dsotirho-ucsc opened this issue Feb 13, 2024 · 4 comments
Assignees
Labels
orange [process] Done by the Azul team

Comments

@dsotirho-ucsc
Copy link
Contributor

dsotirho-ucsc commented Feb 13, 2024

Upgrading to Python 3.12 (#5736) introduces DeprecationWarning with the datetime methods utcnow and utcfromtimestamp.

https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow

Warning Because naive datetime objects are treated by many datetime methods as local times, it is preferred to use aware datetimes to represent times in UTC. As such, the recommended way to create an object representing the current time in UTC is by calling datetime.now(timezone.utc).
Deprecated since version 3.12: Use datetime.now() with UTC instead.

https://docs.python.org/3/library/datetime.html#datetime.datetime.utcfromtimestamp

Warning Because naive datetime objects are treated by many datetime methods as local times, it is preferred to use aware datetimes to represent times in UTC. As such, the recommended way to create an object representing a specific timestamp in UTC is by calling datetime.fromtimestamp(timestamp, tz=timezone.utc).
Deprecated since version 3.12: Use datetime.fromtimestamp() with UTC instead.

datetime.utcnow was found in Azul's codebase and will need to be updated.

In addition, the following imported dependencies were also found to make use of the deprecated datetime methods:

  • .venv/lib/python3.12/site-packages/botocore/auth.py
  • .venv/lib/python3.12/site-packages/google/api_core/datetime_helpers.py
  • .venv/lib/python3.12/site-packages/moto/core/utils.py
  • .venv/lib/python3.12/site-packages/moto/s3/models.py
  • .venv/lib/python3.12/site-packages/moto/dynamodb/models/table.py

Blocked by:


  • Security design review completed; the Resolution of this issue does not
    • … affect authentication; for example:
      • OAuth 2.0 with the application (API or Swagger UI)
      • Authentication of developers with Google Cloud APIs
      • Authentication of developers with AWS APIs
      • Authentication with a GitLab instance in the system
      • Password and 2FA authentication with GitHub
      • API access token authentication with GitHub
      • Authentication with
    • … affect the permissions of internal users like access to
      • Cloud resources on AWS and GCP
      • GitLab repositories, projects and groups, administration
      • an EC2 instance via SSH
      • GitHub issues, pull requests, commits, commit statuses, wikis, repositories, organizations
    • … affect the permissions of external users like access to
      • TDR snapshots
    • … affect permissions of service or bot accounts
      • Cloud resources on AWS and GCP
    • … affect audit logging in the system, like
      • adding, removing or changing a log message that represents an auditable event
      • changing the routing of log messages through the system
    • … affect monitoring of the system
    • … introduce a new software dependency like
      • Python packages on PYPI
      • Command-line utilities
      • Docker images
      • Terraform providers
    • … add an interface that exposes sensitive or confidential data at the security boundary
    • … affect the encryption of data at rest
    • … require persistence of sensitive or confidential data that might require encryption at rest
    • … require unencrypted transmission of data within the security boundary
    • … affect the network security layer; for example by
      • modifying, adding or removing firewall rules
      • modifying, adding or removing security groups
      • changing or adding a port a service, proxy or load balancer listens on
  • Documentation on any unchecked boxes is provided in comments below
@dsotirho-ucsc
Copy link
Contributor Author

@hannes-ucsc: "Update moto and google-api-core as part of #5736 if that is easy to do. Link to blocking boto/botocore ticket in description. We will park this until those are resolved at which point we will also update our own code. According to the botocore team, the removal of utcnow() et al is slated for Python 3.16 so we have some time."

@achave11-ucsc
Copy link
Member

This is parked because blocker is parked.

@dsotirho-ucsc
Copy link
Contributor Author

Moving to Triage since blocker #5736 has been merged.

@dsotirho-ucsc
Copy link
Contributor Author

Wait for upstream blocker in Boto to be resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
orange [process] Done by the Azul team
Projects
None yet
Development

No branches or pull requests

2 participants