Dance.jl - Python Flask equivalent web framework

Hello Julia community,

Am pleased to announce a new web framework focused on facilitating process of outputting Julia computed data to the web very easily. Feel that reason Python is still more mainstream than Julia is simply due to complete ecosystem of tools. More precisely many data scientists can easily use Flask to share their data with outside world. Not to that mention staying with 1 backend language is simply easier for many large teams.

Which is why I have developed Dance.jl along with 2 plugins for integration with Docker and Webpack. Idea of project is to remove web abstraction layer for average Julia user, so that we can focus on what is really important: fast and complex data manipulation.

As quick summary on how to setup HTML and JSON GET/POST endpoints:

import DataFrames

using Dance.Router


function get_df() :: DataFrames.DataFrame
    return DataFrames.DataFrame(A = 1:4, B = ["A", "B", "C", "D"])
end


function get_string() :: String
    return "Hello World"
end

function post_dict(dict::Dict) :: Dict{String, Any}
    return dict
end


route("/", get_string; method=GET, endpoint=EP_HTML)
route("/dataframe", get_df; method=GET)
route("/dict", post_dict)

Using regex as well as grouping routes of similar parameters is also possible:

route_group(route_prefix="/dict", method=GET, endpoint=EP_HTML, [
    (path=r"/(?<value>\d.)", action=dict_1)
    (path=r"/(?<key>\w+)/(?<value>\d{3})", action=dict_2, html_file="html/file")
])

For more details, please take a look at each package’s readme here.

Or for the impatient reader, a hands-on quick demo project that I have made for a hackathon.

Is still very young package as you can see from Github project roadmap, so welcome all kind of feedback.

Cheers

24 Likes

can you please name a keyword/s can help me to understand how this form of functions like (post_dict) works in Julia?

Hi Waseem,

Really sorry for delay in getting back, but was taking time of due to fatigue.

Anyways, not sure I fully understand your question.
Are you asking about logic of input params to post_dict, or how their value is obtained in background?

Thank you!

The package seems very interesting, specially in simple websites (I said simple due to the HTML output, it is a little limiting in my opinion). It can be specially useful in combination with JS frameworks, and in which the dynamic output should be returned in JSON to compose.

I expect when to have more free time to give a try, and compare with other Julia frameworks. Good work!

Have released v0.2.1 which fixes the annoying error should you be using other 3rd party libraries in project along with Dance.
This as import context was relative to Dance package and not to your project …

Still a lot to add agree.
Would like to add ORM support for ClickHouse and rewrite another library to HTTP.jl to have faster web server.

If anyone is using Windows, can you please test solution from Equivalent of chmod to change file permissions in Windows - Super User (icacls * /<project_dir_name> /t /c /q ) after you launch new project. As don’t operate on Windows OS unfortunately and would like to fix this bug if possible.
Thanks!

1 Like