6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-11-11 07:41:02 +00:00

Merge remote-tracking branch 'origin/master' into nightly

This commit is contained in:
Overhang.IO 2023-08-29 14:29:15 +00:00
commit 14dfc82a48
6 changed files with 100 additions and 102 deletions

View File

@ -1,5 +1,5 @@
# #
# This file is autogenerated by pip-compile with Python 3.10 # This file is autogenerated by pip-compile with Python 3.8
# by the following command: # by the following command:
# #
# pip-compile requirements/base.in # pip-compile requirements/base.in
@ -12,26 +12,28 @@ certifi==2023.7.22
# via # via
# kubernetes # kubernetes
# requests # requests
charset-normalizer==3.1.0 charset-normalizer==3.2.0
# via requests # via requests
click==8.1.3 click==8.1.7
# via -r requirements/base.in # via -r requirements/base.in
google-auth==2.19.1 google-auth==2.22.0
# via kubernetes # via kubernetes
idna==3.4 idna==3.4
# via requests # via requests
jinja2==3.1.2 jinja2==3.1.2
# via -r requirements/base.in # via -r requirements/base.in
kubernetes==26.1.0 kubernetes==27.2.0
# via -r requirements/base.in # via -r requirements/base.in
markupsafe==2.1.3 markupsafe==2.1.3
# via jinja2 # via jinja2
mypy==1.3.0 mypy==1.5.1
# via -r requirements/base.in # via -r requirements/base.in
mypy-extensions==1.0.0 mypy-extensions==1.0.0
# via mypy # via mypy
oauthlib==3.2.2 oauthlib==3.2.2
# via requests-oauthlib # via
# kubernetes
# requests-oauthlib
pyasn1==0.5.0 pyasn1==0.5.0
# via # via
# pyasn1-modules # pyasn1-modules
@ -42,7 +44,7 @@ pycryptodome==3.18.0
# via -r requirements/base.in # via -r requirements/base.in
python-dateutil==2.8.2 python-dateutil==2.8.2
# via kubernetes # via kubernetes
pyyaml==6.0 pyyaml==6.0.1
# via # via
# -r requirements/base.in # -r requirements/base.in
# kubernetes # kubernetes
@ -61,7 +63,7 @@ six==1.16.0
# python-dateutil # python-dateutil
tomli==2.0.1 tomli==2.0.1
# via mypy # via mypy
typing-extensions==4.6.3 typing-extensions==4.7.1
# via # via
# -r requirements/base.in # -r requirements/base.in
# mypy # mypy
@ -70,8 +72,5 @@ urllib3==1.26.16
# google-auth # google-auth
# kubernetes # kubernetes
# requests # requests
websocket-client==1.5.2 websocket-client==1.6.2
# via kubernetes # via kubernetes
# The following packages are considered to be unsafe in a requirements file:
# setuptools

View File

@ -7,10 +7,6 @@ pyinstaller
scriv scriv
twine twine
# doc requirement is lagging behind
# https://github.com/readthedocs/sphinx_rtd_theme/issues/1323
docutils<0.19
# Types packages # Types packages
types-docutils types-docutils
types-PyYAML types-PyYAML

View File

@ -1,5 +1,5 @@
# #
# This file is autogenerated by pip-compile with Python 3.10 # This file is autogenerated by pip-compile with Python 3.8
# by the following command: # by the following command:
# #
# pip-compile requirements/dev.in # pip-compile requirements/dev.in
@ -8,11 +8,11 @@ altgraph==0.17.3
# via pyinstaller # via pyinstaller
appdirs==1.4.4 appdirs==1.4.4
# via -r requirements/base.txt # via -r requirements/base.txt
astroid==2.15.5 astroid==2.15.6
# via pylint # via pylint
attrs==23.1.0 attrs==23.1.0
# via scriv # via scriv
black==23.3.0 black==23.7.0
# via -r requirements/dev.in # via -r requirements/dev.in
bleach==6.0.0 bleach==6.0.0
# via readme-renderer # via readme-renderer
@ -29,11 +29,11 @@ certifi==2023.7.22
# requests # requests
cffi==1.15.1 cffi==1.15.1
# via cryptography # via cryptography
charset-normalizer==3.1.0 charset-normalizer==3.2.0
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# requests # requests
click==8.1.3 click==8.1.7
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# black # black
@ -42,17 +42,15 @@ click==8.1.3
# scriv # scriv
click-log==0.4.0 click-log==0.4.0
# via scriv # via scriv
coverage==7.2.7 coverage==7.3.0
# via -r requirements/dev.in # via -r requirements/dev.in
cryptography==41.0.3 cryptography==41.0.3
# via secretstorage # via secretstorage
dill==0.3.6 dill==0.3.7
# via pylint # via pylint
docutils==0.18.1 docutils==0.20.1
# via # via readme-renderer
# -r requirements/dev.in google-auth==2.22.0
# readme-renderer
google-auth==2.19.1
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# kubernetes # kubernetes
@ -60,13 +58,15 @@ idna==3.4
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# requests # requests
importlib-metadata==6.6.0 importlib-metadata==6.8.0
# via # via
# keyring # keyring
# twine # twine
importlib-resources==6.0.1
# via keyring
isort==5.12.0 isort==5.12.0
# via pylint # via pylint
jaraco-classes==3.2.3 jaraco-classes==3.3.0
# via keyring # via keyring
jeepney==0.8.0 jeepney==0.8.0
# via # via
@ -76,13 +76,13 @@ jinja2==3.1.2
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# scriv # scriv
keyring==23.13.1 keyring==24.2.0
# via twine # via twine
kubernetes==26.1.0 kubernetes==27.2.0
# via -r requirements/base.txt # via -r requirements/base.txt
lazy-object-proxy==1.9.0 lazy-object-proxy==1.9.0
# via astroid # via astroid
markdown-it-py==2.2.0 markdown-it-py==3.0.0
# via rich # via rich
markupsafe==2.1.3 markupsafe==2.1.3
# via # via
@ -92,9 +92,9 @@ mccabe==0.7.0
# via pylint # via pylint
mdurl==0.1.2 mdurl==0.1.2
# via markdown-it-py # via markdown-it-py
more-itertools==9.1.0 more-itertools==10.1.0
# via jaraco-classes # via jaraco-classes
mypy==1.3.0 mypy==1.5.1
# via -r requirements/base.txt # via -r requirements/base.txt
mypy-extensions==1.0.0 mypy-extensions==1.0.0
# via # via
@ -104,18 +104,19 @@ mypy-extensions==1.0.0
oauthlib==3.2.2 oauthlib==3.2.2
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# kubernetes
# requests-oauthlib # requests-oauthlib
packaging==23.1 packaging==23.1
# via # via
# black # black
# build # build
pathspec==0.11.1 pathspec==0.11.2
# via black # via black
pip-tools==6.13.0 pip-tools==7.3.0
# via -r requirements/dev.in # via -r requirements/dev.in
pkginfo==1.9.6 pkginfo==1.9.6
# via twine # via twine
platformdirs==3.5.1 platformdirs==3.10.0
# via # via
# black # black
# pylint # pylint
@ -132,15 +133,15 @@ pycparser==2.21
# via cffi # via cffi
pycryptodome==3.18.0 pycryptodome==3.18.0
# via -r requirements/base.txt # via -r requirements/base.txt
pygments==2.15.1 pygments==2.16.1
# via # via
# readme-renderer # readme-renderer
# rich # rich
pyinstaller==5.11.0 pyinstaller==5.13.1
# via -r requirements/dev.in # via -r requirements/dev.in
pyinstaller-hooks-contrib==2023.3 pyinstaller-hooks-contrib==2023.7
# via pyinstaller # via pyinstaller
pylint==2.17.4 pylint==2.17.5
# via -r requirements/dev.in # via -r requirements/dev.in
pyproject-hooks==1.0.0 pyproject-hooks==1.0.0
# via build # via build
@ -148,11 +149,11 @@ python-dateutil==2.8.2
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# kubernetes # kubernetes
pyyaml==6.0 pyyaml==6.0.1
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# kubernetes # kubernetes
readme-renderer==37.3 readme-renderer==41.0
# via twine # via twine
requests==2.31.0 requests==2.31.0
# via # via
@ -170,7 +171,7 @@ requests-toolbelt==1.0.0
# via twine # via twine
rfc3986==2.0.0 rfc3986==2.0.0
# via twine # via twine
rich==13.4.1 rich==13.5.2
# via twine # via twine
rsa==4.9 rsa==4.9
# via # via
@ -193,23 +194,27 @@ tomli==2.0.1
# black # black
# build # build
# mypy # mypy
# pip-tools
# pylint # pylint
# pyproject-hooks # pyproject-hooks
tomlkit==0.11.8 tomlkit==0.12.1
# via pylint # via pylint
twine==4.0.2 twine==4.0.2
# via -r requirements/dev.in # via -r requirements/dev.in
types-docutils==0.20.0.1 types-docutils==0.20.0.3
# via -r requirements/dev.in # via -r requirements/dev.in
types-pyyaml==6.0.12.10 types-pyyaml==6.0.12.11
# via -r requirements/dev.in # via -r requirements/dev.in
types-setuptools==67.8.0.0 types-setuptools==68.1.0.0
# via -r requirements/dev.in # via -r requirements/dev.in
typing-extensions==4.6.3 typing-extensions==4.7.1
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# astroid # astroid
# black
# mypy # mypy
# pylint
# rich
urllib3==1.26.16 urllib3==1.26.16
# via # via
# -r requirements/base.txt # -r requirements/base.txt
@ -219,16 +224,18 @@ urllib3==1.26.16
# twine # twine
webencodings==0.5.1 webencodings==0.5.1
# via bleach # via bleach
websocket-client==1.5.2 websocket-client==1.6.2
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# kubernetes # kubernetes
wheel==0.40.0 wheel==0.41.2
# via pip-tools # via pip-tools
wrapt==1.15.0 wrapt==1.15.0
# via astroid # via astroid
zipp==3.15.0 zipp==3.16.2
# via importlib-metadata # via
# importlib-metadata
# importlib-resources
# The following packages are considered to be unsafe in a requirements file: # The following packages are considered to be unsafe in a requirements file:
# pip # pip

View File

@ -1,4 +1,6 @@
-r base.txt -r base.txt
sphinx # Python 3.8 support was dropped in 7.2.0
# https://github.com/sphinx-doc/sphinx/pull/11511
sphinx<7.2.0
sphinx-rtd-theme sphinx-rtd-theme
sphinx-click sphinx-click

View File

@ -1,5 +1,5 @@
# #
# This file is autogenerated by pip-compile with Python 3.10 # This file is autogenerated by pip-compile with Python 3.8
# by the following command: # by the following command:
# #
# pip-compile requirements/docs.in # pip-compile requirements/docs.in
@ -19,11 +19,11 @@ certifi==2023.7.22
# -r requirements/base.txt # -r requirements/base.txt
# kubernetes # kubernetes
# requests # requests
charset-normalizer==3.1.0 charset-normalizer==3.2.0
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# requests # requests
click==8.1.3 click==8.1.7
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# sphinx-click # sphinx-click
@ -32,7 +32,7 @@ docutils==0.18.1
# sphinx # sphinx
# sphinx-click # sphinx-click
# sphinx-rtd-theme # sphinx-rtd-theme
google-auth==2.19.1 google-auth==2.22.0
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# kubernetes # kubernetes
@ -42,17 +42,19 @@ idna==3.4
# requests # requests
imagesize==1.4.1 imagesize==1.4.1
# via sphinx # via sphinx
importlib-metadata==6.8.0
# via sphinx
jinja2==3.1.2 jinja2==3.1.2
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# sphinx # sphinx
kubernetes==26.1.0 kubernetes==27.2.0
# via -r requirements/base.txt # via -r requirements/base.txt
markupsafe==2.1.3 markupsafe==2.1.3
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# jinja2 # jinja2
mypy==1.3.0 mypy==1.5.1
# via -r requirements/base.txt # via -r requirements/base.txt
mypy-extensions==1.0.0 mypy-extensions==1.0.0
# via # via
@ -61,6 +63,7 @@ mypy-extensions==1.0.0
oauthlib==3.2.2 oauthlib==3.2.2
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# kubernetes
# requests-oauthlib # requests-oauthlib
packaging==23.1 packaging==23.1
# via sphinx # via sphinx
@ -75,13 +78,15 @@ pyasn1-modules==0.3.0
# google-auth # google-auth
pycryptodome==3.18.0 pycryptodome==3.18.0
# via -r requirements/base.txt # via -r requirements/base.txt
pygments==2.15.1 pygments==2.16.1
# via sphinx # via sphinx
python-dateutil==2.8.2 python-dateutil==2.8.2
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# kubernetes # kubernetes
pyyaml==6.0 pytz==2023.3
# via babel
pyyaml==6.0.1
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# kubernetes # kubernetes
@ -107,15 +112,15 @@ six==1.16.0
# python-dateutil # python-dateutil
snowballstemmer==2.2.0 snowballstemmer==2.2.0
# via sphinx # via sphinx
sphinx==6.2.1 sphinx==7.1.2
# via # via
# -r requirements/docs.in # -r requirements/docs.in
# sphinx-click # sphinx-click
# sphinx-rtd-theme # sphinx-rtd-theme
# sphinxcontrib-jquery # sphinxcontrib-jquery
sphinx-click==4.4.0 sphinx-click==5.0.1
# via -r requirements/docs.in # via -r requirements/docs.in
sphinx-rtd-theme==1.2.1 sphinx-rtd-theme==1.3.0
# via -r requirements/docs.in # via -r requirements/docs.in
sphinxcontrib-applehelp==1.0.4 sphinxcontrib-applehelp==1.0.4
# via sphinx # via sphinx
@ -135,7 +140,7 @@ tomli==2.0.1
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# mypy # mypy
typing-extensions==4.6.3 typing-extensions==4.7.1
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# mypy # mypy
@ -145,10 +150,9 @@ urllib3==1.26.16
# google-auth # google-auth
# kubernetes # kubernetes
# requests # requests
websocket-client==1.5.2 websocket-client==1.6.2
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# kubernetes # kubernetes
zipp==3.16.2
# The following packages are considered to be unsafe in a requirements file: # via importlib-metadata
# setuptools

View File

@ -32,7 +32,7 @@ def main() -> None:
sys.exit(1) sys.exit(1)
class TutorCli(click.MultiCommand): class TutorCli(click.Group):
""" """
Dynamically load subcommands at runtime. Dynamically load subcommands at runtime.
@ -43,26 +43,14 @@ class TutorCli(click.MultiCommand):
IS_ROOT_READY = False IS_ROOT_READY = False
@classmethod def get_command(
def iter_commands(cls, ctx: click.Context) -> t.Iterator[click.Command]: self, ctx: click.Context, cmd_name: str
) -> t.Optional[click.Command]:
""" """
Return the list of subcommands (click.Command). This is run when passing a command from the CLI. E.g: tutor config ...
""" """
cls.ensure_plugins_enabled(ctx) self.ensure_plugins_enabled(ctx)
yield from hooks.Filters.CLI_COMMANDS.iterate() return super().get_command(ctx, cmd_name=cmd_name)
@classmethod
def ensure_plugins_enabled(cls, ctx: click.Context) -> None:
"""
We enable plugins as soon as possible to have access to commands.
"""
if not "root" in ctx.params:
# When generating docs, this function is called with empty args.
# That's ok, we just ignore it.
return
if not cls.IS_ROOT_READY:
hooks.Actions.PROJECT_ROOT_READY.do(ctx.params["root"])
cls.IS_ROOT_READY = True
def list_commands(self, ctx: click.Context) -> list[str]: def list_commands(self, ctx: click.Context) -> list[str]:
""" """
@ -70,20 +58,22 @@ class TutorCli(click.MultiCommand):
- shell autocompletion: tutor <tab> - shell autocompletion: tutor <tab>
- print help: tutor, tutor -h - print help: tutor, tutor -h
""" """
return sorted( self.ensure_plugins_enabled(ctx)
[command.name or "<undefined>" for command in self.iter_commands(ctx)] return super().list_commands(ctx)
)
def get_command( def ensure_plugins_enabled(self, ctx: click.Context) -> None:
self, ctx: click.Context, cmd_name: str
) -> t.Optional[click.Command]:
""" """
This is run when passing a command from the CLI. E.g: tutor config ... We enable plugins as soon as possible to have access to commands.
""" """
for command in self.iter_commands(ctx): if not "root" in ctx.params:
if cmd_name == command.name: # When generating docs, this function is called with empty args.
return command # That's ok, we just ignore it.
return None return
if not self.IS_ROOT_READY:
hooks.Actions.PROJECT_ROOT_READY.do(ctx.params["root"])
self.IS_ROOT_READY = True
for cmd in hooks.Filters.CLI_COMMANDS.iterate():
self.add_command(cmd)
@click.group( @click.group(