pinecone-io / pinecone-python-client

The Pinecone Python client
https://www.pinecone.io/docs
Apache License 2.0
284 stars 78 forks source link

[Bug] DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. #330

Closed foobarfighter closed 4 months ago

foobarfighter commented 4 months ago

Is this a new bug in the Pinecone Python client?

Current Behavior

This warning is generated when running unit tests that include PineconeGRPC on python 3.12.

../../Library/Caches/pypoetry/virtualenvs/ragie-EJQDw0bC-py3.12/lib/python3.12/site-packages/google/protobuf/internal/well_known_types.py:91
  /Users/bob/Library/Caches/pypoetry/virtualenvs/ragie-EJQDw0bC-py3.12/lib/python3.12/site-packages/google/protobuf/internal/well_known_types.py:91: 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).
    _EPOCH_DATETIME_NAIVE = datetime.datetime.utcfromtimestamp(0)

Expected Behavior

No warning is generated.

Steps To Reproduce

Minimal test case:

from pinecone.grpc import PineconeGRPC

def test_foo():
    pass

Relevant log output

============================================================================================================= test session starts ==============================================================================================================
platform darwin -- Python 3.12.2, pytest-8.1.1, pluggy-1.4.0
rootdir: /Users/bob/workspace/ragie
configfile: pyproject.toml
plugins: anyio-4.3.0, asyncio-0.23.6
asyncio: mode=Mode.STRICT
collected 1 item

tests/test_foo.py .                                                                                                                                                                                                                      [100%]

=============================================================================================================== warnings summary ===============================================================================================================
../../Library/Caches/pypoetry/virtualenvs/ragie-EJQDw0bC-py3.12/lib/python3.12/site-packages/google/protobuf/internal/well_known_types.py:91
  /Users/bob/Library/Caches/pypoetry/virtualenvs/ragie-EJQDw0bC-py3.12/lib/python3.12/site-packages/google/protobuf/internal/well_known_types.py:91: 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).
    _EPOCH_DATETIME_NAIVE = datetime.datetime.utcfromtimestamp(0)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================================================= 1 passed, 1 warning in 0.06s =========================================================================================================

Environment

- OS: macOS 14.3 (23D56)
- Python: 3.12
- pinecone: 3.2.2

Additional Context

No response

daverigby commented 4 months ago

The warning from protobuf

google/protobuf/internal/well_known_types.py:91: 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).

Should be resolved as of pinecone-client v4.0.0 as that upgrades to a version of protobuf (v4.25) which has fixed the deprecation issue.

foobarfighter commented 4 months ago

Thank you!