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

Allow dynamic plugin data classes & convert feature plugins #3424

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

happz
Copy link
Collaborator

@happz happz commented Dec 13, 2024

Plugins' _data_class is no longer the source of plugins' data classes. Instead, new get_data_class() method is added (see [1]). _data_class is not gone, it serves as the default for get_data_class(), but plugins now can provide their own implementation.

Which is exactly what prepare/feature and feature plugins do now, the plugin builds its data class from collected smaller data classes, one for each feature plugin.

There are some loose ends, namely type annorations, but the code works, both in runtime and when rendering docs.

[1] a data_class property would be nice, but the attribute must be a class-level attribute and those cannot be properties.

Pull Request Checklist

  • implement the feature
  • write the documentation

@happz happz added step | prepare Stuff related to the prepare step code | style Code style changes not affecting functionality code | no functional change "No Functional Change" intended. Patch should not change tmt's behavior in any way. labels Dec 13, 2024
@happz happz added this to the 1.41 milestone Dec 13, 2024
@happz happz force-pushed the allow-dynamic-step-data-classes branch from 6b6e9ff to 0f30185 Compare December 13, 2024 09:33
@happz happz added the ci | full test Pull request is ready for the full test execution label Dec 13, 2024
Plugins' `_data_class` is no longer the source of plugins' data classes.
Instead, new `get_data_class()` method is added (see [1]). `_data_class`
is not gone, it serves as the default for `get_data_class()`, but
plugins now can provide their own implementation.

Which is exactly what `prepare/feature` and feature plugins do now, the
plugin builds its data class from collected smaller data classes, one
for each feature plugin.

There are some loose ends, namely type annorations, but the code works,
both in runtime and when rendering docs.

[1] a `data_class` property would be nice, but the attribute must be a
class-level attribute and those cannot be properties.
@happz happz force-pushed the allow-dynamic-step-data-classes branch from 0f30185 to 32740ee Compare December 13, 2024 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci | full test Pull request is ready for the full test execution code | no functional change "No Functional Change" intended. Patch should not change tmt's behavior in any way. code | style Code style changes not affecting functionality step | prepare Stuff related to the prepare step
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant