-
-
Notifications
You must be signed in to change notification settings - Fork 9
Add documentation_starter to cookieplone-templates/templates
#174
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
Add documentation_starter to cookieplone-templates/templates
#174
Conversation
documentation_addon
to the arsenal of add-ons!
I am super excited by your work, @ujsquared! I have a lot on my plate at the moment, and hope to review this weekend. I've also requested reviews from people who I think would be interested in this add-on. |
No worries! |
Is this an add-on? |
you may want to create a cookuiecutter template for a documentation project with Sphinx theme Plone-Sphinx-Theme |
@ksuess it's a cookieplone template that allows a person to generate docs for their project, without using sphinx-quickstart and already having PST and its extensions available. |
Oops, typo. Should read cookiecutter template |
Is this a Plone project or a Plone add-on? |
@ksuess I think you don't understand what this PR intends. It's not a Plone add-on. It's a Cookieplone template, similar to the backend and frontend. It generates a scaffold to create documentation for a Plone project generated from Cookieplone. Without it, a generated project does not have any documentation except for the default READMEs. Does that clarify? |
Let's see how cookieplone evolves. |
I'm also excited about this one. I myself was in the need of this:
But, I have questions to the current shape too. So, @ksuess is correct, it's nor a Volto add-on, nor a classicUI add-on. So call it add-on might lead to confusion since there's no such thing as a "documentation add-on". Does it address the two things above? @ericof would cookieplone/cookiecutter allow this? I can recall you telling me that this was a limitation. |
Absolutely. This feature was proposed keeping in mind the idea of letting users to effortlessly create some form of documentation (based on
This feature hasn't been implemented. It's possible that we could add it by making changes here, but I'm not certain
To maintain consistency with the existing |
Regarding the use of "_addon" in this template's name, it's reusing the patterns of |
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 for getting this started @ujsquared. I haven't done a detailed review of the template yet; I want to give some comments on the overall structure first.
First, I agree with the other comments that using addon
in the name is wrong, because the thing it creates is not a Plone add-on. I would be okay with documentation_template
or documentation_project
as an alternative. (Or, open to other suggestions)
Currently this is set up to create a new repository that only contains documentation. That's usually not what we want. Usually documentation is a part of a repository that also includes something else (which could be any of the other main templates, i.e. a backend add-on, a frontend add-on, or a project that includes both frontend and backend).
I'd like to see this become a subtemplate that is called in the post_gen_project hook of the other templates to add a docs directory (if the user answered yes to a question about whether they want documentation). If it also works as a standalone template, that's fine, but the subtemplate is the main thing we want. (@stevepiercy, yell at me if I'm on the wrong track here.)
The files in the top level {{cookiecutter.__folder_name}}
folder will be a problem because they would overwrite files from the other templates. I'd suggest that we move the Makefile and README into the docs
folder (so users will need to cd into that folder before running docs commands). @stevepiercy would you be okay with that? The alternative is figuring out a way to construct a Makefile that includes commands from all the subtemplates which were used, which is possible (maybe using mxmake) but complicated.
It's more of a foundation, platform, scaffold, base, or starter. It's not a project itself, but part of a project. Also since it's the result of being generated from a template, I don't want to reuse that term in its name.
That's correct.
Third option—and we did this in the unified Pyramid cookiecutter—include all possibilities, then delete those not selected. See https://github.com/Pylons/pyramid-cookiecutter-starter/blob/latest/hooks/post_gen_project.py. |
documentation_addon
to the arsenal of add-ons!…:ujsquared/cookieplone-templates into feat/add-documentation-template
Just rewriting the tests specific to
I have fixed most of these tests in the new commits. Final commits to be pushed in an hour or two. |
Do we actually use |
@davisagli @ericof @sneridagh is it OK to merge this PR? We're getting ready for World Plone Day on Thu, Apr 10, and this PR is critical. See Storybook build error in frontend functional tests: https://github.com/ujsquared/cookieplone-templates/actions/runs/14296375658/job/40064081218 |
I could reproduce this error on a |
@ujsquared @sneridagh is on it. See #189 (comment). We'll merge that PR before this one, and continue. |
@ujsquared @sneridagh fixed the image, and I updated the branch. Now we wait for tests to run. It should be green soon. We need a review from not-Steve and not-Ujjwal before merging. |
I think the status checks are not reporting correctly because @ujsquared's PR comes from a fork, not this repo. Nonetheless, all the checks pass. |
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 tried it out and looked through the changes. Great work, @ujsquared and @stevepiercy!
I added some comments, but I think it's in a good place where we could go ahead and merge it and then do incremental improvements like normal.
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.
This is not high priority, but it'd be nice to update this to be more similar to the Makefiles for the other templates. (For example, use a "generate" command instead of "bake", and make it run cookieplone instead of cookiecutter.)
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.
Per my earlier comment, I'm not clear for what this Makefile is used. Does Cookieplone call its targets during the generation process, for tests, or something else? It's not really documented anywhere.
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.
On further inspection, I'm not sure either. I was thinking it was used by the github actions, but now I see they run commands from the top-level Makefile
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.
If I remember correctly, the makefile is mostly borrowed over from plone-sphinx-theme. Hence the older cookie-cutter commands.
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.
There are two Makefile
s per template.
- https://github.com/plone/cookieplone-templates/pull/174/files#diff-7d7002e7e946c75535a549438882fcf1b67651e9b0245bfc5989b340071626f7
- https://github.com/plone/cookieplone-templates/pull/174/files#diff-bbaac30402a0c9d35d50873dffdd1739eb344980a2b8fe8efaf193dd7554d956
The latter comes from PST. I have no clue where the former came from or what it does.
templates/add-ons/documentation_starter/{{cookiecutter.__folder_name}}/docs/_static/logo.svg
Outdated
Show resolved
Hide resolved
templates/add-ons/documentation_starter/{{cookiecutter.__folder_name}}/docs/glossary.md
Show resolved
Hide resolved
templates/add-ons/documentation_starter/{{cookiecutter.__folder_name}}/pyproject.toml
Outdated
Show resolved
Hide resolved
templates/add-ons/documentation_starter/{{cookiecutter.__folder_name}}/requirements.txt
Show resolved
Hide resolved
@ujsquared can you restart the failed job from your fork? I don't have access to do so. https://github.com/ujsquared/cookieplone-templates/actions/runs/14329161498/job/40160975816 It failed due to a temporary PyPI outage. |
@stevepiercy can you pls add your name to co-author
It's still failing due to the outage. |
Done! |
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'm going to go ahead and merge.
Fixes #7
Fixes plone/plone-sphinx-theme#3
Overview
This pull request introduces the
documentation_addon
template to the cookieplone-templates repository.The template generates a Sphinx-based documentation environment for Plone projects, leveraging the latest
plone-sphinx-theme
from PyPI. It includes a comprehensive test suite to support both ongoing development and ensure reliable template generation.Changes
There's loads of additions in this PR, so let's break it down:
Folder Structure
{{cookiecutter.__folder_name}}/
: The core template directory that becomes the generated project (e.g.,collective.example.docs
).docs/
: Contains Sphinx documentation files.docs/guides/
: Templated directory helping user structure their documentation usinggetting-started.md
,usage.md
etc.docs/reference/
: Includes technical reference docs (file-system-structure.md
,index.md
,theme-elements.md
)._static/
: Static assets (favicon.ico
,logo.svg
) for branding.hooks/
: Containspost_gen_project.py
for post-generation tasks (e.g., Git initialization). Can be used to add more hooks in the future for e.g. pre-generation hook.tests/
: Test suite withconftest.py
andtest_template.py
for template validation.Root Files: Essential project files (
pyproject.toml
,Makefile
,README.md
, etc.) for setup and building.cookiecutter.json
: Configuration file defining template variables and prompts.Makefile
: Top-level Makefile for mostly for running tests during development ofdocumentation_addon
.Template Features
Plone Docs like Environment: Generates a ready-to-use Sphinx setup with
conf.py
, pre-configured for plone-sphinx-theme.Dynamic Variables: Uses Jinja2 variables (e.g.,
{{ cookiecutter.title }}
,{{ cookiecutter.__folder_name }}
) for customization.Git Support: Optional Git initialization via
__documentation_addon_git_initialize
toggle incookiecutter.json
.To-do/Improvements
{{cookiecutter.__folder_name}}
.A Plone project
add-on option.PS: currently, the build of generated documentation fails, due to a issue with buildout 🙁.