Skip to content

Conversation

@StefMa
Copy link
Owner

@StefMa StefMa commented Nov 19, 2025

The Workflow.pkl was basically a god file.
It could handle everything.

I extracted all classes out of it and transformed it to be an module instead (which is in fact also a class 🤓 ).
This is not only better in terms of SRE, I guess with using module instead of class its more idiomatic pkl, I guess 🤔 .
The Workflow is left being just an template.

Since every import from the template is also visible downstream to any ammending modules, this should not even break anything.
The only thing I found is the ReusableJob, that is not accessible anymore but requires an import. But this is fine I guess...


I'm not sure if this is a good way to handle a pkl project.
I haven't seen any other packages doing that.
But I also haven't seen any other pkl project being so large yet 😅

To me (mobile Kotlin developer by day) this approach looks way nicer than before.

Would be great if someone of you guys can tell me if this is good way to do or not 🙏
@bioball @HT154 @stackoverflow
Thank you 🫂

@bioball
Copy link
Contributor

bioball commented Nov 22, 2025

Yeah, this is a nice quality-of-life improvement.

This is a breaking change, because you are removing names from Workflow.pkl.
For example:

amends "Workflow.pkl"

local step: Step = new { ... }

Previously, this would have worked, but now breaks.

You can preserve compatibility by exporting the value as a typealias:

import "Step.pkl" as StepModule

typealias Step = StepModule

But, at this point, I don't know if preserving backwards compatibility is an important goal for you or not.

@StefMa
Copy link
Owner Author

StefMa commented Nov 22, 2025

Thanks for the feedback @bioball !
As I saw your PR on pkl-pantry I already imagined that this is a good way to go.

Thanks for pointing out the breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants