Commit ab531ad
feat(lessons): auto-discover lessons from plugins (#944)
* feat(lessons): auto-discover lessons from plugins
When plugins are configured via [plugins].paths, automatically search
each plugin's lessons/ directory for lesson files.
This enables plugins to ship with their own lessons that get included
automatically when the plugin is loaded.
* fix(lessons): handle src/ layout for plugin lesson discovery
When plugins use the standard Python src/ layout, plugin.path points to
the module inside src/ (e.g., /project/src/module/), not the project root.
This caused lessons/ directories at the project root to not be found.
Fix:
1. First check plugin.path/lessons (flat layout)
2. If not found, walk up to find project root (where pyproject.toml is)
3. Check for lessons/ at project root for src/ layout plugins
4. Use is_dir() instead of exists() per code review suggestion
Fixes issue identified by Greptile: plugins with src/ layout structure
(pyproject.toml + src/ directory) would not have their lessons discovered.
---------
Co-authored-by: Erik Bjäreholt <erik@bjareho.lt>1 parent 684bbb6 commit ab531ad
1 file changed
+30
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
158 | 188 | | |
159 | 189 | | |
160 | 190 | | |
| |||
0 commit comments