argoproj-labs / hera

Hera makes Python code easy to orchestrate on Argo Workflows through native Python integrations. It lets you construct and submit your Workflows entirely in Python. ⭐️ Remember to star!
https://hera.rtfd.io
Apache License 2.0
601 stars 106 forks source link

Refactor mixins #1047

Closed elliotgunton closed 6 months ago

elliotgunton commented 6 months ago

I was getting into a world of pain trying to refactor #1041 and getting into circular imports, so I've done it separately so it's understandable and made an extra single functional change - updating OneOrMany to use a typing.Sequence type, which resulted in a small fix in _create_hera_outputs_volume.

_meta_mixins.py are all the build-time related mixins such as ExperimentalMixin and ModelMapperMixin, and the code is all self-contained so does not import _mixins.py, while _mixins.py is free to import _meta_mixins without getting circular dependencies.

This also required removing ArgumentsMixin as a parent class of CallableTemplateMixin, which now has an extra hasattr check for clean linting.

I also tidied up some private attributes in workflow.py/workflow_template.py