From 59472c2adb37aa6a5d363db7d6b8f972c3102161 Mon Sep 17 00:00:00 2001 From: Marco Donadoni Date: Wed, 8 May 2024 11:30:35 +0200 Subject: [PATCH] build(docker): upgrade base image to ubuntu 24.04 (#692) Closes reanahub/reana#808 --- .github/workflows/ci.yml | 34 ++--- .readthedocs.yaml | 4 +- Dockerfile | 20 ++- docs/openapi.json | 5 +- reana_server/app.py | 7 +- reana_server/ext.py | 8 +- reana_server/factory.py | 26 +++- requirements.txt | 233 ++++++++++++++++--------------- scripts/generate_openapi_spec.py | 3 +- setup.py | 46 +++--- tests/conftest.py | 4 +- tests/test_factory.py | 6 +- 12 files changed, 207 insertions(+), 189 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb1ed768..90c1c571 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ on: [push, pull_request] jobs: lint-commitlint: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -36,7 +36,7 @@ jobs: ./run-tests.sh --check-commitlint ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.number }} lint-shellcheck: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -47,7 +47,7 @@ jobs: ./run-tests.sh --check-shellcheck lint-black: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -55,7 +55,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: "3.12" - name: Check Python code formatting run: | @@ -63,7 +63,7 @@ jobs: ./run-tests.sh --check-black lint-flake8: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -71,7 +71,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: "3.12" - name: Check compliance with pep8, pyflakes and circular complexity run: | @@ -79,7 +79,7 @@ jobs: ./run-tests.sh --check-flake8 lint-pydocstyle: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -87,7 +87,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: "3.12" - name: Check compliance with Python docstring conventions run: | @@ -95,7 +95,7 @@ jobs: ./run-tests.sh --check-pydocstyle lint-check-manifest: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -103,7 +103,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: "3.12" - name: Check Python manifest completeness run: | @@ -111,7 +111,7 @@ jobs: ./run-tests.sh --check-manifest docs-sphinx: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -119,7 +119,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: "3.12" - name: Install system dependencies run: | @@ -135,7 +135,7 @@ jobs: run: ./run-tests.sh --check-sphinx python-tests: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -143,7 +143,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: "3.12" - name: Install Python dependencies run: | @@ -163,7 +163,7 @@ jobs: files: coverage.xml lint-dockerfile: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -172,7 +172,7 @@ jobs: run: ./run-tests.sh --check-dockerfile docker-build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -181,7 +181,7 @@ jobs: run: ./run-tests.sh --check-docker-build release-docker: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 if: > vars.RELEASE_DOCKER == 'true' && github.event_name == 'push' && diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 1240941f..32f7a2d0 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -7,9 +7,9 @@ version: 2 build: - os: ubuntu-22.04 + os: ubuntu-24.04 tools: - python: "3.8" + python: "3.12" sphinx: configuration: docs/conf.py diff --git a/Dockerfile b/Dockerfile index 13704db8..88d8be46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,15 +5,13 @@ # under the terms of the MIT License; see LICENSE file for more details. # Use Ubuntu LTS base image -FROM docker.io/library/ubuntu:20.04 +FROM docker.io/library/ubuntu:24.04 # Use default answers in installation commands ENV DEBIAN_FRONTEND=noninteractive -# Use distutils provided by the standard Python library instead of the vendored one in -# setuptools, so that editable installations are stored in the right directory. -# See https://github.com/pypa/setuptools/issues/3301 -ENV SETUPTOOLS_USE_DISTUTILS=stdlib +# Allow pip to install packages in the system site-packages dir +ENV PIP_BREAK_SYSTEM_PACKAGES=true # Prepare list of Python dependencies COPY requirements.txt /code/ @@ -27,17 +25,17 @@ RUN apt-get update -y && \ libffi-dev \ libpcre3 \ libpcre3-dev \ - libpython3.8 \ + libpython3.12 \ procps \ python3-pip \ - python3.8 \ - python3.8-dev \ + python3.12 \ + python3.12-dev \ vim-tiny && \ - pip install --no-cache-dir --upgrade pip setuptools && \ + pip install --no-cache-dir --upgrade setuptools && \ pip install --no-cache-dir -r /code/requirements.txt && \ apt-get remove -y \ gcc \ - python3.8-dev && \ + python3.12-dev && \ apt-get autoremove -y && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* @@ -68,7 +66,7 @@ RUN if test -e modules/reana-commons; then \ fi # A quick fix to allow eduGAIN and social login users that wouldn't otherwise match Invenio username rules -RUN sed -i 's|^username_regex = re.compile\(.*\)$|username_regex = re.compile("^\\S+$")|g' /usr/local/lib/python3.8/dist-packages/invenio_userprofiles/validators.py +RUN sed -i 's|^username_regex = re.compile\(.*\)$|username_regex = re.compile("^\\S+$")|g' /usr/local/lib/python3.12/dist-packages/invenio_userprofiles/validators.py # Check for any broken Python dependencies # hadolint ignore=DL3059 diff --git a/docs/openapi.json b/docs/openapi.json index 95f18a10..112d7353 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -7,10 +7,6 @@ "paths": { "/account/settings/linkedaccounts/": {}, "/account/settings/linkedaccounts/static/{filename}": {}, - "/account/settings/login": {}, - "/account/settings/security/": {}, - "/account/settings/sessions/revoke/": {}, - "/account/settings/static/{filename}": {}, "/api/config": { "get": { "description": "This resource provides configuration needed by Reana-UI.", @@ -4543,6 +4539,7 @@ "/oauth/disconnect/{remote_app}/": {}, "/oauth/login": {}, "/oauth/login/{remote_app}/": {}, + "/oauth/logout": {}, "/oauth/signup/{remote_app}/": {}, "/oauth/static/{filename}": {}, "/signin": {}, diff --git a/reana_server/app.py b/reana_server/app.py index 20640e04..56458ba1 100644 --- a/reana_server/app.py +++ b/reana_server/app.py @@ -1,16 +1,19 @@ # -*- coding: utf-8 -*- # # This file is part of REANA. -# Copyright (C) 2017, 2018, 2019, 2020, 2021 CERN. +# Copyright (C) 2017, 2018, 2019, 2020, 2021, 2024 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Main entrypoint for REANA-Server.""" -from reana_server.factory import create_app +from invenio_app.factory import create_app # Needed for flask.with_appcontext decorator to work. +# +# Note that this is the full Flask app including all the necessary Invenio modules. +# See `factory.py` for more details. app = create_app() if __name__ == "__main__": diff --git a/reana_server/ext.py b/reana_server/ext.py index d1ed5967..93cabadf 100644 --- a/reana_server/ext.py +++ b/reana_server/ext.py @@ -53,7 +53,13 @@ def handle_args_validation_error(error: UnprocessableEntity): class REANA(object): - """REANA Invenio app.""" + """REANA Invenio app. + + This is used to initialise REANA as a Flask/Invenio extension, + and this is used in production. + + See the docsting of `reana_server.factory.create_app` for more details. + """ def __init__(self, app=None): """Extension initialization.""" diff --git a/reana_server/factory.py b/reana_server/factory.py index 98381072..4699d82f 100644 --- a/reana_server/factory.py +++ b/reana_server/factory.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # This file is part of REANA. -# Copyright (C) 2017, 2018, 2019, 2020, 2021, 2022 CERN. +# Copyright (C) 2017, 2018, 2019, 2020, 2021, 2022, 2024 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. @@ -11,11 +11,10 @@ import logging from flask import Flask, current_app -from flask_babelex import Babel +from invenio_i18n import Babel from flask_menu import Menu as FlaskMenu from flask_oauthlib.client import OAuth as FlaskOAuth from invenio_accounts import InvenioAccounts -from invenio_accounts.views import blueprint as blueprint_user from invenio_db import InvenioDB from invenio_oauthclient import InvenioOAuthClient from invenio_oauthclient.views.client import blueprint as blueprint_client @@ -24,8 +23,23 @@ from reana_db.database import Session -def create_app(config_mapping=None): - """REANA Server application factory.""" +def create_minimal_app(config_mapping=None): + """REANA Server application factory. + + Create a minimal Flask app containing all of REANA's endpoints and the needed + Invenio modules. Use `invenio_app.factory.create_app` the create the full Invenio + app that is also used in production or when invoking `invenio run`. + + This method is used to create the Flask app in the tests and in the + `generate_openapi_spec.py` script. + + In general, this is how Flask apps are created: + - When running in debug mode, `invenio run ...` is invoked. This calls `invenio_app.factory.create_app`. + - When running in production mode, `uwsgi` is used, and the module configured is `invenio_app.wsgi:application`. This calls `invenio_app.factory.create_app`. + - When running `flask reana-admin` commands, flask auto-detects the app present in `app.py`, which is created with `invenio_app.factory.create_app`. + - When running the tests, `reana_server.factory.create_minimal_app` is called. + - When running `generate_openapi_spec.py`, the app is created with `reana_server.factory.create_minimal_app`. + """ logging.basicConfig(level=REANA_LOG_LEVEL, format=REANA_LOG_FORMAT, force=True) app = Flask(__name__) app.config.from_object("reana_server.config") @@ -35,6 +49,7 @@ def create_app(config_mapping=None): app.session = Session + # Inspired from https://github.com/inveniosoftware/invenio-accounts/blob/345abfc2d3bf4af0be898a1b4ee1fe45edd16053/tests/conftest.py#L66 Babel(app) FlaskMenu(app) InvenioDB(app) @@ -43,7 +58,6 @@ def create_app(config_mapping=None): InvenioOAuthClient(app) # Register Invenio OAuth endpoints - app.register_blueprint(blueprint_user) app.register_blueprint(blueprint_client) app.register_blueprint(blueprint_settings) diff --git a/requirements.txt b/requirements.txt index d78fbecc..d449e118 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,220 +1,223 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --annotation-style=line --output-file=requirements.txt setup.py # adage==0.10.1 # via reana-commons, reana-server (setup.py), yadage -alembic==1.13.1 # via flask-alembic, reana-db +alembic==1.10.4 # via flask-alembic, invenio-db, reana-db amqp==5.2.0 # via kombu appdirs==1.4.4 # via fs, snakemake -argcomplete==3.2.2 # via cwltool +argcomplete==3.4.0 # via cwltool asttokens==2.4.1 # via stack-data -async-timeout==4.0.3 # via redis attrs==23.2.0 # via jsonschema -babel==2.14.0 # via flask-babelex, invenio-i18n -backcall==0.2.0 # via ipython -backports-zoneinfo[tzdata]==0.2.1 # via celery, kombu +babel==2.15.0 # via flask-babel, invenio-i18n bagit==1.8.1 # via cwltool -billiard==3.6.4.0 # via celery -blinker==1.7.0 # via flask-mail, flask-principal, invenio-base, invenio-oauthclient +billiard==4.2.0 # via celery +blinker==1.8.2 # via flask-mail, flask-principal, invenio-base, invenio-oauthclient, sentry-sdk bracex==2.4 # via wcmatch bravado==10.3.2 # via reana-commons bravado-core==6.1.0 # via bravado, reana-commons -cachecontrol[filecache]==0.13.1 # via cachecontrol, schema-salad +cachecontrol[filecache]==0.14.0 # via cachecontrol, schema-salad cachelib==0.9.0 # via flask-caching, flask-oauthlib, invenio-oauth2server cachetools==5.3.3 # via google-auth -celery==5.2.7 # via flask-celeryext, invenio-celery -certifi==2024.2.2 # via kubernetes, requests +celery==5.3.6 # via flask-celeryext, invenio-celery +certifi==2024.7.4 # via kubernetes, requests, sentry-sdk cffi==1.16.0 # via cryptography -chardet==3.0.4 # via requests +charset-normalizer==3.3.2 # via requests checksumdir==1.1.9 # via packtivity, reana-commons, yadage click==8.1.7 # via celery, click-didyoumean, click-plugins, click-repl, flask, flask-shell-ipython, packtivity, reana-commons, yadage, yadage-schemas -click-didyoumean==0.3.0 # via celery +click-didyoumean==0.3.1 # via celery click-plugins==1.1.1 # via celery click-repl==0.3.0 # via celery coloredlogs==15.0.1 # via cwltool +commonmark==0.9.1 # via rich configargparse==1.7 # via snakemake connection-pool==0.0.3 # via snakemake -cryptography==42.0.5 # via invenio-accounts, pyopenssl, requests, sqlalchemy-utils +cryptography==42.0.8 # via invenio-accounts, pyjwt, sqlalchemy-utils cwltool==3.1.20210628163208 # via reana-commons datrie==0.8.2 # via snakemake decorator==5.1.1 # via ipython, jsonpath-rw, networkx +deprecated==1.2.14 # via limits dnspython==2.6.1 # via email-validator -docutils==0.20.1 # via snakemake -dpath==2.1.6 # via yte -email-validator==2.1.1 # via invenio-accounts, wtforms-components +docutils==0.21.2 # via snakemake +dpath==2.2.0 # via yte +email-validator==2.2.0 # via flask-security-invenio, wtforms-components executing==2.0.1 # via stack-data -fastjsonschema==2.19.1 # via nbformat -filelock==3.13.1 # via cachecontrol -flask==2.1.3 # via flask-alembic, flask-babelex, flask-breadcrumbs, flask-caching, flask-celeryext, flask-collect-invenio, flask-cors, flask-kvsession-invenio, flask-limiter, flask-login, flask-mail, flask-menu, flask-oauthlib, flask-principal, flask-security, flask-shell-ipython, flask-sqlalchemy, flask-webpackext, flask-wtf, invenio-base, invenio-config, invenio-mail, reana-server (setup.py) +fastjsonschema==2.20.0 # via nbformat +filelock==3.15.4 # via cachecontrol +flask==2.2.5 # via flask-admin, flask-alembic, flask-babel, flask-caching, flask-celeryext, flask-collect-invenio, flask-cors, flask-kvsession-invenio, flask-limiter, flask-login, flask-mail, flask-menu, flask-oauthlib, flask-principal, flask-security-invenio, flask-shell-ipython, flask-sqlalchemy, flask-webpackext, flask-wtf, invenio-base, invenio-config, invenio-mail, reana-server (setup.py), sentry-sdk +flask-admin==1.6.1 # via invenio-admin flask-alembic==2.0.1 # via invenio-db -flask-babelex==0.9.4 # via flask-security, invenio-i18n -flask-breadcrumbs==0.5.1 # via invenio-accounts, invenio-oauth2server, invenio-oauthclient, invenio-theme, invenio-userprofiles -flask-caching==2.1.0 # via invenio-cache -flask-celeryext==0.4.3 # via invenio-celery, reana-server (setup.py) +flask-babel==4.0.0 # via flask-security-invenio, invenio-i18n +flask-caching==2.3.0 # via invenio-cache +flask-celeryext==0.5.0 # via invenio-celery flask-collect-invenio==1.4.0 # via invenio-assets -flask-cors==4.0.0 # via invenio-rest +flask-cors==4.0.1 # via invenio-rest flask-kvsession-invenio==0.6.3 # via invenio-accounts -flask-limiter==1.1.0 # via invenio-app -flask-login==0.4.1 # via flask-security, invenio-accounts -flask-mail==0.9.1 # via flask-security, invenio-accounts, invenio-mail, invenio-userprofiles -flask-menu==0.7.3 # via flask-breadcrumbs, invenio-accounts, invenio-theme, invenio-userprofiles +flask-limiter==2.9.2 # via invenio-app, reana-server (setup.py) +flask-login==0.6.3 # via flask-security-invenio +flask-mail==0.9.1 # via flask-security-invenio, invenio-mail +flask-menu==1.0.1 # via invenio-admin, invenio-theme flask-oauthlib==0.9.6 # via invenio-oauth2server, invenio-oauthclient -flask-principal==0.4.0 # via flask-security -flask-security==3.0.0 # via invenio-accounts +flask-principal==0.4.0 # via flask-security-invenio, invenio-admin +flask-security-invenio==3.3.3 # via invenio-accounts flask-shell-ipython==0.5.1 # via invenio-app flask-sqlalchemy==2.5.1 # via flask-alembic, invenio-db flask-talisman==0.8.1 # via invenio-app flask-webpackext==1.0.2 # via invenio-assets -flask-wtf==1.2.1 # via flask-security, invenio-accounts, invenio-oauth2server, invenio-userprofiles +flask-wtf==1.2.1 # via flask-security-invenio, invenio-oauth2server fs==2.4.16 # via reana-commons future==1.0.0 # via invenio-oauth2server gitdb==4.0.11 # via gitpython -gitpython==3.1.42 # via reana-server (setup.py), snakemake +github3-py==4.0.1 # via invenio-oauthclient +gitpython==3.1.43 # via reana-server (setup.py), snakemake glob2==0.7 # via packtivity, yadage -google-auth==2.28.1 # via kubernetes +google-auth==2.31.0 # via kubernetes +greenlet==3.0.3 # via sqlalchemy humanfriendly==10.0 # via coloredlogs, snakemake -idna==2.10 # via email-validator, jsonschema, requests -importlib-metadata==4.13.0 # via alembic, flask, invenio-base, invenio-celery, invenio-oauth2server -importlib-resources==6.1.2 # via alembic, invenio-base, schema-salad +idna==3.7 # via email-validator, jsonschema, requests +importlib-metadata==8.0.0 # via invenio-base, invenio-oauth2server +importlib-resources==6.4.0 # via invenio-base, limits, swagger-spec-validator infinity==1.5 # via intervals intervals==0.9.2 # via wtforms-components -invenio-accounts==1.4.13 # via invenio-oauth2server, invenio-oauthclient, invenio-userprofiles, reana-server (setup.py) -invenio-app==1.3.4 # via reana-server (setup.py) -invenio-assets==3.0.2 # via invenio-theme -invenio-base==1.2.17 # via invenio-accounts, invenio-assets, invenio-cache, invenio-celery, invenio-db, invenio-i18n, invenio-oauth2server, invenio-oauthclient, invenio-rest, invenio-theme, invenio-userprofiles, reana-server (setup.py) -invenio-cache==1.1.1 # via invenio-app, reana-server (setup.py) -invenio-celery==1.2.5 # via invenio-accounts, invenio-app, invenio-logging +invenio-access==2.0.0 # via reana-server (setup.py) +invenio-accounts==5.0.1 # via invenio-access, invenio-admin, invenio-oauth2server, invenio-oauthclient, invenio-userprofiles, reana-server (setup.py) +invenio-admin==1.4.0 # via invenio-access +invenio-app==1.5.0 # via reana-server (setup.py) +invenio-assets==3.0.3 # via invenio-theme +invenio-base==1.4.0 # via invenio-access, invenio-admin, invenio-app, invenio-assets, invenio-cache, invenio-celery, invenio-db, invenio-i18n, invenio-oauth2server, invenio-oauthclient, invenio-rest, invenio-theme, reana-server (setup.py) +invenio-cache==1.3.0 # via invenio-app, reana-server (setup.py) +invenio-celery==1.3.1 # via invenio-accounts, invenio-app, invenio-logging invenio-config==1.0.4 # via invenio-app, reana-server (setup.py) -invenio-db[postgresql]==1.0.14 # via invenio-logging, reana-server (setup.py) -invenio-i18n==1.3.3 # via invenio-accounts, invenio-oauth2server, invenio-oauthclient, invenio-theme, invenio-userprofiles, reana-server (setup.py) -invenio-logging==1.3.2 # via reana-server (setup.py) -invenio-mail==1.0.2 # via invenio-oauthclient, reana-server (setup.py) -invenio-oauth2server==1.3.8 # via reana-server (setup.py) -invenio-oauthclient==1.5.4 # via reana-server (setup.py) -invenio-rest==1.2.8 # via invenio-accounts -invenio-theme==1.4.9 # via invenio-accounts, invenio-oauth2server, invenio-oauthclient, invenio-userprofiles, reana-server (setup.py) -invenio-userprofiles==1.2.4 # via reana-server (setup.py) -ipython==8.12.3 # via flask-shell-ipython +invenio-db[postgresql]==1.1.5 # via invenio-admin, invenio-logging, reana-server (setup.py) +invenio-i18n==2.1.1 # via invenio-access, invenio-accounts, invenio-admin, invenio-oauth2server, invenio-oauthclient, invenio-theme, invenio-userprofiles, reana-server (setup.py) +invenio-logging[sentry-sdk]==2.1.1 # via invenio-rest, reana-server (setup.py) +invenio-mail==2.1.1 # via invenio-accounts, invenio-oauthclient, reana-server (setup.py) +invenio-oauth2server==2.3.1 # via reana-server (setup.py) +invenio-oauthclient==4.0.0 # via reana-server (setup.py) +invenio-rest==1.3.0 # via invenio-accounts +invenio-theme==3.2.0 # via invenio-accounts, invenio-oauth2server, invenio-oauthclient, reana-server (setup.py) +invenio-userprofiles==3.0.0 # via reana-server (setup.py) +ipython==8.26.0 # via flask-shell-ipython isodate==0.6.1 # via rdflib -itsdangerous==2.0.1 # via flask, flask-kvsession-invenio, flask-security, flask-wtf, invenio-base, invenio-rest +itsdangerous==2.0.1 # via flask, flask-kvsession-invenio, flask-security-invenio, flask-wtf, invenio-base, invenio-rest jedi==0.19.1 # via ipython -jinja2==3.1.3 # via flask, flask-babelex, invenio-accounts, snakemake -jq==1.6.0 # via packtivity, yadage +jinja2==3.1.4 # via flask, flask-babel, snakemake +jq==1.7.0 # via packtivity, yadage jsmin==3.0.1 # via invenio-theme jsonpath-rw==1.4.0 # via packtivity, yadage -jsonpointer==2.4 # via jsonschema, packtivity, yadage +jsonpointer==3.0.0 # via jsonschema, packtivity, yadage jsonref==1.1.0 # via bravado-core, packtivity, yadage, yadage-schemas jsonschema[format]==3.2.0 # via bravado-core, nbformat, packtivity, reana-commons, snakemake, swagger-spec-validator, yadage, yadage-schemas -jupyter-core==5.7.1 # via nbformat -kombu==5.3.5 # via celery, reana-commons +jupyter-core==5.7.2 # via nbformat +kombu==5.3.7 # via celery, reana-commons kubernetes==22.6.0 # via reana-commons -limits==1.6 # via flask-limiter, invenio-app -lxml==5.1.0 # via prov -mako==1.3.2 # via alembic -markupsafe==2.1.5 # via invenio-base, jinja2, mako, wtforms, wtforms-components -marshmallow==2.20.1 # via invenio-rest, reana-server (setup.py), webargs -matplotlib-inline==0.1.6 # via ipython -maxminddb==2.5.2 # via maxminddb-geolite2 +limits==3.13.0 # via flask-limiter +lxml==5.2.2 # via prov +mako==1.3.5 # via alembic +markupsafe==2.1.5 # via invenio-base, jinja2, mako, sentry-sdk, werkzeug, wtforms, wtforms-components +marshmallow==2.21.0 # via invenio-rest, reana-server (setup.py), webargs +matplotlib-inline==0.1.7 # via ipython +maxminddb==2.6.2 # via maxminddb-geolite2 maxminddb-geolite2==2018.703 # via invenio-accounts -mistune==2.0.5 # via schema-salad +mistune==3.0.2 # via schema-salad mock==3.0.5 # via packtivity, reana-commons monotonic==1.6 # via bravado -msgpack==1.0.7 # via bravado-core, cachecontrol, invenio-celery +msgpack==1.0.8 # via bravado-core, cachecontrol, invenio-celery msgpack-python==0.5.6 # via bravado mypy-extensions==1.0.0 # via cwltool, schema-salad -nbformat==5.9.2 # via snakemake +nbformat==5.10.4 # via snakemake networkx==1.11 # via adage, prov -node-semver==0.1.1 # via invenio-assets, pywebpack oauthlib==2.1.0 # via flask-oauthlib, invenio-oauthclient, requests-oauthlib -packaging==23.2 # via snakemake +ordered-set==4.1.0 # via flask-limiter +packaging==24.1 # via limits, snakemake packtivity==0.14.24 # via reana-server (setup.py), yadage -parso==0.8.3 # via jedi -passlib==1.7.4 # via flask-security, invenio-accounts +parso==0.8.4 # via jedi +passlib==1.7.4 # via flask-security-invenio pexpect==4.9.0 # via ipython -pickleshare==0.7.5 # via ipython plac==1.4.3 # via yte -platformdirs==4.2.0 # via jupyter-core +platformdirs==4.2.2 # via jupyter-core ply==3.11 # via jsonpath-rw -prompt-toolkit==3.0.43 # via click-repl, ipython +prompt-toolkit==3.0.47 # via click-repl, ipython prov==1.5.1 # via cwltool -psutil==5.9.8 # via cwltool, snakemake, yadage +psutil==6.0.0 # via cwltool, snakemake, yadage psycopg2-binary==2.9.9 # via invenio-db, reana-db ptyprocess==0.7.0 # via pexpect pulp==2.7.0 # via reana-commons, snakemake pure-eval==0.2.2 # via stack-data -pyasn1==0.5.1 # via pyasn1-modules, rsa -pyasn1-modules==0.3.0 # via google-auth -pycparser==2.21 # via cffi +pyasn1==0.6.0 # via pyasn1-modules, rsa +pyasn1-modules==0.4.0 # via google-auth +pycparser==2.22 # via cffi pydot==2.0.0 # via cwltool -pygments==2.17.2 # via ipython -pyjwt==2.8.0 # via invenio-accounts, invenio-oauth2server +pygments==2.18.0 # via ipython, rich +pyjwt[crypto]==2.8.0 # via github3-py, invenio-accounts, invenio-oauth2server pynpm==0.2.0 # via flask-webpackext, pywebpack -pyopenssl==24.0.0 # via requests -pyparsing==3.1.1 # via pydot, rdflib +pyparsing==3.1.2 # via pydot, rdflib pyrsistent==0.20.0 # via jsonschema -python-dateutil==2.9.0 # via bravado, bravado-core, kubernetes, prov -pytz==2024.1 # via babel, bravado-core, celery -pywebpack==1.2.0 # via flask-webpackext +python-dateutil==2.9.0.post0 # via bravado, bravado-core, celery, github3-py, kubernetes, prov +pytz==2024.1 # via bravado-core, flask-babel +pywebpack==2.0.0 # via flask-webpackext, invenio-assets pyyaml==6.0.1 # via bravado, bravado-core, kubernetes, packtivity, reana-commons, snakemake, swagger-spec-validator, yadage, yadage-schemas, yte rdflib==5.0.0 # via cwltool, prov, schema-salad -reana-commons[cwl,kubernetes,snakemake,yadage]==0.95.0a2 # via reana-db, reana-server (setup.py) -reana-db==0.95.0a2 # via reana-server (setup.py) -redis==5.0.2 # via invenio-accounts, invenio-celery -requests[security]==2.25.0 # via bravado, bravado-core, cachecontrol, cwltool, kubernetes, packtivity, reana-server (setup.py), requests-oauthlib, schema-salad, snakemake, yadage, yadage-schemas +reana-commons[cwl,kubernetes,snakemake,yadage]==0.95.0a2 # via reana-db, reana-server (setup.py) +reana-db==0.95.0a3 # via reana-server (setup.py) +redis==5.0.7 # via invenio-celery +requests[security]==2.32.3 # via bravado, bravado-core, cachecontrol, cwltool, github3-py, kubernetes, packtivity, reana-server (setup.py), requests-oauthlib, schema-salad, snakemake, yadage, yadage-schemas requests-oauthlib==1.1.0 # via flask-oauthlib, invenio-oauth2server, invenio-oauthclient, kubernetes reretry==0.11.8 # via snakemake rfc3987==1.3.8 # via jsonschema +rich==12.6.0 # via flask-limiter rsa==4.9 # via google-auth ruamel-yaml==0.17.10 # via cwltool, schema-salad -ruamel-yaml-clib==0.2.8 # via ruamel-yaml -schema-salad==8.5.20240102191335 # via cwltool +schema-salad==8.5.20240503091721 # via cwltool +sentry-sdk[flask]==1.45.0 # via invenio-logging shellescape==3.8.1 # via cwltool simplejson==3.19.2 # via bravado, bravado-core simplekv==0.14.1 # via flask-kvsession-invenio, invenio-accounts -six==1.16.0 # via asttokens, bravado, bravado-core, flask-breadcrumbs, flask-kvsession-invenio, flask-limiter, flask-menu, flask-talisman, fs, isodate, jsonpath-rw, jsonschema, kubernetes, limits, mock, prov, python-dateutil, rdflib, reana-server (setup.py), sqlalchemy-continuum, wtforms-components -smart-open==7.0.1 # via snakemake +six==1.16.0 # via asttokens, bravado, bravado-core, flask-kvsession-invenio, flask-talisman, fs, isodate, jsonpath-rw, jsonschema, kubernetes, mock, prov, python-dateutil, rdflib, reana-server (setup.py), wtforms-components +smart-open==7.0.4 # via snakemake smmap==5.0.1 # via gitdb snakemake==7.32.4 # via reana-commons -speaklater==1.3 # via flask-babelex -sqlalchemy==1.3.24 # via alembic, flask-alembic, flask-sqlalchemy, invenio-db, reana-db, sqlalchemy-continuum, sqlalchemy-utils, wtforms-alchemy -sqlalchemy-continuum==1.3.15 # via invenio-db +speaklater==1.3 # via flask-security-invenio +sqlalchemy[asyncio]==1.4.52 # via alembic, flask-alembic, flask-sqlalchemy, invenio-db, reana-db, sqlalchemy-continuum, sqlalchemy-utils, wtforms-alchemy +sqlalchemy-continuum==1.4.1 # via invenio-db sqlalchemy-utils[encrypted]==0.38.3 # via invenio-db, reana-db, sqlalchemy-continuum, sqlalchemy-utils, wtforms-alchemy stack-data==0.6.3 # via ipython stopit==1.1.2 # via snakemake strict-rfc3339==0.7 # via jsonschema -swagger-spec-validator==3.0.3 # via bravado-core -tablib==3.5.0 # via reana-server (setup.py) +swagger-spec-validator==3.0.4 # via bravado-core +tablib==3.6.1 # via reana-server (setup.py) tabulate==0.8.10 # via reana-commons, snakemake throttler==1.2.2 # via snakemake toposort==1.10 # via snakemake -traitlets==5.14.1 # via ipython, jupyter-core, matplotlib-inline, nbformat -typing-extensions==4.10.0 # via alembic, bravado, cwltool, ipython, kombu, swagger-spec-validator -tzdata==2024.1 # via backports-zoneinfo, celery +traitlets==5.14.3 # via ipython, jupyter-core, matplotlib-inline, nbformat +typing-extensions==4.12.2 # via alembic, bravado, cwltool, flask-limiter, limits, swagger-spec-validator +tzdata==2024.1 # via celery ua-parser==0.18.0 # via invenio-accounts -uritools==4.0.2 # via invenio-app, invenio-oauthclient -urllib3==1.26.18 # via kubernetes, requests -uwsgi==2.0.24 # via reana-server (setup.py) +uritemplate==4.1.1 # via github3-py, invenio-oauthclient +uritools==4.0.3 # via invenio-app, invenio-oauthclient +urllib3==2.2.2 # via kubernetes, requests, sentry-sdk +uwsgi==2.0.26 # via reana-server (setup.py) uwsgi-tools==1.1.1 # via reana-server (setup.py) -uwsgitop==0.11 # via reana-server (setup.py) -validators==0.22.0 # via wtforms-components +uwsgitop==0.12 # via reana-server (setup.py) +validators==0.31.0 # via wtforms-components vine==5.1.0 # via amqp, celery, kombu watchdog==2.2.1 # via invenio-base wcmatch==8.4.1 # via reana-commons wcwidth==0.2.13 # via prompt-toolkit webargs==5.5.3 # via invenio-rest -webcolors==1.13 # via jsonschema -websocket-client==1.7.0 # via kubernetes -werkzeug==2.0.3 # via flask, flask-kvsession-invenio, invenio-base, reana-commons, reana-server (setup.py) -wrapt==1.16.0 # via smart-open, snakemake -wtforms==2.3.3 # via flask-wtf, invenio-oauth2server, reana-server (setup.py), wtforms-alchemy, wtforms-components +webcolors==24.6.0 # via jsonschema +websocket-client==1.8.0 # via kubernetes +werkzeug==2.2.3 # via flask, flask-kvsession-invenio, flask-login, invenio-base, reana-commons +wrapt==1.16.0 # via deprecated, smart-open, snakemake +wtforms==2.3.3 # via flask-admin, flask-wtf, invenio-oauth2server, reana-server (setup.py), wtforms-alchemy, wtforms-components wtforms-alchemy==0.18.0 # via invenio-oauth2server wtforms-components==0.10.5 # via wtforms-alchemy yadage==0.20.1 # via reana-commons, reana-server (setup.py) yadage-schemas==0.10.6 # via packtivity, reana-commons, reana-server (setup.py), yadage yte==1.5.4 # via snakemake -zipp==3.17.0 # via importlib-metadata, importlib-resources +zipp==3.19.2 # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/scripts/generate_openapi_spec.py b/scripts/generate_openapi_spec.py index ad897640..33f319e6 100644 --- a/scripts/generate_openapi_spec.py +++ b/scripts/generate_openapi_spec.py @@ -20,7 +20,7 @@ from swagger_spec_validator.validator20 import validate_json from reana_server.version import __version__ -from reana_server.app import app +from reana_server.factory import create_minimal_app # Import your marshmallow schemas here # from example_package.schemas import Example_schema, @@ -107,5 +107,6 @@ def build_openapi_spec(publish): if __name__ == "__main__": + app = create_minimal_app() with app.app_context(): build_openapi_spec() diff --git a/setup.py b/setup.py index a400ca37..247661d2 100644 --- a/setup.py +++ b/setup.py @@ -51,18 +51,12 @@ ] install_requires = [ - # These bounds on Flask/Werkzeug are needed because Werkzeug v2.1 removes `safe_str_cmp`, - # which is needed by Flask-Login. This was fixed in Flask-Login v0.6.0 (see the issue - # https://github.com/maxcountryman/flask-login/pull/585), but invenio-accounts<2 - # requires Flask-Login<0.5 - "Flask>=2.1.1,<2.2.0", - "Werkzeug<2.1", - "flask-celeryext<0.5.0", + "Flask>=2.1.1,<2.3.0", # same upper pin as invenio-base "gitpython>=3.1", - "marshmallow>2.13.0,<=2.20.1", + "marshmallow>2.13.0,<3.0.0", "reana-commons[kubernetes,yadage,snakemake,cwl]>=0.95.0a2,<0.96.0", - "reana-db>=0.95.0a2,<0.96.0", - "requests==2.25.0", + "reana-db>=0.95.0a3,<0.96.0", + "requests>=2.25.0", "tablib>=0.12.1", "uWSGI>=2.0.17", "uwsgi-tools>=1.1.1", @@ -76,23 +70,25 @@ "yadage==0.20.1", "yadage-schemas==0.10.6", # Invenio dependencies - "invenio-app>=1.3.0,<1.4.0", - "invenio-base>=1.2.0,<1.3.0", - "invenio-cache>=1.1.0,<1.2.0", - "invenio-config>=1.0.3,<1.1.0", + "invenio-app>=1.5.0", # 1.5 needed for Python 3.12 support + "flask-limiter>=2.3", # dependency of invenio-app, 2.3 needed for Python 3.12 support + "invenio-base>=1.2.0", + "invenio-cache>=1.1.0", + "invenio-config>=1.0.3", # From base bundle - "invenio-logging>=1.3.0,<1.4.0", - "invenio-mail>=1.0.2,<1.1.0", + "invenio-logging>=1.3.0", + "invenio-mail>=1.0.2", # From auth bundle - "invenio-accounts>=1.4.2,<1.5.0", - "invenio-oauth2server>=1.3.0,<1.4.0", - "invenio-oauthclient>=1.5.0,<1.6.0", - "invenio-userprofiles>=1.2.0,<1.3.0", - "invenio-userprofiles>=1.2.0,<1.2.5", # pin <1.2.5 due to import-related changes in upstream - "invenio-theme>=1.4.7,<2.0.0", - "invenio-i18n>=1.3.3,<2.0.0", + "invenio-accounts>=2.0.0", + "invenio-oauth2server>=1.3.0", + "invenio-oauthclient>=1.5.0", + "invenio-userprofiles>=1.2.0", + "invenio-userprofiles>=1.2.0", + "invenio-theme>=1.4.7", + "invenio-i18n>=1.3.3", + "invenio-access>=2.0.0", # Invenio database - "invenio-db[postgresql]>=1.0.5,<1.1.0", + "invenio-db[postgresql]>=1.0.5", "six>=1.12.0", # required by Flask-Breadcrumbs ] @@ -150,7 +146,7 @@ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python", "Programming Language :: Python", diff --git a/tests/conftest.py b/tests/conftest.py index 458f6866..757721e3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -24,7 +24,7 @@ WorkspaceRetentionRuleStatus, ) -from reana_server.factory import create_app +from reana_server.factory import create_minimal_app @pytest.fixture(scope="module") @@ -42,7 +42,7 @@ def base_app(tmp_shared_volume_path): "APP_THEME": None, "THEME_ICONS": None, } - app_ = create_app(config_mapping=config_mapping) + app_ = create_minimal_app(config_mapping=config_mapping) return app_ diff --git a/tests/test_factory.py b/tests/test_factory.py index 19c97e36..eda6ed7a 100644 --- a/tests/test_factory.py +++ b/tests/test_factory.py @@ -8,9 +8,9 @@ """Test factory app.""" -from reana_server.factory import create_app +from reana_server.factory import create_minimal_app def test_create_app(): - """Test create_app() method.""" - create_app() + """Test create_minimal_app() method.""" + create_minimal_app()