tutor 23.0.0.dev3234__tar.gz → 23.0.0.dev3238__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/PKG-INFO +1 -1
  2. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/commands/cli.py +51 -3
  3. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/commands/config.py +2 -1
  4. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/commands/context.py +21 -1
  5. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/commands/plugins.py +2 -1
  6. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/hooks/catalog.py +9 -0
  7. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/plugins/__init__.py +2 -1
  8. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/build/openedx/Dockerfile +27 -14
  9. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/.gitignore +0 -0
  10. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/.hatch_build.py +0 -0
  11. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/LICENSE.txt +0 -0
  12. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/README.rst +0 -0
  13. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/pyproject.toml +0 -0
  14. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/requirements/base.in +0 -0
  15. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/requirements/dev.txt +0 -0
  16. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/requirements/plugins.txt +0 -0
  17. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/__about__.py +0 -0
  18. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/__init__.py +0 -0
  19. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/bindmount.py +0 -0
  20. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/commands/__init__.py +0 -0
  21. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/commands/compose.py +0 -0
  22. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/commands/dev.py +0 -0
  23. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/commands/images.py +0 -0
  24. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/commands/jobs.py +0 -0
  25. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/commands/jobs_utils.py +0 -0
  26. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/commands/k8s.py +0 -0
  27. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/commands/local.py +0 -0
  28. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/commands/mounts.py +0 -0
  29. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/commands/params.py +0 -0
  30. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/commands/upgrade/__init__.py +0 -0
  31. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/commands/upgrade/common.py +0 -0
  32. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/commands/upgrade/compose.py +0 -0
  33. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/commands/upgrade/k8s.py +0 -0
  34. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/config.py +0 -0
  35. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/core/__init__.py +0 -0
  36. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/core/hooks/__init__.py +0 -0
  37. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/core/hooks/actions.py +0 -0
  38. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/core/hooks/contexts.py +0 -0
  39. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/core/hooks/filters.py +0 -0
  40. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/core/hooks/priorities.py +0 -0
  41. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/env.py +0 -0
  42. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/exceptions.py +0 -0
  43. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/fmt.py +0 -0
  44. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/hooks/__init__.py +0 -0
  45. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/images.py +0 -0
  46. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/interactive.py +0 -0
  47. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/plugins/base.py +0 -0
  48. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/plugins/indexes.py +0 -0
  49. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/plugins/openedx.py +0 -0
  50. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/plugins/v0.py +0 -0
  51. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/plugins/v1.py +0 -0
  52. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/py.typed +0 -0
  53. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/serialize.py +0 -0
  54. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/tasks.py +0 -0
  55. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/caddy/Caddyfile +0 -0
  56. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/openedx/config/cms.env.yml +0 -0
  57. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/openedx/config/lms.env.yml +0 -0
  58. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/openedx/config/partials/auth.yml +0 -0
  59. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/openedx/granian-config +0 -0
  60. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/openedx/settings/cms/__init__.py +0 -0
  61. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/openedx/settings/cms/development.py +0 -0
  62. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/openedx/settings/cms/production.py +0 -0
  63. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/openedx/settings/cms/test.py +0 -0
  64. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/openedx/settings/lms/__init__.py +0 -0
  65. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/openedx/settings/lms/development.py +0 -0
  66. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/openedx/settings/lms/production.py +0 -0
  67. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/openedx/settings/lms/test.py +0 -0
  68. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/openedx/settings/partials/common_all.py +0 -0
  69. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/openedx/settings/partials/common_cms.py +0 -0
  70. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/openedx/settings/partials/common_lms.py +0 -0
  71. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/openedx/settings/partials/common_test.py +0 -0
  72. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/permissions/fix-volume-permissions.sh +0 -0
  73. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/permissions/setowners.sh +0 -0
  74. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/apps/redis/redis.conf +0 -0
  75. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/build/openedx/bin/reload-granian +0 -0
  76. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/build/openedx/bin/run-granian +0 -0
  77. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/build/openedx/bin/wait-for-tcp +0 -0
  78. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/build/openedx/revisions.yml +0 -0
  79. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/build/openedx/settings/cms/__init__.py +0 -0
  80. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/build/openedx/settings/cms/assets.py +0 -0
  81. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/build/openedx/settings/cms/i18n.py +0 -0
  82. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/build/openedx/settings/granian-config +0 -0
  83. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/build/openedx/settings/lms/__init__.py +0 -0
  84. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/build/openedx/settings/lms/assets.py +0 -0
  85. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/build/openedx/settings/lms/i18n.py +0 -0
  86. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/build/openedx/settings/partials/assets.py +0 -0
  87. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/build/openedx/settings/partials/i18n.py +0 -0
  88. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/build/openedx/themes/README +0 -0
  89. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/build/permissions/Dockerfile +0 -0
  90. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/build/permissions/setowner.sh +0 -0
  91. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/config/base.yml +0 -0
  92. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/config/defaults.yml +0 -0
  93. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/dev/docker-compose.jobs.yml +0 -0
  94. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/dev/docker-compose.yml +0 -0
  95. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/jobs/init/cms.sh +0 -0
  96. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/jobs/init/lms.sh +0 -0
  97. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/jobs/init/meilisearch.sh +0 -0
  98. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/jobs/init/mounted-directories.sh +0 -0
  99. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/jobs/init/mysql.sh +0 -0
  100. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/k8s/deployments.yml +0 -0
  101. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/k8s/jobs.yml +0 -0
  102. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/k8s/namespace.yml +0 -0
  103. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/k8s/override.yml +0 -0
  104. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/k8s/services.yml +0 -0
  105. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/k8s/volumes.yml +0 -0
  106. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/kustomization.yml +0 -0
  107. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/local/docker-compose.jobs.yml +0 -0
  108. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/local/docker-compose.prod.yml +0 -0
  109. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/local/docker-compose.yml +0 -0
  110. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/templates/version +0 -0
  111. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/types.py +0 -0
  112. {tutor-23.0.0.dev3234 → tutor-23.0.0.dev3238}/tutor/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tutor
3
- Version: 23.0.0.dev3234
3
+ Version: 23.0.0.dev3238
4
4
  Summary: The Docker-based Open edX distribution designed for peace of mind
5
5
  Project-URL: Homepage, https://docs.tutor.edly.io/
6
6
  Project-URL: Documentation, https://docs.tutor.edly.io/
@@ -9,7 +9,7 @@ import click
9
9
  from tutor import exceptions, fmt, hooks, utils
10
10
  from tutor.__about__ import __app__, __version__
11
11
  from tutor.commands.config import config_command
12
- from tutor.commands.context import Context
12
+ from tutor.commands.context import Context, ignore_plugin_errors
13
13
  from tutor.commands.dev import dev
14
14
  from tutor.commands.images import images_command
15
15
  from tutor.commands.k8s import k8s
@@ -32,6 +32,41 @@ def main() -> None:
32
32
  sys.exit(1)
33
33
 
34
34
 
35
+ def check_plugin_errors(context: click.Context) -> None:
36
+ """
37
+ Check for plugin loading errors and exit with code 1 if any were found,
38
+ unless --ignore-plugin-errors is set.
39
+ """
40
+ errors: list[tuple[str, str]] = list(hooks.Filters.PLUGIN_ERRORS.iterate())
41
+ if not errors or context.invoked_subcommand is None:
42
+ return
43
+ # This is done to narrow the type. This function is only called from a one
44
+ # place which is always a group.
45
+ assert isinstance(context.command, click.Group)
46
+ subcommand = context.command.get_command(context, context.invoked_subcommand)
47
+ ignore = context.obj.ignore_plugin_errors or getattr(
48
+ subcommand, "ignore_plugin_errors", False
49
+ )
50
+
51
+ for plugin, error in errors:
52
+ if ignore:
53
+ fmt.echo_alert(f"Failed to enable plugin '{plugin}': {error}")
54
+ else:
55
+ fmt.echo_error(f"Plugin '{plugin}' failed to load: {error}")
56
+ # Only exit with an error code if:
57
+ # - errors are not being ignored
58
+ # - no exception has already been raised that would return its own error code
59
+ if ignore:
60
+ return
61
+ match sys.exc_info()[1]:
62
+ case None:
63
+ sys.exit(1)
64
+ case SystemExit(code=code) | click.exceptions.Exit(exit_code=code) if code == 0:
65
+ sys.exit(1)
66
+ case _:
67
+ return
68
+
69
+
35
70
  class TutorCli(click.Group):
36
71
  """
37
72
  Dynamically load subcommands at runtime.
@@ -99,20 +134,33 @@ class TutorCli(click.Group):
99
134
  is_flag=True,
100
135
  help="Print this help",
101
136
  )
137
+ @click.option(
138
+ "--ignore-plugin-errors",
139
+ "ignore_plugin_errors",
140
+ is_flag=True,
141
+ default=False,
142
+ help="Continue running even if plugin loading fails",
143
+ )
102
144
  @click.pass_context
103
- def cli(context: click.Context, root: str, show_help: bool) -> None:
145
+ def cli(
146
+ context: click.Context, root: str, show_help: bool, ignore_plugin_errors: bool
147
+ ) -> None:
104
148
  if utils.is_root():
105
149
  fmt.echo_alert(
106
150
  "You are running Tutor as root. This is strongly not recommended. If you are doing this in order to access"
107
151
  " the Docker daemon, you should instead add your user to the 'docker' group. (see https://docs.docker.com"
108
152
  "/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user)"
109
153
  )
110
- context.obj = Context(root)
154
+ context.obj = Context(root, ignore_plugin_errors)
111
155
  context.help_option_names = ["-h", "--help"]
156
+
157
+ check_plugin_errors(context)
158
+
112
159
  if context.invoked_subcommand is None or show_help:
113
160
  click.echo(context.get_help())
114
161
 
115
162
 
163
+ @ignore_plugin_errors
116
164
  @click.command(help="Print this help", name="help")
117
165
  @click.pass_context
118
166
  def help_command(context: click.Context) -> None:
@@ -11,11 +11,12 @@ import click.shell_completion
11
11
  from tutor import config as tutor_config
12
12
  from tutor import env, exceptions, fmt, hooks, serialize, utils
13
13
  from tutor import interactive as interactive_config
14
- from tutor.commands.context import Context
14
+ from tutor.commands.context import Context, ignore_plugin_errors
15
15
  from tutor.commands.params import ConfigLoaderParam, ParamValue
16
16
  from tutor.types import Config, ConfigValue
17
17
 
18
18
 
19
+ @ignore_plugin_errors
19
20
  @click.group(
20
21
  name="config",
21
22
  short_help="Configure Open edX",
@@ -1,3 +1,7 @@
1
+ from typing import TypeVar
2
+
3
+ import click
4
+
1
5
  from tutor.tasks import BaseTaskRunner
2
6
  from tutor.types import Config
3
7
 
@@ -12,8 +16,9 @@ class Context:
12
16
  $ tutor --root=... local run ...
13
17
  """
14
18
 
15
- def __init__(self, root: str) -> None:
19
+ def __init__(self, root: str, ignore_plugin_errors: bool = False) -> None:
16
20
  self.root = root
21
+ self.ignore_plugin_errors = ignore_plugin_errors
17
22
 
18
23
 
19
24
  class BaseTaskContext(Context):
@@ -28,3 +33,18 @@ class BaseTaskContext(Context):
28
33
  Return a runner capable of running docker-compose/kubectl commands.
29
34
  """
30
35
  raise NotImplementedError
36
+
37
+
38
+ CMD = TypeVar("CMD", bound=click.Command)
39
+
40
+
41
+ def ignore_plugin_errors(command: CMD) -> CMD:
42
+ """
43
+ Ignore plugins errors for commands marked with this.
44
+
45
+ Commands decorated with this will run even if there were errors when loading
46
+ plugins. This needs to be the first decorator and only works for top-level
47
+ command, exempting all subcommands.
48
+ """
49
+ setattr(command, "ignore_plugin_errors", True)
50
+ return command
@@ -16,7 +16,7 @@ from tutor.plugins import indexes
16
16
  from tutor.plugins.base import PLUGINS_ROOT, PLUGINS_ROOT_ENV_VAR_NAME
17
17
  from tutor.types import Config
18
18
 
19
- from .context import Context
19
+ from .context import Context, ignore_plugin_errors
20
20
 
21
21
 
22
22
  class PluginName(click.ParamType[str]):
@@ -74,6 +74,7 @@ class IndexPluginNameOrLocation(IndexPluginName):
74
74
  return autocompleted
75
75
 
76
76
 
77
+ @ignore_plugin_errors
77
78
  @click.group(
78
79
  name="plugins",
79
80
  short_help="Manage Tutor plugins",
@@ -479,6 +479,15 @@ class Filters:
479
479
  #: regular expression. For instance: ``("openedx", r".*xblock.*")``.
480
480
  MOUNTED_DIRECTORIES: Filter[list[tuple[str, str]], []] = Filter()
481
481
 
482
+ #: List of plugins that failed to load, along with the corresponding error
483
+ #: message. This filter is populated by `tutor.plugins.load_all` when a
484
+ #: plugin raises an exception during loading. It is consumed by the CLI to
485
+ #: report errors after the subcommand has finished.
486
+ #:
487
+ #: :parameter list[tuple[str, str]] errors: list of ``(plugin_name, error_message)``
488
+ #: tuples.
489
+ PLUGIN_ERRORS: Filter[list[tuple[str, str]], []] = Filter()
490
+
482
491
  #: List of plugin indexes that are loaded when we run ``tutor plugins update``. By
483
492
  #: default, the plugin indexes are stored in the user configuration. This filter makes
484
493
  #: it possible to extend and modify this list with plugins.
@@ -61,7 +61,8 @@ def load_all(names: t.Iterable[str]) -> None:
61
61
  try:
62
62
  load(name)
63
63
  except Exception as e:
64
- fmt.echo_alert(f"Failed to enable plugin '{name}': {e}")
64
+ with hooks.Contexts.PLUGINS.enter():
65
+ hooks.Filters.PLUGIN_ERRORS.add_item((name, str(e)))
65
66
  hooks.Actions.PLUGINS_LOADED.do()
66
67
 
67
68
 
@@ -17,6 +17,16 @@ ENV LC_ALL=en_US.UTF-8
17
17
  COPY --from=ghcr.io/astral-sh/uv:0.13.5 /uv /usr/local/bin/uv
18
18
  ARG PIP_COMMAND="uv pip"
19
19
 
20
+ # Keep the uv/pip cache in /openedx/.cache in every stage: build stages mount a shared
21
+ # build cache at /openedx/.cache/pip, and without these variables a stage that installs
22
+ # packages outside such a mount leaks its package cache into the image layers.
23
+ ENV XDG_CACHE_HOME=/openedx/.cache
24
+ # uv reuses wheels it built from source regardless of the glibc they were linked
25
+ # against, so keep a separate cache per base image: wheels built on a newer Ubuntu
26
+ # (e.g. by another Tutor release) fail to import here. Keep in sync with the base
27
+ # image above.
28
+ ENV UV_CACHE_DIR=$XDG_CACHE_HOME/pip/ubuntu-24.04
29
+
20
30
  # Constrain the build-time setuptools used in the isolated (PEP 517) build
21
31
  # environments that uv/pip create for source builds; without it the latest
22
32
  # setuptools is used regardless of the venv pin, which broke builds when
@@ -97,12 +107,6 @@ FROM scratch AS mnt-{{ name }}
97
107
  FROM python AS python-requirements
98
108
  ENV PATH=/openedx/venv/bin:${PATH}
99
109
  ENV VIRTUAL_ENV=/openedx/venv/
100
- ENV XDG_CACHE_HOME=/openedx/.cache
101
- # uv reuses wheels it built from source regardless of the glibc they were linked
102
- # against, so keep a separate cache per base image: wheels built on a newer Ubuntu
103
- # (e.g. by another Tutor release) fail to import here. Keep in sync with the
104
- # "minimal" stage base image.
105
- ENV UV_CACHE_DIR=$XDG_CACHE_HOME/pip/ubuntu-24.04
106
110
 
107
111
  RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
108
112
  --mount=type=cache,target=/var/lib/apt,sharing=locked \
@@ -160,10 +164,16 @@ ENV PATH=/openedx/nodeenv/bin:/openedx/venv/bin:${PATH}
160
164
  # Install nodeenv with the version provided by edx-platform
161
165
  # https://github.com/openedx/edx-platform/blob/master/requirements/edx/assets.txt
162
166
  RUN $PIP_COMMAND install nodeenv==1.9.1
163
- RUN nodeenv /openedx/nodeenv --node=24.22.1 --prebuilt
167
+ # --clean-src drops the extracted Node tarball from /openedx/nodeenv/src (~200MB): it
168
+ # is not needed at runtime and duplicates every CVE finding in Node's bundled npm.
169
+ RUN nodeenv /openedx/nodeenv --node=24.22.3 --prebuilt --clean-src
170
+ # Node bundles an npm whose vendored dependencies (undici, brace-expansion) carry known
171
+ # vulnerabilities; upgrade npm itself to a release that ships the fixed versions.
172
+ ARG NPM_REGISTRY={{ NPM_REGISTRY }}
173
+ RUN --mount=type=cache,target=/root/.npm,sharing=shared \
174
+ npm install -g npm@11.21.2 --registry=$NPM_REGISTRY
164
175
 
165
176
  # Install nodejs requirements
166
- ARG NPM_REGISTRY={{ NPM_REGISTRY }}
167
177
  WORKDIR /openedx/edx-platform
168
178
  RUN --mount=type=bind,from=edx-platform,source=/package.json,target=/openedx/edx-platform/package.json \
169
179
  --mount=type=bind,from=edx-platform,source=/package-lock.json,target=/openedx/edx-platform/package-lock.json \
@@ -211,6 +221,12 @@ ENV STATIC_ROOT_CMS=/openedx/staticfiles/studio
211
221
 
212
222
  WORKDIR /openedx/edx-platform
213
223
 
224
+ # From this stage on (production, development, and plugin patches) package installs run
225
+ # without a cache mount, so disable the uv/pip download caches: with them enabled, every
226
+ # install would leak its cache into an image layer. The build stages above keep theirs.
227
+ ENV UV_NO_CACHE=1
228
+ ENV PIP_NO_CACHE_DIR=1
229
+
214
230
  {# Install auto-mounted directories as Python packages. #}
215
231
  {% for name in iter_mounted_directories(MOUNTS, "openedx") %}
216
232
  COPY --link --chown=$APP_USER_ID:$APP_USER_ID --from=mnt-{{ name }} / /mnt/{{ name }}
@@ -302,16 +318,13 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
302
318
  USER app
303
319
 
304
320
  # Install dev python requirements
305
- RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared \
306
- uv export --frozen --no-hashes --no-default-groups --group development | \
321
+ RUN uv export --frozen --no-hashes --no-default-groups --group development | \
307
322
  $PIP_COMMAND install -r /dev/stdin
308
323
  # The development dependency group pins the old certifi again, so upgrade it one more time
309
- RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared \
310
- $PIP_COMMAND install "certifi>=2026.10.19"
324
+ RUN $PIP_COMMAND install "certifi>=2026.10.19"
311
325
  # https://pypi.org/project/ipdb/
312
326
  # https://pypi.org/project/ipython (>=Python 3.10 started with 8.20)
313
- RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared \
314
- $PIP_COMMAND install ipdb==0.13.13 ipython==8.24.0
327
+ RUN $PIP_COMMAND install ipdb==0.13.13 ipython==8.24.0
315
328
 
316
329
  {# Re-install mounted requirements, otherwise they will be superseded by upstream reqs #}
317
330
  {% for name in iter_mounted_directories(MOUNTS, "openedx") %}