--help flag does not work with QUART_APP envvar and create_app factory
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 76/100
調査の方向性
まず quart/cli.py にある Quart CLI のアプリ読み込み経路を読み、特に QUART_APP の読み込み方法と最上位の --help オプションの処理を確認してください。QUART_APP で選択した create_app ファクトリーを使って再現し、--app の場合と比較してください。QUART_APP=run quart --help がインポートエラーなしでヘルプを表示し、報告されているサブコマンドが引き続き動作すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
When using a create_app() factory function, the --help flag does not work with QUART_APP envvar but does work with --app flag. All other quart subcommands work such as 'run'.
Minimal example
Layout
.
├── init.py
├── run.py
└── server.py
server.py
from quart import Quart
def create_app(mode='Development'):
app = Quart(__name__)
print("hello from create_app")
return app
run.py
from .server import create_app
def main():
app = create_app()
app.run()
if __name__ == "__main__":
app.run()
Expected behaviour
% quart --app=run --help
hello from create_app
Usage: quart [OPTIONS] COMMAND [ARGS]...
A general utility script for Quart applications. An application to load must
be given with the '--app' option, 'QUART_APP' environment variable, or with
an 'app.py' file in the current directory.
Options:
-e, --env-file FILE Load environment variables from this file. python-
dotenv must be installed.
-A, --app IMPORT The QUART application or factory function to load, in
the form 'module:name'. Module can be a dotted import
or file path. Name is not required if it is 'app',
'application', 'create_app', or 'make_app', and can be
'name(args)' to pass arguments.
--debug / --no-debug Set 'app.debug' separately from '--env'.
--version Show the Quart version
--help Show this message and exit.
Commands:
routes Show the routes for the app.
run Run a development server.
shell Run a shell in the app context.
% quart --app=run run
hello from create_app
* Serving Quart app 'quarttest.server'
* Debug mode: False
* Please use an ASGI server (e.g. Hypercorn) directly in production
* Running on http://127.0.0.1:5000 (CTRL + C to quit)
Incorrect behaviour
% QUART_APP=run quart --help
Error: While importing 'quarttest.app', an ImportError was raised:
Traceback (most recent call last):
File "/Users/erikmelander/kod/quarttest/venv/lib/python3.11/site-packages/quart/cli.py", line 186, in locate_app
module = import_module(module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'quarttest.app'
Usage: quart [OPTIONS] COMMAND [ARGS]...
A general utility script for Quart applications. An application to load must
be given with the '--app' option, 'QUART_APP' environment variable, or with
an 'app.py' file in the current directory.
Options:
-e, --env-file FILE Load environment variables from this file. python-
dotenv must be installed.
-A, --app IMPORT The QUART application or factory function to load, in
the form 'module:name'. Module can be a dotted import
or file path. Name is not required if it is 'app',
'application', 'create_app', or 'make_app', and can be
'name(args)' to pass arguments.
--debug / --no-debug Set 'app.debug' separately from '--env'.
--version Show the Quart version
--help Show this message and exit.
Commands:
routes Show the routes for the app.
run Run a development server.
shell Run a shell in the app context.
% QUART_APP=run quart run
hello from create_app
* Serving Quart app 'quarttest.server'
* Debug mode: False
* Please use an ASGI server (e.g. Hypercorn) directly in production
* Running on http://127.0.0.1:5000 (CTRL + C to quit)
Environment:
- Python version: 3.11
- Quart version: 0.22.0
- 主要言語
- Python
- スター
- 3.7k
- フォーク
- 209
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pallets/quart のほかの issue
-
`abort` typing doesn't accept Response as a valid parameter対応中かも @touilleMan が 1478 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
-
process_response marks the session accessed, so every response gets Vary: Cookie再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 78/100
-
Installing asgi_app middleware as documented results in type errors再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
-
Allow max content length to be modified on a per-request basis再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
mypy: Blueprint type mismatch with `flask.sansio.blueprints.Blueprint`対応中かも @hrimov が 641 日前に担当しました。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
btclib-org/btclib#3062 ·
メンテナーはふだん 1 日以内に返信
-
area:evals area:infra enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
jse-avl/support-bot#4 · コメント 1 件 ·
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
qte77/agentic-job-offer-to-application-kit#487 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
btclib-org/btclib-wallet#801 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
documentation good first issue
難易度 1/5 1〜3時間 初心者へのやさしさ 94/100