ArchiveBox/archivebox/uuid_compat.py
Claude ae2ab5b273
Add Python 3.13 support with uuid7 backport compatibility
- Create uuid_compat.py module that provides uuid7 for Python <3.14
  using uuid_extensions package, and native uuid.uuid7 for Python 3.14+
- Update all model files and migrations to use archivebox.uuid_compat
- Add uuid7 conditional dependency in pyproject.toml for Python <3.14
- Update requires-python to >=3.13 (from >=3.14)
- Update GitHub workflows, lock_pkgs.sh to use Python 3.13
- Update tool configs (ruff, pyright, uv) for Python 3.13

This enables running ArchiveBox on Python 3.13 while maintaining
forward compatibility with Python 3.14's native uuid7 support.
2025-12-27 01:07:30 +00:00

20 lines
470 B
Python
Executable File

"""UUID7 compatibility layer for Python 3.13+
Python 3.14+ has native uuid7 support. For Python 3.13, we use uuid_extensions.
"""
import sys
if sys.version_info >= (3, 14):
from uuid import uuid7
else:
try:
from uuid_extensions import uuid7
except ImportError:
raise ImportError(
"uuid_extensions package is required for Python <3.14. "
"Install it with: pip install uuid_extensions"
)
__all__ = ['uuid7']