New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: optional dependency management #174
feat: optional dependency management #174
Conversation
@ru-fu (or someone else) can you give me the details why the CI fails? I do not have the permissions to see the logs. |
1e71f1b
to
1e9378f
Compare
Note: I had an outdated local |
I will provide full log out of band. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No thorough review yet, but overall I think this will work. I'm a little concerned though because this will be a breaking change that requires all teams to go through their current requirements and figure out which ones they need to add manually, and it's not easy to see which ones are included and which are missing.
For the build failure, the problem is that RTD doesn't use the Makefile. So you'll need to add a prebuild step to .readthedocs.yaml
(see here for some examples).
Note: I thought that my solution covers this automatically. Every team just has to run Question: @ru-fu can you explain this to me with a simple example where this does not apply? |
Disclaimer: I haven't tested it yet, so it's totally possible that I've just misread the code. ;) For LXD, for example, we are using an extension called |
@ru-fu I see :/ That is indeed not covered. Thought: Maybe we should write a tiny migration guide that you could point to. For example an expanded version of:
Thought: I can also spend some more time and write a migration helper that makes this diff and tells the user what to do (should not be too complicated). |
I don't think we need a script for that, but we should have some clear indication on which packages can be ignored (because they are included automatically). |
Note: I added documentation and a fail safe mechanism. In case that someone explicitly defines an automatically handled extension the extension will be enabled and the module added to the requirements even if it does not make a lot of sense. Question: What do you think? |
Note: The CI fails because of linkcheck this looks to me like a temporary unavailability of the service and not related to my commit. |
You're still relying on the Makefile - however, some teams don't build locally, so their requirements file will never update. |
5df9a7f
to
9e68db5
Compare
Note: I force-pushed to change the last commit (9e68db5). I initially used |
Note: I somehow missed this part. Resolved with 9e68db5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some testing now, so a few more comments.
But overall it works nicely! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks good!
Do you want to squash any commits before merging?
* `.sphinx/requirements.txt` was removed and added to `.gitignore` * `make clean` deletes `.sphinx/requirements.txt` (if present) * `make install` automatically generates `.sphinx/requirements.txt` (if not present) based on the configuration specified index `custom_conf.py`: - only enables redirects extension if any redirects are specified - only enables open graph extension if any configuration is present - only enables myst extensions if any configuration is present - moved `sphinx_tabs.tabs`, `canonical.`* and `notfound.extension` to `custom_extensions` - canonical sphinx module will only be used as dependency if any canonical sphinx extension is specified in `custom_extensions` (legacy names (without "canonical." prefix) are handled correctly) - if any automatically handled extension is explicitly specified in `custom_extensions` it will be enabled even if the configuration context suggest otherwise - the resulting list of extension will be deduplicated (legacy names of canonical sphinx extension are handled correctly) Co-authored-by: Ruth Fuchss <ruth.fuchss@canonical.com>
* `.readthedocs.yaml` instructs Read The Docs (RTD) builder to generate `.sphinx/requirements.txt` post checkout * `init.sh` script correctly updates the path where the `build_requirements.py` is located/needs to be executed Co-authored-by: Ruth Fuchss <ruth.fuchss@canonical.com>
9352e1e
to
7ec0fcf
Compare
Documents the added optional dependency mechanism in the `readme.rst`. Co-authored-by: Ruth Fuchss <ruth.fuchss@canonical.com>
7ec0fcf
to
bf41e17
Compare
Note: It can be merged now. I squashed all the commits into logical commits (should be easier to understand now). I didn't expect to do squashing at the end, so I could have written shorter commit messages 😅 |
TODO:
|
Note: I do not know why the RTD build failed. Looks like an RTD Infra problem, because there were no logs in the admin interface. Additionally the same source build fine before all the squashing and the squashing introduced no new changes since then. |
Suggestion: @ru-fu How about this change log entry? Feel free to make any changes as you see fit. BREAKING CHANGE: An dependency management system was added. You can now opt-out of the extensions Recommended actions:
See dd0ae84 for more details about how the dependency management system works. Note: As raw markdown: **BREAKING CHANGE:** A dependency management system was added. You can now opt-out of the extensions `myst_parser`, `sphinx_reredirects`, `sphinxext.opengraph`, `sphinx_tabs.tabs`, `canonical.youtube-links`, `canonical.related-links`, `canonical.custom-rst-roles`, `canonical.terminal-output`, `notfound.extension`.
Recommended actions:
* Move custom required Python modules to the `custom_required_modules` array in the `custom_conf.py` file.
* Delete the `.sphinx/requirements.txt` file. It will now get generated based on the configuration in `custom_conf.py` with `make install`.
* Reinstall the local virtual Python environment with `make clean && make install`.
```
make clean
git commit .sphinx/requirements.txt
make install
```
See dd0ae8400b0e9f94f34cefb06bc61b8f766ed3ae for more details about how the dependency management system works. |
No sure what it was, but I rebuilt and it's now green. :) |
Looks good to me, thanks! I made two tiny changes (only in the Markdown section). |
Changes:
.sphinx/requirements.txt
based on used extensions (whenmake install
is invoked)sphinx_tabs.tabs
,canonical.*
andnotfound.extension
tocustom_extensions
Further context: Issue #140