Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: pynamodb/PynamoDB
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6.0.1
Choose a base ref
...
head repository: pynamodb/PynamoDB
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 2 commits
  • 6 files changed
  • 2 contributors

Commits on Sep 5, 2024

  1. docs: fix heading level (#1254)

    Fixes the indentation in docs sidebar
    dubli91 authored Sep 5, 2024
    Copy the full SHA
    4b86304 View commit details

Commits on Jan 24, 2025

  1. Fix DeprecationWarning: datetime.datetime.utcfromtimestamp() is depre…

    …cated and scheduled for removal in a future version. (#1261)
    
    * Fix DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC)
    
    * Update release notes and bumped the version
    
    * Fix CI issue realated to actions/setup-python#962
    shcherbin authored Jan 24, 2025
    Copy the full SHA
    a5c1f4e View commit details
Showing with 15 additions and 6 deletions.
  1. +2 −2 .github/workflows/test.yaml
  2. +7 −0 docs/release_notes.rst
  3. +1 −1 docs/updates.rst
  4. +1 −1 pynamodb/__init__.py
  5. +2 −2 pynamodb/attributes.py
  6. +2 −0 setup.py
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -8,10 +8,10 @@ on:
jobs:
test:

runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', 'pypy-3.8']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11' ,'3.12', 'pypy-3.8']

steps:
- uses: actions/checkout@v2
7 changes: 7 additions & 0 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
@@ -3,6 +3,13 @@
Release Notes
=============

v6.0.2
------

Fixes:

* Fix a warning about `datetime.utcfromtimestamp` deprecation (:pr:`1261`)

v6.0.1
------

2 changes: 1 addition & 1 deletion docs/updates.rst
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ The following expressions and functions can only be used in the context of the a
"if_not_exists( `attr`, `value` )", `attr` | `value`, Any, :code:`Thread.forum_name | 'Default Forum Name'`

``set`` action
""""""""""""""
^^^^^^^^^^^^^^

The ``set`` action is the simplest action as it overwrites any previously stored value:

2 changes: 1 addition & 1 deletion pynamodb/__init__.py
Original file line number Diff line number Diff line change
@@ -7,4 +7,4 @@
"""
__author__ = 'Jharrod LaFon'
__license__ = 'MIT'
__version__ = '6.0.1'
__version__ = '6.0.2'
4 changes: 2 additions & 2 deletions pynamodb/attributes.py
Original file line number Diff line number Diff line change
@@ -825,7 +825,7 @@ def _normalize(self, value):
value = calendar.timegm(value.utctimetuple())
else:
raise ValueError("TTLAttribute value must be a timedelta or datetime")
return datetime.utcfromtimestamp(value).replace(tzinfo=timezone.utc)
return datetime.fromtimestamp(value, tz=timezone.utc)

def __set__(self, instance, value):
"""
@@ -846,7 +846,7 @@ def deserialize(self, value):
Deserializes a timestamp (Unix time) as a UTC datetime.
"""
timestamp = json.loads(value)
return datetime.utcfromtimestamp(timestamp).replace(tzinfo=timezone.utc)
return datetime.fromtimestamp(timestamp, tz=timezone.utc)


class UTCDateTimeAttribute(Attribute[datetime]):
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -33,6 +33,8 @@
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'License :: OSI Approved :: MIT License',
],
extras_require={