brettkromkamp / contextualise

Contextualise is an effective tool particularly suited for organising information-heavy projects and activities consisting of unstructured and widely diverse data and information resources
https://contextualise.dev/
MIT License
1.06k stars 44 forks source link

Flask and Werkzeug versions 3.0+ drop critical depreciated functions, breaking dependencies. #158

Open ProfessorDey opened 8 months ago

ProfessorDey commented 8 months ago

I have found that I had to explicitly set Flask and Werkzeug to 2.2.2 because Flask 3.0+ removed _app_ctx_stack and Werkzeug 3.0+ removing url_quote. The dependency versions for Flask and Werkzeuge should therefore be capped below version 3.0 in order to get a working installation instead of the current requirement of >= 2.2.2 for both. Attached below is my install log.

Note: As I'm an Archlinux user, I had to use venv as Pacman controls the global Python installations.

Flask 3.0+ _app_ctx_stack Error: ImportError: cannot import name '_app_ctx_stack' from 'flask' (/home/###/contextualise/.venv/lib/python3.11/site-packages/flask/__init__.py)

Werkzeug 3.0+ url_quote Error: ImportError: cannot import name 'url_quote' from 'werkzeug.urls' (/home/###/contextualise/.venv/lib/python3.11/site-packages/werkzeug/urls.py)

Successful Install:

Collecting flask==2.2.2 (from -r requirements.txt (line 2))
  Using cached Flask-2.2.2-py3-none-any.whl.metadata (3.9 kB)
Collecting Werkzeug==2.2.2 (from -r requirements.txt (line 3))
  Downloading Werkzeug-2.2.2-py3-none-any.whl.metadata (4.4 kB)
Collecting contextualise==1.0.8 (from -r requirements.txt (line 4))
  Using cached contextualise-1.0.8-py3-none-any.whl.metadata (13 kB)
Requirement already satisfied: Jinja2>=3.0 in ./.venv/lib/python3.11/site-packages (from flask==2.2.2->-r requirements.txt (line 2)) (3.1.3)
Requirement already satisfied: itsdangerous>=2.0 in ./.venv/lib/python3.11/site-packages (from flask==2.2.2->-r requirements.txt (line 2)) (2.1.2)
Requirement already satisfied: click>=8.0 in ./.venv/lib/python3.11/site-packages (from flask==2.2.2->-r requirements.txt (line 2)) (8.1.7)
Requirement already satisfied: MarkupSafe>=2.1.1 in ./.venv/lib/python3.11/site-packages (from Werkzeug==2.2.2->-r requirements.txt (line 3)) (2.1.5)
Requirement already satisfied: bcrypt>=4.0.1 in ./.venv/lib/python3.11/site-packages (from contextualise==1.0.8->-r requirements.txt (line 4)) (4.1.2)
Requirement already satisfied: Flask-Mail>=0.9.1 in ./.venv/lib/python3.11/site-packages (from contextualise==1.0.8->-r requirements.txt (line 4)) (0.9.1)
Requirement already satisfied: Flask-SeaSurf>=1.1.1 in ./.venv/lib/python3.11/site-packages (from contextualise==1.0.8->-r requirements.txt (line 4)) (1.1.1)
Requirement already satisfied: Flask-Security-Too>=5.0.2 in ./.venv/lib/python3.11/site-packages (from contextualise==1.0.8->-r requirements.txt (line 4)) (5.1.2)
Requirement already satisfied: Flask-SQLAlchemy>=3.0.2 in ./.venv/lib/python3.11/site-packages (from contextualise==1.0.8->-r requirements.txt (line 4)) (3.0.3)
Requirement already satisfied: gunicorn>=20.1.0 in ./.venv/lib/python3.11/site-packages (from contextualise==1.0.8->-r requirements.txt (line 4)) (21.2.0)
Requirement already satisfied: maya>=0.6.1 in ./.venv/lib/python3.11/site-packages (from contextualise==1.0.8->-r requirements.txt (line 4)) (0.6.1)
Requirement already satisfied: mistune>=2.0.4 in ./.venv/lib/python3.11/site-packages (from contextualise==1.0.8->-r requirements.txt (line 4)) (3.0.2)
Requirement already satisfied: Pygments>=2.13.0 in ./.venv/lib/python3.11/site-packages (from contextualise==1.0.8->-r requirements.txt (line 4)) (2.17.2)
Requirement already satisfied: python-slugify>=6.1.2 in ./.venv/lib/python3.11/site-packages (from contextualise==1.0.8->-r requirements.txt (line 4)) (8.0.4)
Requirement already satisfied: SQLAlchemy>=1.4.42 in ./.venv/lib/python3.11/site-packages (from contextualise==1.0.8->-r requirements.txt (line 4)) (2.0.29)
Requirement already satisfied: topic-db>=2.0.5 in ./.venv/lib/python3.11/site-packages (from contextualise==1.0.8->-r requirements.txt (line 4)) (2.0.5)
Requirement already satisfied: blinker in ./.venv/lib/python3.11/site-packages (from Flask-Mail>=0.9.1->contextualise==1.0.8->-r requirements.txt (line 4)) (1.7.0)
Requirement already satisfied: Flask-Login>=0.6.0 in ./.venv/lib/python3.11/site-packages (from Flask-Security-Too>=5.0.2->contextualise==1.0.8->-r requirements.txt (line 4)) (0.6.3)
Requirement already satisfied: Flask-Principal>=0.4.0 in ./.venv/lib/python3.11/site-packages (from Flask-Security-Too>=5.0.2->contextualise==1.0.8->-r requirements.txt (line 4)) (0.4.0)
Requirement already satisfied: Flask-WTF>=1.0.0 in ./.venv/lib/python3.11/site-packages (from Flask-Security-Too>=5.0.2->contextualise==1.0.8->-r requirements.txt (line 4)) (1.2.1)
Requirement already satisfied: email-validator>=1.1.1 in ./.venv/lib/python3.11/site-packages (from Flask-Security-Too>=5.0.2->contextualise==1.0.8->-r requirements.txt (line 4)) (2.1.1)
Requirement already satisfied: passlib>=1.7.4 in ./.venv/lib/python3.11/site-packages (from Flask-Security-Too>=5.0.2->contextualise==1.0.8->-r requirements.txt (line 4)) (1.7.4)
Requirement already satisfied: wtforms>=3.0.0 in ./.venv/lib/python3.11/site-packages (from Flask-Security-Too>=5.0.2->contextualise==1.0.8->-r requirements.txt (line 4)) (3.1.2)
Requirement already satisfied: setuptools in ./.venv/lib/python3.11/site-packages (from Flask-Security-Too>=5.0.2->contextualise==1.0.8->-r requirements.txt (line 4)) (65.5.0)
Requirement already satisfied: packaging in ./.venv/lib/python3.11/site-packages (from gunicorn>=20.1.0->contextualise==1.0.8->-r requirements.txt (line 4)) (24.0)
Requirement already satisfied: humanize in ./.venv/lib/python3.11/site-packages (from maya>=0.6.1->contextualise==1.0.8->-r requirements.txt (line 4)) (4.9.0)
Requirement already satisfied: pytz in ./.venv/lib/python3.11/site-packages (from maya>=0.6.1->contextualise==1.0.8->-r requirements.txt (line 4)) (2024.1)
Requirement already satisfied: dateparser>=0.7.0 in ./.venv/lib/python3.11/site-packages (from maya>=0.6.1->contextualise==1.0.8->-r requirements.txt (line 4)) (1.2.0)
Requirement already satisfied: tzlocal in ./.venv/lib/python3.11/site-packages (from maya>=0.6.1->contextualise==1.0.8->-r requirements.txt (line 4)) (5.2)
Requirement already satisfied: pendulum>=2.0.2 in ./.venv/lib/python3.11/site-packages (from maya>=0.6.1->contextualise==1.0.8->-r requirements.txt (line 4)) (3.0.0)
Requirement already satisfied: snaptime in ./.venv/lib/python3.11/site-packages (from maya>=0.6.1->contextualise==1.0.8->-r requirements.txt (line 4)) (0.2.4)
Requirement already satisfied: text-unidecode>=1.3 in ./.venv/lib/python3.11/site-packages (from python-slugify>=6.1.2->contextualise==1.0.8->-r requirements.txt (line 4)) (1.3)
Requirement already satisfied: typing-extensions>=4.6.0 in ./.venv/lib/python3.11/site-packages (from SQLAlchemy>=1.4.42->contextualise==1.0.8->-r requirements.txt (line 4)) (4.11.0)
Requirement already satisfied: greenlet!=0.4.17 in ./.venv/lib/python3.11/site-packages (from SQLAlchemy>=1.4.42->contextualise==1.0.8->-r requirements.txt (line 4)) (3.0.3)
Requirement already satisfied: pytest>=7.1.2 in ./.venv/lib/python3.11/site-packages (from topic-db>=2.0.5->contextualise==1.0.8->-r requirements.txt (line 4)) (8.1.1)
Requirement already satisfied: typed-tree>=1.0.8 in ./.venv/lib/python3.11/site-packages (from topic-db>=2.0.5->contextualise==1.0.8->-r requirements.txt (line 4)) (1.0.8)
Requirement already satisfied: python-dateutil in ./.venv/lib/python3.11/site-packages (from dateparser>=0.7.0->maya>=0.6.1->contextualise==1.0.8->-r requirements.txt (line 4)) (2.9.0.post0)
Requirement already satisfied: regex!=2019.02.19,!=2021.8.27 in ./.venv/lib/python3.11/site-packages (from dateparser>=0.7.0->maya>=0.6.1->contextualise==1.0.8->-r requirements.txt (line 4)) (2023.12.25)
Requirement already satisfied: dnspython>=2.0.0 in ./.venv/lib/python3.11/site-packages (from email-validator>=1.1.1->Flask-Security-Too>=5.0.2->contextualise==1.0.8->-r requirements.txt (line 4)) (2.6.1)
Requirement already satisfied: idna>=2.0.0 in ./.venv/lib/python3.11/site-packages (from email-validator>=1.1.1->Flask-Security-Too>=5.0.2->contextualise==1.0.8->-r requirements.txt (line 4)) (3.6)
Requirement already satisfied: tzdata>=2020.1 in ./.venv/lib/python3.11/site-packages (from pendulum>=2.0.2->maya>=0.6.1->contextualise==1.0.8->-r requirements.txt (line 4)) (2024.1)
Requirement already satisfied: time-machine>=2.6.0 in ./.venv/lib/python3.11/site-packages (from pendulum>=2.0.2->maya>=0.6.1->contextualise==1.0.8->-r requirements.txt (line 4)) (2.14.1)
Requirement already satisfied: iniconfig in ./.venv/lib/python3.11/site-packages (from pytest>=7.1.2->topic-db>=2.0.5->contextualise==1.0.8->-r requirements.txt (line 4)) (2.0.0)
Requirement already satisfied: pluggy<2.0,>=1.4 in ./.venv/lib/python3.11/site-packages (from pytest>=7.1.2->topic-db>=2.0.5->contextualise==1.0.8->-r requirements.txt (line 4)) (1.4.0)
Requirement already satisfied: six>=1.5 in ./.venv/lib/python3.11/site-packages (from python-dateutil->dateparser>=0.7.0->maya>=0.6.1->contextualise==1.0.8->-r requirements.txt (line 4)) (1.16.0)
Using cached Flask-2.2.2-py3-none-any.whl (101 kB)
Downloading Werkzeug-2.2.2-py3-none-any.whl (232 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 232.7/232.7 kB 3.7 MB/s eta 0:00:00
Using cached contextualise-1.0.8-py3-none-any.whl (2.3 MB)
Installing collected packages: Werkzeug, flask, contextualise
  Attempting uninstall: Werkzeug
    Found existing installation: Werkzeug 3.0.2
    Uninstalling Werkzeug-3.0.2:
      Successfully uninstalled Werkzeug-3.0.2
Successfully installed Werkzeug-2.2.2 contextualise-1.0.8 flask-2.2.2
brettkromkamp commented 8 months ago

Hi! Thanks for reporting the issue. Yes, you're right... updating to Flask version 3 did have some breaking changes. A fix is available on the develop branch. I'll take a proper look when I get back to my machine.

ginimod commented 7 months ago

Okay thanks !!! work for me with this requirements

Ubuntu, python 3.10, venv requirements3.txt