Skip to content
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

Move Kedro documentation CSS to package allow sharing across subprojects #3016

Closed
stichbury opened this issue Aug 18, 2023 · 14 comments
Closed
Assignees
Labels
Component: Documentation 📄 Issue/PR for markdown and API documentation

Comments

@stichbury
Copy link
Contributor

stichbury commented Aug 18, 2023

Description

Following on from parent task #2600, there is one subtask that we need to do to fix the styling so any new subprojects for Viz, Datasets, Starters etc use exactly the same theme as the Kedro docs.

I'm not sure what is involved with this (I naively thought we could just copy the CSS around but I guess that's not exactly maintainable). Edit: Now have a plan.

Please can I add to your queue @tynandebold for consideration & prioritisation.

@stichbury stichbury added the Issue: Feature Request New feature or improvement to existing feature label Aug 18, 2023
@stichbury stichbury transferred this issue from kedro-org/kedro Aug 21, 2023
@stichbury
Copy link
Contributor Author

@tynandebold So this is probably a question of setting up a separate package for the docs theming folder that Kedro framework currently uses, so that when we put out other documentation subprojects for datasets, viz and starters, they can draw on the same by adding that package as a dependency.

The theme will initially be as we are using currently, with later updates for #4257. So, in theory, this ticket could enter any sprint that you are able to pick it up.

@astrojuanlu and I have briefly discussed but happy to talk more about practicalities when you have an engineer able to pick it up.

@stichbury stichbury changed the title Restyle Kedro subproject documentation Move Kedro documentation CSS to package allow sharing across subprojects Sep 4, 2023
@astrojuanlu
Copy link
Member

Exactly, the idea is to distribute the theme as pip install kedro-sphix-theme (or whatever other name) so it can be reused by the different repositories. I don't think there are many good docs on how to do such a thing, but we would be looking at doing what other themes are already doing, for example the one we derive from https://github.com/readthedocs/sphinx_rtd_theme/ or more modern ones like https://github.com/pradyunsg/furo/, which uses its own build backend https://sphinx-theme-builder.readthedocs.io/

@stichbury stichbury transferred this issue from kedro-org/kedro-viz Sep 7, 2023
@stichbury stichbury added this to the Documentation subprojects milestone Sep 7, 2023
@tynandebold
Copy link
Member

Does it need to be pip installable? Could we instead host these two files in a centralized place and then use those URLs to reference the CSS via RTD?

Prerequisite for this is that we're able to add a custom <link> tag in the <head> section of a RTD project. I haven't looked into if this is possible.

@stichbury
Copy link
Contributor Author

Does it need to be pip installable? Could we instead host these two files in a centralized place and then use those URLs to reference the CSS via RTD?

Prerequisite for this is that we're able to add a custom <link> tag in the <head> section of a RTD project. I haven't looked into if this is possible.

I think it's OK to use a link, from looking at this: https://docs.readthedocs.io/en/stable/guides/adding-custom-css.html

image

What you are suggesting is a "fully qualified path", right?

@tynandebold
Copy link
Member

Yes indeed! Then I think we're in business and need not create a new Python package. We can dump these files on S3 or maybe even GitHub pages, adding them to a new repo in our organization.

Haven't thought it through too far other than to say this sounds like a wiser option.

@astrojuanlu
Copy link
Member

Notice that it's not only CSS files we'd like to distribute: we're starting to have duplication in conf.py. Compare

def autolink_replacements(what: str) -> list[tuple[str, str, str]]:

with

https://github.com/kedro-org/kedro-plugins/blob/7d092dbdb9344af58435ed6a696331ecb80ae553/kedro-datasets/docs/source/conf.py#L240

The more Sphinx projects we add (and soon we'll need kedro-viz and others), the more stuff we need to copy-paste to conf.py that could be distributed as functions.

In addition, if we ever want to change the theme base from sphinx-rtd-theme to something else (which we absolutely want, see #4257) we'd need to again change the html_theme value in conf.py as well as the dependencies in every single package, which will become tedious soon.

As a result I'm all in favour of creating a new Python package.

@tynandebold
Copy link
Member

I didn't notice that, thank you for pointing that out.

Since it's more than only CSS a new Python package seems best, as JuanLu said.

I know much less about that, though am still happy to help with the styling part.

@astrojuanlu
Copy link
Member

Asked on pradyunsg/sphinx-theme-builder#45 and the Write the Docs community just to make sure I'm not spitting nonsense here.

@stichbury
Copy link
Contributor Author

stichbury commented Sep 13, 2023

Hmm, I'm still not convinced though. Is the complexity of adding another package for reuse really worth the occasional conf.py edit when we aren't likely to be changing theme that often (I hope!). It also means each project is then bound to share a conf.py and this may not be ideal in some cases (e.g. link checker exclusions, extensions).

I'm not sure, but I still like the idea of keeping things simple, and not getting into reuse just because "we can" 🤷

@astrojuanlu
Copy link
Member

To clarify, projects would not share a conf.py (I don't think that's possible) but could optionally load the modifications we make on demand.

Regardless, I don't want to become the bottleneck of this 😄 so if this is on the critical path towards #2600, then I'm okay with uploading the CSS assets somewhere and using those directly for now.

@stichbury
Copy link
Contributor Author

Oh OK, that sounds better, but still a bit complicated for my poor 🧠 to compute. Let's just go with basic CSS as per @tynandebold's original suggestion on S3 or similar. Makes it simple and when/if we later need to dig ourselves out of the technical debt I'm dumping us in, I promise to be humble 😊

@tynandebold tynandebold added Component: Documentation 📄 Issue/PR for markdown and API documentation and removed Issue: Feature Request New feature or improvement to existing feature labels Oct 16, 2023
@tynandebold tynandebold self-assigned this Oct 16, 2023
@tynandebold tynandebold moved this from Todo to In Progress in Kedro-Viz Oct 16, 2023
@stichbury
Copy link
Contributor Author

@tynandebold
Copy link
Member

tynandebold commented Oct 19, 2023

I've uploaded both theme files now:

cc @vladimir-mck

@stichbury
Copy link
Contributor Author

We can close this as done now. The CSS is used in the Viz docs project and I will make a branch on develop for the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Documentation 📄 Issue/PR for markdown and API documentation
Projects
Status: Done
Development

No branches or pull requests

3 participants