build: better communicate lack of support for Python 3.11

pull/371/head
Bryce 9 months ago committed by Bryce Drennan
parent 1354cb9ed1
commit 477d161c91

@ -32,7 +32,7 @@ autoformat: ## Run the autoformatter.
@# ERA,T201
@-ruff --extend-ignore ANN,ARG001,C90,DTZ,D100,D101,D102,D103,D202,D203,D212,D415,E501,RET504,S101,UP006,UP007 --extend-select C,D400,I,W --unfixable T,ERA --fix-only .
@black .
@isort --atomic --profile black .
@isort --atomic --profile black --skip downloads/** .
test: ## Run the tests.
@pytest

@ -3,6 +3,8 @@ import os
# tells pytorch to allow MPS usage (for Mac M1 compatibility)
os.putenv("PYTORCH_ENABLE_MPS_FALLBACK", "1")
import sys # noqa
from .api import imagine, imagine_image_files # noqa
from .schema import ( # noqa
ImaginePrompt,
@ -10,3 +12,12 @@ from .schema import ( # noqa
LazyLoadingImage,
WeightedPrompt,
)
# if python version is 3.11 or higher, throw an exception
if sys.version_info >= (3, 11):
msg = (
"Imaginairy is not compatible with Python 3.11 or higher. Please use Python 3.8 - 3.10.\n"
"This is due to torch 1.13 not supporting Python 3.11 and this library not having yet switched "
"to torch 2.0"
)
raise RuntimeError(msg)

@ -110,6 +110,9 @@ setup(
"uvicorn>=0.16.0",
"xformers>=0.0.16; sys_platform!='darwin' and platform_machine!='aarch64'",
],
# torchvision doesn't support python 3.11 unless we switch to torch 2.0
python_requires=">=3.8,<3.11",
# don't specify maximum python versions as it can cause very long dependency resolution issues as the resolver
# goes back to older versions of packages that didn't specify a maximum
# https://discuss.python.org/t/requires-python-upper-limits/12663/75
# https://github.com/brycedrennan/imaginAIry/pull/341#issuecomment-1574723908
python_requires=">=3.8",
)

Loading…
Cancel
Save