-
Notifications
You must be signed in to change notification settings - Fork 547
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
🤖 Set build config via Sphinx ext #2360
base: devel
Are you sure you want to change the base?
🤖 Set build config via Sphinx ext #2360
Conversation
This is an initial change allowing for restructuring how the config settings are computed and putting that logic into a dedicated Sphinx extension. The idea is that this extension may have multiple callbacks that set configuration for Sphinx based on tags and the environment state. As an example, this in-tree extension implements setting the `is_eol` variable in Jinja2 context very early in Sphinx life cycle. It does this based on inspecting the state of current Git checkout as well as reading a config file listing EOL and supported versions of `ansible-core`. The configuration format is TOML as it's gained a lot of the ecosystem adoption over the past years and its parser made its way into the standard library of Python, while PyYAML remains a third-party dependency. Supersedes ansible#2251.
8ef3352
to
ab0e151
Compare
logger.info(str(lookup_err)) | ||
return | ||
|
||
config.html_context['is_eol'] = _is_eol_build( |
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.
@oraNod this is what sets that value into the variable defined in conf.py
. It basically replaces the old hardcoded value.
def from_dict(cls, raw_dist: dict[str, list[str]]) -> 'Distribution': | ||
return cls( | ||
**{ | ||
kind.replace('-', '_'): versions |
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.
The dataclass has to have snake_case attrs so this is doing that conversion. It effectively maps end-of-life
in the TOML config to end_of_life
.
'stable-2.14', | ||
'stable-2.13', | ||
] | ||
supported = [ |
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.
@oraNod did you plan to use this list somehow? I just copied it, but it's not actually used anywhere.
[distribution.ansible-core] | ||
end-of-life = [ | ||
'stable-2.15', | ||
'stable-2.14', | ||
'stable-2.13', | ||
] | ||
supported = [ | ||
'devel', | ||
'stable-2.18', | ||
'stable-2.17', | ||
'stable-2.16', | ||
] |
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.
@oraNod things here are the same as in the other mapping. Did you expect them to differ at some point? What's the semantic meaning you were going for?
This is an initial change allowing for restructuring how the config settings are computed and putting that logic into a dedicated Sphinx extension. The idea is that this extension may have multiple callbacks that set configuration for Sphinx based on tags and the environment state.
As an example, this in-tree extension implements setting the
is_eol
variable in Jinja2 context very early in Sphinx life cycle. It does this based on inspecting the state of current Git checkout as well as reading a config file listing EOL and supported versions ofansible-core
.The configuration format is TOML as it's gained a lot of the ecosystem adoption over the past years and its parser made its way into the standard library of Python, while PyYAML remains a third-party dependency.
Supersedes #2251.