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

Make tokenizers optional for Python 3.13 compatibility #719

Closed
wants to merge 4 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ dependencies = [
"anyio>=3.5.0, <5",
"distro>=1.7.0, <2",
"sniffio",
"cached-property; python_version < '3.8'",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this since the requires-python line means Python 3.7 is no longer supported, so this polyfill is not necessary.

The Python 3.7 EOL was June 27, 2023 so it's been unsupported for over a year at this point (technically 3.8 is unsupported now as well).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it makes sense to drop 3.7 support now, we just haven't had a compelling reason to do so yet. Will double check internally first before confirming that dropping support is okay.

Copy link
Author

@simonw simonw Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think 3.7 support may have been accidentally dropped already.

Running 3.7 these days is a bit tricky, but I managed to get a working interpreter using https://github.com/indygreg/python-build-standalone/releases/tag/20191025 like this:

cd /tm
mkdir py37
cd py37
wget 'https://github.com/indygreg/python-build-standalone/releases/download/20191025/cpython-3.7.5-macos-20191026T0535.tar.zst'
unzstd cpython-3.7.5-macos-20191026T0535.tar.zst
tar -xvf cpython-3.7.5-macos-20191026T0535.tar
cd python/install/bin/
./python3 -m pip install cowsay

That demonstrated that pip install cowsay worked. But then:

./python3 -m pip install jiter

Said this:

ERROR: Could not find a version that satisfies the requirement jiter (from versions: none)
ERROR: No matching distribution found for jiter

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh! thanks for catching that, we really need multi-version tests in CI...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you're due for an upgrade from rye to uv, at which point adding multi-version tests (both in CI and on local laptops) should be pretty simple.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, I'm hoping to make that change soon

"tokenizers >= 0.13.0",
"jiter>=0.4.0, <1",
]
requires-python = ">= 3.7"
requires-python = ">= 3.8"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was necessary because otherwise the jiter dependency cannot be successfully resolved:

% uv sync
  × No solution found when resolving dependencies:
  ╰─▶ Because the requested Python version (>=3.7) does not satisfy Python>=3.9 and the requested Python version (>=3.7) does not satisfy
      Python>=3.8,<3.9, we can conclude that Python>=3.8 is incompatible.
      And because jiter>=0.4.0 depends on Python>=3.8 and only the following versions of jiter are available:
          jiter<=0.4.0
          jiter==0.4.1
          jiter==0.4.2
          jiter==0.5.0
          jiter==0.6.0
          jiter==0.6.1
      we can conclude that jiter>=0.4.0 cannot be used.
      And because your project depends on jiter>=0.4.0 and your project requires anthropic[vertex], we can conclude that your projects's
      requirements are unsatisfiable.

      hint: The `requires-python` value (>=3.7) includes Python versions that are not supported by your dependencies (e.g., jiter>=0.4.0 only
      supports >=3.8). Consider using a more restrictive `requires-python` value (like >=3.8).

classifiers = [
"Typing :: Typed",
"Intended Audience :: Developers",
Expand Down Expand Up @@ -63,6 +61,7 @@ dev-dependencies = [
"importlib-metadata>=6.7.0",
"boto3-stubs >= 1",
"rich>=13.7.1",
'tokenizers",
simonw marked this conversation as resolved.
Show resolved Hide resolved
]

[tool.rye.scripts]
Expand Down
Loading