Question from someone who doesn't really understan...
# nextflow-plugins
a
Question from someone who doesn't really understand the world of Java packages, can we import a nextflow plugin into another piece of Java/Groovy software?
j
Short answer is yes, of course Long answer. Yes but your tool can include a lot of unnecessary dependencies (you can exclude them but you'll deal with dependency hell). But most important is how the plugin is "written". I mean, if the code-logic is well structured with a clean separation between nextflow and business logic can be easy but ....
blob ty 1
as a PoC I've created this (very dirty) example https://github.com/incsteps/nf-schema-cli
the "key" (worst) part is nextflow nor plugins publish to a central repository artifacts so I needed to include them in a local folder "lib" this is not a good practique but .... it works As you can see this is a command line java application trying to validate a "codified" map using the plugin but from here can be easy to implement the command line logic Let me know if some part are not clear
a
Thanks Jorge!
I see... So the tradeoff is awkward code vs writing a whole new codebase for a CLI tool which may cause deviations. Decisions, decisions...
j
I think nf-schema has a clean separation between "business" logic and nextflow dependency IMHO is not difficult to separate them and create a new "jar" module and publish it in maven central In this way can be very easy to use it in the plugin and in a cli If this is difficult or looks complicated , "my approach" can be valid (but a little dirty)
a
@Nicolas Vannieuwkerke eyebrows
n
Interesting! Yeah you should be able to just import the used classes in a CLI tool and use them there. I don't think they are explicitely private
👀 1
m
I LOVE WHERE THIS IS GOING
ADAM FOR PRESIDENT
a
and create a new "jar" module and publish it in maven central
Let me raise an issue in nf-schema for that bit in particular!
j
after re-reading the thread, right now I've cloned nf-schema and I'm creating a runnable jar with it so you can have the plugin version plus the runnable
😆 1
still dont fully understand the use case but can be a starting point
a
nf-schema is used for validation, but I also want to do stuff with the schema file not related to validation.
So I want to reuse some shared components.
j
for example?
I want to automatically generate parameter docs from the nextflow_schema.json and add them to markdown
Another example is I made a Slack plugin and was immediately asked for it to support Teams, which is silly. There should be a dedicated
nf-msteams
plugin, but they can probably reuse components.
n
a
We should check we aren't duplicating work with these two 😅
n
Yeah it's inspired by your plugin, but very limited as of now 😁
j
so I'll forget to create a nf-social plugin 😆
🤣 2
n
Might be better to just merge them?
a
I dunno...maybe you want to post to Facebook when the pipeline completes?
🤩 1
🤣 1
Might be better to just merge them?
No, they're quite different and going to diverge
and the user base should be almost 100% separate
n
Okay fair enough 😉
a
think about it fix minor typo in Teams small feature -> run 300 Slack tests
Or from a user perspective: I'm a Teams user, why the hell is the release blocked by problems with Slack???
n
It would probably be vice versa, so yeah okay let's keep them separate 😛
j
about the nf-schema: I've forked the repo and create a simple "Markdown.groovy" class Also I've add some configs in the build.gradle so running the
shadowJar
task you obtain a runnable jar , you can use for example:
java -jar build/libs/nf-schema-2.7.0-all.jar  -f build.gradle
https://github.com/incsteps/nf-schema/blob/master/src/main/groovy/nextflow/validation/Markdown.groovy
👀 1
m
maybe you want to post to Facebook when the pipeline completes?
I actually would love a post to LinkedIn for the megatests
😐 1
(joking, but I can see people wanting that)