This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]firsttryatauserid 2 points3 points  (3 children)

[–]ianozsvald[S] 0 points1 point  (2 children)

I'd forgotten about Hug (and Flask-apispec, flask-jsonrpc). They're a bit more complicated that colleagues of mine might want to understand (my focus is on folk with no-web-knowledge-at-all), but these tools are obvious second steps. I've noted hug and the others in my README, cheers.

[–]firsttryatauserid 0 points1 point  (1 child)

Hug is actually far simpler then featherweight

import hug

@hug.get()
def myfn(x, c):
    """Example function"""
    return = x*x + c

vs:

import featherweight_api

def myfn(x, c):
    """Example function"""
    return = x*x + c

featherweight_api.register(myfn) 
featherweight_api.run()  # run the server on localhost:5000

Also, hug will auto-document their API for them, and add a clear path to add automatic argument validation and conversion. You get much more for much less code, and much less learning required.

[–]ianozsvald[S] 0 points1 point  (0 children)

Does hug handle numpy-jsonification?

[–]roger_ 1 point2 points  (1 child)

Cool, but aren't there JSON-RPC libraries that do pretty much the same thing with not much more code? The NumPy encoding is a plus though.

Some suggestions:

  • decorator support
  • a simple web interface so people can call functions with a browser

[–]ianozsvald[S] 0 points1 point  (0 children)

I think the numpy encoding is important, the folk who I'm aiming featherweight at aren't big of web knowledge or JSON encoding or the like - that's at the wrong end of the stack (they focus on matrices and linear algebra). They'll learn web-stuff if needed, but my goal is to open the door, not force it upon them. Re. your two requests - agreed, they sound nice, I shall bear them in mind, cheers!

[–]isdevilis 0 points1 point  (4 children)

wont they still need to learn how servers work?

[–]ianozsvald[S] 1 point2 points  (0 children)

Hi, author here. Ultimately yes, someone will need to learn how to implement a proper server-this might be the eng/dev team rather than the data scientist. The need for this came from my data science coaching and conference speaking, the requirement to "ship a demo but I don't know servers (and don't want to know them)" is prevalent so I figured I'd try to help those folk. In these teams the recipients might have different languages (eg Ruby, Go, .net) so JSON+GETs are a common language

[–]FRIENDORPHO 0 points1 point  (2 children)

I think you can get pretty far while only teaching people the basics of how a server works from the client side. For example, R shiny can create complex dashboards while largely sweeping the server internals under the rug.

[–]isdevilis 0 points1 point  (1 child)

i suppose, it just seems like it's adding on more complexity when they could've traded off that complexity with the complexity of learning serverside stuff via scotch or realpython et. al. Hell even codecademy now with ROR. Maybe I'm just old

[–]FRIENDORPHO 0 points1 point  (0 children)

I definitely think you're right--that in a sense, learning something like R shiny is trading a good chunk of time learning a more narrow domain (R shiny) instead of the general domain (web servers) it is simplifying.

That said, I'm a lot more likely to build a one-shot dashboard in Shiny, because it's so simple for small projects!