Julia Community 🟣

Cover image for Oxygen.jl: A breath of fresh air for programming web apps in Julia

Oxygen.jl: A breath of fresh air for programming web apps in Julia

Nathan Ortega on June 06, 2022

I'm excited to announce Oxygen.jl, a micro-framework built on top of the HTTP.jl library that's designed to simplify building web applications in J...
Collapse
 
ifihan profile image
Ifihanagbara Olusheye • • Edited

This is nice. The first thing that came to mind was this is Flask but for Julia and I'm happy I saw it in the post. Great work 😄

I'll try it out and if I find have any questions, I will ask

Collapse
 
melonedo profile image
melonedo • • Edited

I am so exited to see that Julia finally have a web server that does not heavily rely on global states! It feels much more "Julian" than existing frameworks.

By the way, I am very interested in how you implement the @route macro, because it does not seem obvious to me how to manipulate a function by its signature. In python it is done with a special annotation system, how do you do that in Julia?

Collapse
 
ndortega profile image
Nathan Ortega •

That's a great question! And one that was difficult for me to figure out as well. It involved a lot of googling and reading into the Base library documentation

Essentially, there's a low-level api just for methods that's pretty good at extracting useful information. I was able to extract the number of function arguments and their types, but was unable to get the name of each variable.

I found a snippet in the julia forums that did exactly what I needed and modified it a bit to return strings instead of symbols.

(get parameter names)
github.com/ndortega/Oxygen.jl/blob...

(get parameter types & count)
github.com/ndortega/Oxygen.jl/blob...

(low-level api)
docs.julialang.org/en/v1/base/base...

Collapse
 
cjdoris profile image
Christopher Rowley •

Looks cool, I too have wanted "FastAPI for Julia".

Collapse
 
logankilpatrick profile image
Logan Kilpatrick •

Same here, Jeremey Howard (creator of FastAI) has said many times that having things like FastAPI is critical for Julia's long term success so I am excited to see this!

Collapse
 
emmanuel_r8 profile image
Emmanuel_R8 •

Great work! Looks almost as easy as the R Plumber framework. Almost, because Plumber automatically generates the Swagger description.

I have no idea about the amount of work that would be involved, but does an integration with the Genie/Stipple framework make any sense?

Collapse
 
emmy profile image
emmy •

cool

Collapse
 
abhimanyuaryan profile image
abhimanyuaryan •

so nice Nathan congrats on making an awesome package :)

Collapse
 
ericforgy profile image
Eric Forgy •

Neat 👍

Your motivation was the same as mine when I wrote Pages.jl. Have you seen it?

Collapse
 
ndortega profile image
Nathan Ortega •

Up until now, I have not! But that's because the prototype I was working on a month ago was supposed to be a simple REST api with no front-end. I had no plans to add websockets to communicate with the browser

Collapse
 
imresamu profile image
ImreSamu •

Please add a benchmark :-)

to -> github.com/TechEmpower/FrameworkBe...

Collapse
 
edwinlock profile image
Edwin Lock •

Very nice. Do you happen to know whether there's a templating engine (like Jinja for flask) that can be used in combination with Oxygen?

Collapse
 
ndortega profile image
Nathan Ortega •

There's a package called Mustache.jl which is a generic templating engine. They should be compatible, but I haven't tested this yet. Let me know if you run into any issues.

github.com/jverzani/Mustache.jl