6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-11-10 23:30:59 +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:
#
# pip-compile requirements/base.in
@ -12,26 +12,28 @@ certifi==2023.7.22
# via
# kubernetes
# requests
charset-normalizer==3.1.0
charset-normalizer==3.2.0
# via requests
click==8.1.3
click==8.1.7
# via -r requirements/base.in
google-auth==2.19.1
google-auth==2.22.0
# via kubernetes
idna==3.4
# via requests
jinja2==3.1.2
# via -r requirements/base.in
kubernetes==26.1.0
kubernetes==27.2.0
# via -r requirements/base.in
markupsafe==2.1.3
# via jinja2
mypy==1.3.0
mypy==1.5.1
# via -r requirements/base.in
mypy-extensions==1.0.0
# via mypy
oauthlib==3.2.2
# via requests-oauthlib
# via
# kubernetes
# requests-oauthlib
pyasn1==0.5.0
# via
# pyasn1-modules
@ -42,7 +44,7 @@ pycryptodome==3.18.0
# via -r requirements/base.in
python-dateutil==2.8.2
# via kubernetes
pyyaml==6.0
pyyaml==6.0.1
# via
# -r requirements/base.in
# kubernetes
@ -61,7 +63,7 @@ six==1.16.0
# python-dateutil
tomli==2.0.1
# via mypy
typing-extensions==4.6.3
typing-extensions==4.7.1
# via
# -r requirements/base.in
# mypy
@ -70,8 +72,5 @@ urllib3==1.26.16
# google-auth
# kubernetes
# requests
websocket-client==1.5.2
websocket-client==1.6.2
# via kubernetes
# The following packages are considered to be unsafe in a requirements file:
# setuptools

View File

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

View File

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

View File

@ -32,7 +32,7 @@ def main() -> None:
sys.exit(1)
class TutorCli(click.MultiCommand):
class TutorCli(click.Group):
"""
Dynamically load subcommands at runtime.
@ -43,26 +43,14 @@ class TutorCli(click.MultiCommand):
IS_ROOT_READY = False
@classmethod
def iter_commands(cls, ctx: click.Context) -> t.Iterator[click.Command]:
def get_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)
yield from hooks.Filters.CLI_COMMANDS.iterate()
@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
self.ensure_plugins_enabled(ctx)
return super().get_command(ctx, cmd_name=cmd_name)
def list_commands(self, ctx: click.Context) -> list[str]:
"""
@ -70,20 +58,22 @@ class TutorCli(click.MultiCommand):
- shell autocompletion: tutor <tab>
- print help: tutor, tutor -h
"""
return sorted(
[command.name or "<undefined>" for command in self.iter_commands(ctx)]
)
self.ensure_plugins_enabled(ctx)
return super().list_commands(ctx)
def get_command(
self, ctx: click.Context, cmd_name: str
) -> t.Optional[click.Command]:
def ensure_plugins_enabled(self, ctx: click.Context) -> None:
"""
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 cmd_name == command.name:
return command
return None
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 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(