Pinned Flask-Migrate 2.5.3 breaks `flask db current` with alembic 1.16; flask-script pin can no longer be imported

Aperta Adatta ai principianti
#3,147 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
flask, python
Ambito
build-system

Direzione di ricerca

I pin si trovano in pyproject.toml, e requirements.txt viene esportato da questo file, quindi modifica le voci di pyproject e poi esporta di nuovo. Riproduci con i due comandi della issue: import flask_script dovrebbe fallire, e alembic.command.current dovrebbe sollevare un errore su head_only. È completato quando Flask-Migrate è aggiornato alla 2.6.0 o successiva, Flask-Script è rimosso, requirements.txt è rigenerato e entrambi i comandi funzionano in un'installazione pulita.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Environment:

  • CTFd Version/Commit: 3.8.9 / eccab90 (master)
  • Operating System: Windows 11, Python 3.13, pip install -r requirements.txt in a fresh venv
  • Web Browser and Version: N/A

What happened?

Two of the pinned dependencies (pyproject.toml / requirements.txt) don't work with the other pinned versions:

  1. flask-migrate==2.5.3 with alembic==1.16.4: Flask-Migrate 2.5.3's current command calls alembic.command.current(config, verbose=verbose, head_only=head_only), but alembic removed the head_only parameter, so flask db current raises a TypeError. CTFd itself only uses upgrade and stamp, which are fine - this only affects admins running flask db current, e.g. while debugging a migration.

  2. flask-script==2.0.6 with flask==2.1.3: Flask-Script imports flask._compat, which was removed in Flask 2.0, so the package can't be imported at all. This is the error from #2352; that fix removed the import from manage.py, and nothing in CTFd imports flask_script anymore, but it's still pinned.

What did you expect to happen?

All pinned packages to work together.

How to reproduce your issue

In a venv with pip install -r requirements.txt:

python -c "import flask_script"
python -c "import alembic.command as c; c.current(None, verbose=False, head_only=False)"

Any associated stack traces or error logs

ModuleNotFoundError: No module named 'flask._compat'
TypeError: current() got an unexpected keyword argument 'head_only'

Possible fix

  • Bump Flask-Migrate in pyproject.toml to 2.6.0 or later - 2.6.0 stopped passing head_only (2.7.0 is the last 2.x release) - and re-export requirements.txt.
  • Remove Flask-Script from pyproject.toml, since nothing uses it.

Happy to open a PR for either if that's useful.

(Found with pipbreak, a tool I'm building that checks installed packages against each other's installed versions; both findings reproduced by hand as above.)

Lingua principale
Python
Stelle
6.9k
Fork
2.8k
Merge medio
2g 2h
PR unite (30g)
14

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di CTFd/CTFd

Tutte le issue di CTFd/CTFd

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.