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

Python <3.10 Version Incompatibility with pylate #79

Closed
sam-hey opened this issue Jan 17, 2025 · 4 comments · Fixed by #80
Closed

Python <3.10 Version Incompatibility with pylate #79

sam-hey opened this issue Jan 17, 2025 · 4 comments · Fixed by #80

Comments

@sam-hey
Copy link

sam-hey commented Jan 17, 2025

Hello,
the pylate package requires Python version 3.10 or higher for proper functionality. When using Python 3.9, the following error occurs:

python_requires=">=3.8",

def __init__(
    self, tokenize_fn: Callable, valid_label_columns: list[str] | None = None
) -> None:
TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'NoneType'

| can not be used in python 3.9 for this type of operation.

The error can be observed in the pipeline run: Pipeline Run

@sam-hey sam-hey changed the title Python (3.9) Version Incompatibility with pylate Python <3.10 Version Incompatibility with pylate Jan 17, 2025
@tomaarsen
Copy link
Collaborator

tomaarsen commented Jan 17, 2025

cc @NohTow this should be easy to fix with a

from __future__ import annotations

above the files where this occurs.

Or you can just stick with the original Union[...] for now.

  • Tom Aarsen

@NohTow
Copy link
Collaborator

NohTow commented Jan 17, 2025

Oh, indeed, I dont know why we set 3.8 while we use | everywhere.
I don't know what's the best fix: upgrade the Python dependency or add from __future__ import annotations in almost every file?
cc @raphaelsty

@sam-hey
Copy link
Author

sam-hey commented Jan 19, 2025

Just a quick note: the target Python version for Ruff is set to 3.10

target-version = "py310"

@raphaelsty
Copy link
Collaborator

Let's follow Sentence Transformer, and import from future, what do you think about this @NohTow ? Once ST put a higher minimal python version we will do as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants