AppGroup Class — flask Architecture
Architecture documentation for the AppGroup class in cli.py from the flask codebase.
Entity Profile
Dependency Diagram
graph TD ea63e19e_2fd3_885d_2922_e4101fe8320a["AppGroup"] ea63e19e_2fd3_885d_2922_e4101fe8320a["AppGroup"] ea63e19e_2fd3_885d_2922_e4101fe8320a -->|extends| ea63e19e_2fd3_885d_2922_e4101fe8320a a96499c3_f8a9_e782_f156_1c1ee4a86c69["cli.py"] ea63e19e_2fd3_885d_2922_e4101fe8320a -->|defined in| a96499c3_f8a9_e782_f156_1c1ee4a86c69 f688268e_280f_36e3_281d_55ae0a492f60["command()"] ea63e19e_2fd3_885d_2922_e4101fe8320a -->|method| f688268e_280f_36e3_281d_55ae0a492f60 ee579b57_7cc9_3b94_0c8f_257dc43b9fe3["group()"] ea63e19e_2fd3_885d_2922_e4101fe8320a -->|method| ee579b57_7cc9_3b94_0c8f_257dc43b9fe3
Relationship Graph
Source Code
src/flask/cli.py lines 405–437
class AppGroup(click.Group):
"""This works similar to a regular click :class:`~click.Group` but it
changes the behavior of the :meth:`command` decorator so that it
automatically wraps the functions in :func:`with_appcontext`.
Not to be confused with :class:`FlaskGroup`.
"""
def command( # type: ignore[override]
self, *args: t.Any, **kwargs: t.Any
) -> t.Callable[[t.Callable[..., t.Any]], click.Command]:
"""This works exactly like the method of the same name on a regular
:class:`click.Group` but it wraps callbacks in :func:`with_appcontext`
unless it's disabled by passing ``with_appcontext=False``.
"""
wrap_for_ctx = kwargs.pop("with_appcontext", True)
def decorator(f: t.Callable[..., t.Any]) -> click.Command:
if wrap_for_ctx:
f = with_appcontext(f)
return super(AppGroup, self).command(*args, **kwargs)(f) # type: ignore[no-any-return]
return decorator
def group( # type: ignore[override]
self, *args: t.Any, **kwargs: t.Any
) -> t.Callable[[t.Callable[..., t.Any]], click.Group]:
"""This works exactly like the method of the same name on a regular
:class:`click.Group` but it defaults the group class to
:class:`AppGroup`.
"""
kwargs.setdefault("cls", AppGroup)
return super().group(*args, **kwargs) # type: ignore[no-any-return]
Domain
Defined In
Extends
Source
Frequently Asked Questions
What is the AppGroup class?
AppGroup is a class in the flask codebase, defined in src/flask/cli.py.
Where is AppGroup defined?
AppGroup is defined in src/flask/cli.py at line 405.
What does AppGroup extend?
AppGroup extends AppGroup.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free