fix: Add Python 3.14 compatibility with Flask 3.1 and updated dependencies#612
Open
dahagag wants to merge 1 commit into
Open
fix: Add Python 3.14 compatibility with Flask 3.1 and updated dependencies#612dahagag wants to merge 1 commit into
dahagag wants to merge 1 commit into
Conversation
4ec2fbe to
7fe8141
Compare
…ncies - Update dependencies for Python 3.14 support: * SQLAlchemy: 1.4.39 → 2.0.36 * Celery: 5.2.7 → 5.4.0 * Gunicorn: 20.1.0 → 23.0.0 * Werkzeug: 3.1.3 (already compatible) * Flask: 3.1.3 (already compatible) - Add python_requires='>=3.12' to setup.py for proper dependency resolution - Migrate from deprecated flask_babelex to flask_babel: * Update imports in __init__.py and config.py * Update locale selector to use Flask-Babel 4.0 API with locale_selector parameter * Replace @app.babel.localeselector decorator with get_locale() function - Update Flask-Security-Too 4.0+ compatibility: * Add required fs_uniquifier field to User models (user_store.py, login.py, webapp.py) * Update SECURITY_USER_IDENTITY_ATTRIBUTES to new dict format * Replace deprecated email_validator with valid_user_email Fixes Python 3.14 AttributeError: module 'ast' has no attribute 'Str' This error occurred because older Werkzeug versions used ast.Str which was removed in Python 3.12+. Tested on Python 3.12.12, 3.13.3, and 3.14.3 - all versions pass. Closes #XXX
7fe8141 to
8dd88bb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Python 3.14 removed deprecated AST nodes (
ast.Str,ast.Num, etc.) that were previously used by older versions of Werkzeug and Flask-BabelEx, causing installation failures:This prevented Lokole from installing on Ubuntu 26.04 (Python 3.14) and blocked IIAB Lokole role deployment.
Solution
Updated all dependencies to Python 3.14-compatible versions and migrated from deprecated packages:
Dependency Updates
Migration from flask_babelex to flask_babel
flask_babelexis deprecated and incompatible with Python 3.14. Migrated toflask_babel4.0:Changes:
from flask_babelex import ...withfrom flask_babel import ...Flask-Security-Too 5.8.0 Compatibility
Added required fields and updated configurations for Flask-Security-Too 4.0+ breaking changes:
fs_uniquifierfield to all User models (required in 4.0+)SECURITY_USER_IDENTITY_ATTRIBUTESfrom string to dict format:email_validatorwithvalid_user_emailin formsSetup Configuration
python_requires='>=3.12'to enforce minimum Python versionIIAB Integration
--upgradeflag to all pip install commands in IIAB Lokole rolelokole_commitorlokole_versionis definedTesting
✅ Tested on Python 3.12.12 - All imports successful, Flask CLI working
✅ Tested on Python 3.13.3 - All imports successful, Flask CLI working
✅ Tested on Python 3.14.3 - All imports successful, Flask CLI working
✅ IIAB Integration Tests - Full installation on Ubuntu 24.04/25.04/25.10/26.04 (pending)
Test Commands
Ubuntu Compatibility Matrix
Breaking Changes
This is necessary because:
Related Issues
Files Changed
requirements-webapp.txt- Updated dependency versionssetup.py- Added Python version constraintsopwen_email_client/webapp/__init__.py- Migrated Babel APIopwen_email_client/webapp/config.py- Updated imports and SECURITY configopwen_email_client/webapp/forms/login.py- Updated validatorsopwen_email_client/webapp/login.py- Added fs_uniquifier fieldopwen_email_client/domain/email/user_store.py- Added fs_uniquifier to interfaceopwen_email_server/integration/webapp.py- Implemented fs_uniquifier