wording
theme and template are 2 different things and the naming can be confusing; in this document we use
theme to refer to the myst-theme repo that contains the source for the app that consumes content
template to refer to the myst-templates repo that contains essentially the API that the CLI uses to locate and download themes
context
story 1. over summer, at some point freshly built sites with the book theme would have their left-hand pane slightly broken (current section would collapse, making navigation awkward); not a huge deal, but annoying; it took a few months to get it back to working correctly
story 2. current rollout on the new AST for outputs seems to have broken many people's builds
this is no sustainable situation; too many moving pieces; on the longer run we cannot afford breaking users builds
current drawbacks
-
mystmd cli pulls latest theme by default
so an old CLI will pull a recent theme, possibly incompatible
theme/template caching makes things even more awkward and unpredictable
-
theme released through awkward scheme involving "ghost" repos
a forked theme needs to reproduce this, barriers to entry for creating custom themes
-
the API does not provide versioning; the CLI can only resolve 'book-theme' but not 'book-theme v0.5.0'
-
minor point, but possible cleanup: there is one extra level of indirection in the case of html themes: the API currently answers a fake .git URL that is later resolved by the CLI; not quite clear why this indirection is needed, if at all
again this is second order
proposal
theme packaging
through GH releases
- using GH releases to package themes (one PR already ready to go for this)
- allowed for forked themes to be used very easily
- questions
- what triggers a release ? current PR goes with one release per tag, must be improved given the tagging scheme in place on that repo (ie: multiple subtags per release)
- be wary about the way actions work wrt tags, esp. when several tags are pushed at the same time
using package managers
Anton suggested to publish on npm/pypi instead of GH releases, and to use the package managers to resolve versions
This track might lead to deeper changes than the gh release track
API changes
regardless, it feels like the following changes would improve the situation
- add versioning (optional) parameters when resolving a theme
- this way the CLI will have a way to request a specific version of a theme
- either because the CLI itself has a default version to use for a given theme (eg: the mystmd CLI v1.2.0 uses book-theme v0.5.0 by default)
- or because the user has specified it in their myst.yml - like Steve's suggestion to say
or maybe more like
site:
theme:
name: book-theme
version: 0.5.0
kind: release
or even, like we support today
site:
theme:
url: https://custom.dev/my/own/theme.zip
# or at least something that lets people craft and publish their own theme
# if we go for pypi/npm then there is a need to be able to express that
questions:
- the theme-version mapping could then be baked in the CLI itself
- or the API could know about that mapping, meaning the CLI would need to pass its own version when requesting a theme
removals
with this scheme, there is no longer a need for using these fake '.git' URLs are they are being used now, in a rather confusing way (ie: the API returns a fake git URL that the CLI then resolves to a GH commit download URL)
migration path
the npm/pypi path might involve more steps, but assuming the gh-release path for now, one possible migration path would be
- adopt the GH releases packaging scheme for themes; at this point both packaging schemes (old commit-based and new release-based) would co-exist
- update the API to support versioned theme requests
- because older CLI instances will be around for some time we need to, at least temporarily, maintain backward compatibility
- however in this release of the API, we would stop returning .git URLs, and instead return .zip URLs that do not need further resolution by the CLI (no change needed in the CLI at this point)
- so this means that the API starts returning pre-resolved URLs for the html themes
- honestly I'm not exposed to other kinds of themes, so essentially no change for these at all at this point
- but crucially add support for optional parameters to specify theme version - see above
- the CLI can then be altered to support:
- user-specified theme versions
- default theme versions per CLI version
- once all this is in place the CLI code can be simplified to remove the hack around resolving .git URLs
references
this matter has been touched on in the following threads
mostly apart from the last one that could be kept as-is if we go for gh-releases,
they can be ignored, and deemed as having contributed to the above, just mentioned here for the record
wording
theme and template are 2 different things and the naming can be confusing; in this document we use
themeto refer to themyst-themerepo that contains the source for the app that consumes contenttemplateto refer to themyst-templatesrepo that contains essentially the API that the CLI uses to locate and download themescontext
story 1. over summer, at some point freshly built sites with the book theme would have their left-hand pane slightly broken (current section would collapse, making navigation awkward); not a huge deal, but annoying; it took a few months to get it back to working correctly
story 2. current rollout on the new AST for outputs seems to have broken many people's builds
this is no sustainable situation; too many moving pieces; on the longer run we cannot afford breaking users builds
current drawbacks
mystmd cli pulls latest theme by default
so an old CLI will pull a recent theme, possibly incompatible
theme/template caching makes things even more awkward and unpredictable
theme released through awkward scheme involving "ghost" repos
a forked theme needs to reproduce this, barriers to entry for creating custom themes
the API does not provide versioning; the CLI can only resolve 'book-theme' but not 'book-theme v0.5.0'
minor point, but possible cleanup: there is one extra level of indirection in the case of html themes: the API currently answers a fake .git URL that is later resolved by the CLI; not quite clear why this indirection is needed, if at all
again this is second order
proposal
theme packaging
through GH releases
using package managers
Anton suggested to publish on npm/pypi instead of GH releases, and to use the package managers to resolve versions
This track might lead to deeper changes than the gh release track
API changes
regardless, it feels like the following changes would improve the situation
questions:
removals
with this scheme, there is no longer a need for using these fake '.git' URLs are they are being used now, in a rather confusing way (ie: the API returns a fake git URL that the CLI then resolves to a GH commit download URL)
migration path
the npm/pypi path might involve more steps, but assuming the gh-release path for now, one possible migration path would be
references
this matter has been touched on in the following threads
mostly apart from the last one that could be kept as-is if we go for gh-releases,
they can be ignored, and deemed as having contributed to the above, just mentioned here for the record