From e1ecbf58dacd40898d5074ef3cc28757772ddaa4 Mon Sep 17 00:00:00 2001 From: Lazlo Westerhof Date: Fri, 20 Dec 2024 14:42:11 +0100 Subject: [PATCH] Flask: update Flask and dependencies to v3.1.0 --- .github/workflows/main.yml | 13 +++++-------- setup.py | 14 +++++++------- yoda_eus/app.py | 10 +++++----- yoda_eus/tests/flask.test.cfg | 1 + 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8cb389b..ff92e0d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,23 +10,20 @@ on: - '**' jobs: - job: - runs-on: ubuntu-22.04 - strategy: - matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + lint: + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 + - name: Set up Python uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} - architecture: x64 + python-version: 3.12 - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install flake8==5.0.4 flake8-import-order==0.18.1 darglint==1.8.1 codespell mypy types-requests + python -m pip install flake8==7.1.1 flake8-import-order==0.18.2 darglint==1.8.1 codespell mypy types-requests - name: Lint with flake8 run: | diff --git a/setup.py b/setup.py index b9d3e8b..f948bd3 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='yoda_eus', - version='1.9.0.dev', + version='2.0.0.dev', author='Utrecht University - ITS/RDMS department', author_email='yoda@uu.nl', url='https://uu.nl/rdm', @@ -19,12 +19,12 @@ install_requires=[ "bcrypt==4.0.1", "email-validator==2.0.0", - "Flask==3.0.2", - "Flask-session==0.6.0", - "Flask-SQLAlchemy==3.0.3", - "Flask-wtf==1.2.1", + "Flask==3.1.0", + "flask-session==0.8.0", + "Flask-SQLAlchemy==3.1.1", + "Flask-WTF==1.2.2", "psycopg2-binary==2.9.10", - "requests==2.32.0", - "Werkzeug==3.0.3" + "requests==2.32.3", + "Werkzeug==3.1.3" ], ) diff --git a/yoda_eus/app.py b/yoda_eus/app.py index 9febf0d..1800cf9 100644 --- a/yoda_eus/app.py +++ b/yoda_eus/app.py @@ -529,19 +529,19 @@ def process_reset_password_form(hash: str) -> Response: # Confirm activation to user return render_template("reset-password-successful.html", **params), 200 - @ app.errorhandler(403) + @app.errorhandler(403) def access_forbidden(e: Exception) -> Response: return render_template('403.html'), 403 - @ app.errorhandler(404) + @app.errorhandler(404) def page_not_found(e: Exception) -> Response: return render_template('404.html'), 404 - @ app.errorhandler(500) + @app.errorhandler(500) def internal_error(e: Exception) -> Response: return render_template('500.html'), 500 - @ app.after_request + @app.after_request def add_security_headers(response: Response) -> Response: """Add generic security headers.""" # noqa DAR101 DAR201 @@ -611,7 +611,7 @@ def static_loader() -> Optional[Response]: return None - @ app.url_defaults + @app.url_defaults def add_cache_buster(endpoint: str, values: Dict[str, str]) -> None: """Add cache buster to asset (static) URLs.""" if endpoint.endswith("static"): diff --git a/yoda_eus/tests/flask.test.cfg b/yoda_eus/tests/flask.test.cfg index 43fd7ae..36083c9 100644 --- a/yoda_eus/tests/flask.test.cfg +++ b/yoda_eus/tests/flask.test.cfg @@ -4,6 +4,7 @@ YODA_EUS_FQDN = 'eus.yoda.test' CSRF_TOKENS_ENABLED = 'false' API_SECRET = 'dummy_api_secret' EUS_TITLE_TEXT = 'Yoda External User Service' +SESSION_TYPE = 'filesystem' # Theming configuration YODA_THEME_PATH = '/var/www/yoda/themes' # Path to location of themes