pydantic-extra-types icon indicating copy to clipboard operation
pydantic-extra-types copied to clipboard

question: plan for `pendulum_dt` given lack of `3.13` support

Open zzstoatzz opened this issue 1 year ago • 7 comments

I would have opened a discussion, but I appear unable

Is there any plan for what to do about pendulum's lack of 3.13 support? and general uncertainty around maintenance

It's unclear from their issues whether support will be added, but of course we would (at Prefect) like to support 3.13 as soon as we can.

Just opening this to start a conversation - cheers!


it appears with lack of published wheels, we'd be forced to install rust ... which doesn't seem ideal

zzstoatzz avatar Nov 15 '24 21:11 zzstoatzz

in case its helpful to anyone, this works (with aforementioned disclaimer that its not ideal to install rust for pendulum)

FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim

ENV UV_SYSTEM_PYTHON=1
ENV RUSTUP_HOME=/usr/local/rustup \
    CARGO_HOME=/usr/local/cargo \
    PATH=/usr/local/cargo/bin:$PATH

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    curl \
    build-essential && \
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* && \

CMD ["uvx", "prefect", "server", "start"]

zzstoatzz avatar Nov 15 '24 21:11 zzstoatzz

@yezz123 any thoughts?

zzstoatzz avatar Nov 30 '24 23:11 zzstoatzz

@yezz123 any thoughts?

Hello @zzstoatzz 👋🏻 , This issue isn't directly related to pydantic-extra-types, but it impacts our ecosystem. Here are some potential approaches we could consider:

Community Fork Strategy

  • A temporary community-maintained pendulum fork with Python 3.13 support could bridge the gap.

Alternative Options

  • For teams that need immediate Python 3.13 compatibility, we could document alternative datetime libraries that already support 3.13.
  • Libraries like arrow or datetime could serve as temporary replacements

Next Steps

  • We can track the upstream pendulum issue for official 3.13 support.
  • If any community members are interested in maintaining a temporary fork

Would the community be interested in collaborating on a temporary fork solution? This could help bridge the gap while we await official Python 3.13 support from Pendulum.

yezz123 avatar Dec 03 '24 21:12 yezz123

Thanks for the response @yezz123!

This issue isn't directly related to pydantic-extra-types

So, to clarify: the pendulum_dt module in pydantic-extra-types currently appears to be unusable on Python 3.13 without first installing rust (please do let me know if this is untrue and I am missing something):

» uv run --python 3.13 --with pydantic-extra-types --with pendulum python -c "from pydantic_extra_types.pendulum_dt import DateTime"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/nate/Library/Caches/uv/archive-v0/6asPR-YLBwuoyda2jagNN/lib/python3.13/site-packages/pydantic_extra_types/pendulum_dt.py", line 18, in <module>
    from pydantic import GetCoreSchemaHandler
  File "/Users/nate/Library/Caches/uv/archive-v0/6asPR-YLBwuoyda2jagNN/lib/python3.13/site-packages/pydantic/__init__.py", line 418, in __getattr__
    module = import_module(module_name, package=package)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/nate/Library/Caches/uv/archive-v0/6asPR-YLBwuoyda2jagNN/lib/python3.13/site-packages/pydantic/annotated_handlers.py", line 7, in <module>
    from pydantic_core import core_schema
  File "/Users/nate/Library/Caches/uv/archive-v0/6asPR-YLBwuoyda2jagNN/lib/python3.13/site-packages/pydantic_core/__init__.py", line 6, in <module>
    from ._pydantic_core import (
ImportError: dlopen(/Users/nate/Library/Caches/uv/archive-v0/6asPR-YLBwuoyda2jagNN/lib/python3.13/site-packages/pydantic_core/_pydantic_core.cpython-313-darwin.so, 0x0002): symbol not found in flat namespace '_PyList_GetItemRef'

We can track the upstream pendulum issue for official 3.13 support.

While tracking the upstream issue would normally make a lot of sense to me, the concern that lead me to create this issue was the uncertainty around pendulum's ongoing maintenance.

If any community members are interested in maintaining a temporary fork

I'm curious about pydantic-extra-types' plans for datetime support that would be compatible with Python 3.13 if pendulum remains unmaintained and a community fork doesn't materialize. Any thoughts?

zzstoatzz avatar Dec 03 '24 23:12 zzstoatzz

Sorry for not getting back to you sooner @zzstoatzz .

For datetime support in Python 3.13, I'm exploring these options:

  1. Create a pure Python implementation that doesn't rely on pendulum, using stdlib's datetime (https://docs.pydantic.dev/latest/api/standard_library_types/#datetimedatetime)
  2. Make pendulum an optional dependency and provide a fallback behavior ( Something like an exception for py3.13)

In the short term, I'd recommend either:

  • Stay on Python 3.12 if someone needs pendulum features.
  • Use standard datetime objects if you're moving to 3.13

Would you be interested in contributing to any of these approaches? We could especially use help with option 1 or 2.

Let me know if you'd like to explore these options more.

yezz123 avatar Dec 06 '24 14:12 yezz123

thanks for the response @yezz123 - let me discuss the options with my team and get back to you here!

EDIT: https://github.com/PrefectHQ/prefect/issues/16910

zzstoatzz avatar Dec 09 '24 17:12 zzstoatzz

just to follow up, we have decided to move off of pendulum and use whenever for nuance that is not covered by the standard library.

zzstoatzz avatar Mar 28 '25 22:03 zzstoatzz