User packages howto?

I have a package with a few custom flux functions (and one implemented in Go, as builtin, I am using a flux repo fork for playing with Flux.

Now if I wanted a customer to test the package I should create a reusable (and distributable?) user package as I’ve seen in Paul Dix’s presentation.

What is the status of user packages support, please? I could not find an example or a documentation.

One thing that worries me is what if you need to call a custom function implemented in Go, will it be supported?

Thank you!

1 Like

I think packaging only works for pure Flux code, if you added a custom function written in Go you either need to submit a PR or provide your customer with a build from your fork.

That is possible for sure. On the other hand Flux code base cannot be polluted with every customer specific extension, while customers will likely insist on using official distribution.

I was thinking that a mechanism similar to external plugins in Telegraf 1.12+ (Go plugin feature) could be used for Go functions in a user package.

We’ll start work on the package manager and user packages later this year, likely in April or so with it available shortly after that. However, that’ll only be useful for pure Flux functions. For the stuff you’ve written in Go, can you share what it is? I’m wondering if there’s a way to represent that in pure Flux.

1 Like

@pauldix The function in Go calculates a set of geohashes which covers specified lat/lon box area and the resulting set is used as contains() parameter in filter() like

  ... |> filter(fn: (r) => ... and contains(value: r.g5, set: ext.calcGrid(minLat: 40.1, minLon: -73.5, ...))

The function uses library for geohash calculations and neighbors search, and itself is basically just a loop.

@alespour More details on plans for user packages (and local reusable Flux code) are available in a recent Flux Github issue.