Skip to content

Conversation

@llucax
Copy link
Contributor

@llucax llucax commented Feb 4, 2025

This PR moves the documentation macros functionality from individual template repositories into a central location, making it available as a macros pluglet. Key improvements include:

  • Removes duplicated boilerplate code
  • Adds a modular macros pluglet with common functionality
  • Simplifies template setup by using git-aware version info
  • Includes migration script for existing repositories
  • Updates release notes and documentation

The PR also bumps template dependencies and repository configuration versions in preparation for the 0.12 release.

Fixes #179.

@llucax llucax requested a review from a team as a code owner February 4, 2025 15:33
@llucax llucax requested a review from shsms February 4, 2025 15:33
@github-actions github-actions bot added the part:template Affects the cookiecutter template files label Feb 4, 2025
@llucax llucax added this to the v0.12.0 milestone Feb 4, 2025
@llucax llucax added type:enhancement New feature or enhancement visitble to users type:tech-debt Improves the project without visible changes for users part:mkdocs Affects the configuration of mkdocs labels Feb 4, 2025
@llucax llucax self-assigned this Feb 4, 2025
@llucax llucax requested a review from Marenz February 4, 2025 15:34
llucax added 12 commits February 4, 2025 16:37
This module is basically documentation, but there is some relationship
to macros as we'll provide the `CODE_ANNOTATION_MARKER` as a macro
variable, so we take the opportunity to unify the documentation in one
place.

Signed-off-by: Leandro Lucarella <[email protected]>
This module provides the required hooking, so macros can be used inside
docstrings properly when using `mkdocstrings`.

Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
This commit adds a new utility function to retrieve version information
from the repository and expose it as a couple of macro variables.

This function is also called from the convenience `define_env()`
function, so the variables are provided by default.

Signed-off-by: Leandro Lucarella <[email protected]>
The new function `hook_env_with_everything()` will do all the default
hooking, so it is easier to define a custom `define_env()` where only
a few macros are added, but still gets all the variables macros and
filters provided by this module.

Signed-off-by: Leandro Lucarella <[email protected]>
For the basic usage we can actually use the module itself as a
*pluglet*:
https://mkdocs-macros-plugin.readthedocs.io/en/latest/pluglets/

Signed-off-by: Leandro Lucarella <[email protected]>
With this, there is no need for customization unless you want to define
your own macros.

Signed-off-by: Leandro Lucarella <[email protected]>
The macros plugin already offer easy access to git info, so we can do a
last resort try of getting the current sha from there.

Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
This completely removes the macros script.

Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
We now use the *pluglet* for templates too.

Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
Copy link
Contributor

@shsms shsms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect sleepy time PR for friday afternoon.

```

Then you need to add the `path/to/macros.py` file. The contents will vary depending on
if you want to use use the convenience default hooking or not.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if you want to use use the convenience default hooking or not.
whether you want to use the convenience default hooking or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That text is not present in the latest code, I wouldn't go through the trouble of fixing up the commit, but I can do it if you think it is important.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I wasn't aware it wasn't the latest code, it doesn't have to be fixed.

@llucax llucax added this pull request to the merge queue Feb 10, 2025
Merged via the queue into frequenz-floss:v0.x.x with commit 07780ea Feb 10, 2025
14 checks passed
@llucax llucax deleted the robotech branch February 10, 2025 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:mkdocs Affects the configuration of mkdocs part:template Affects the cookiecutter template files type:enhancement New feature or enhancement visitble to users type:tech-debt Improves the project without visible changes for users

Projects

None yet

2 participants