Package: epyk
A single module to link Python ecosystem to the Web.This project is in active and constant improvement so do not forget to run the below command to always get the latest version install.pip install epyk --upgradePresentationAbout the projectWe started the implementation of Epyk already few years ago in order to help Python developers (from beginner to advanced) to present their work to clients or colleagues. At this time there were only few packages in Python available and it was quite difficult for people to move to web technologies like JS, HTML and CSS.With this idea we started to create Epyk, a kind of transpiler which is dedicated to assist from Python the developers to develop rich web UI.
It will try, thanks to the autocompletion provided by the library, to familiarise the developer / data scientist in the wording of web technologies. Indeed we tried as much as possible to keep the same naming convention for CSS attributes and Javascript function to simplify the review of the transpiled HTML page if needed.Today Epyk is a bit more than a transpiler as it will encompass more than100JavaScriptand CSS modules.Most of the popular web libraries (JQuery, Bootstrap, ApexCharts, ChartJs, Tabulator, AgGrid...) are available from the Epyk components. The resulting page transpiled will only import the ones needed for the selected components.QuickstartFor people impatient to understand the concept, you can test the below minimalist dashboard.Install Epykpip install epykThe below code will create a simple interactive dashboard relying on internal mock data.importepykaspk# Just to get mock data to testfromepyk.mocksimportrandomspage=pk.Page()page.headers.dev()js_data=page.data.js.record(data=randoms.languages)filter1=js_data.filterGroup("filter1")select=page.ui.select([{"value":'','name':'name'},{"value":'type','name':'code'},])bar=page.ui.charts.chartJs.bar(randoms.languages,y_columns=["rating",'change'],x_axis='name')pie=page.ui.charts.chartJs.pie(randoms.languages,y_columns=['change'],x_axis='name')page.ui.row([bar,pie])select.change([bar.build(filter1.group().sumBy(['rating','change'],select.dom.content,'name')),pie.build(filter1.group().sumBy(['change'],select.dom.content,'name')),])More information in the docGetting started with EpykUsageFirst install Epyk to your Python environmentFrom static pagespipinstallepykCreate a report and change CSS3 or add JavaScript events.importepykaspkpage=pk.Page()page.headers.dev()button=page.ui.button("Click me")button.style.css.color="red"button.click([page.js.console.log("log message")])....# Then to produce the html pagepage.outs.html_file(path="/templates",name="test")Using a web serverGo to the next level and add real time flux in few lines or code. Epyk allows to integrate concepts of Reactive programming thanks
to Python 3 and asyncio. All the features available in JavaScript (socket, websocket, observable ...) can be used as long as the underlying webserver is compatible.If the underlying web server is not compatible with those modern features, Ajax (post, get...) are also available.
More examples are available in the []template / interactive](https://github.com/epykure/epyk-templates/tree/master/interactives) section.On the client sideimportepykaspkpage=pk.Page()page.headers.dev()socket.connect(url="127.0.0.1",port=3000,namespace="/news")input=page.ui.input()pie=page.ui.charts.chartJs.polar([],y_columns=[1],x_axis="x")container.subscribe(socket,'news received',data=socket.message['content'])pie.subscribe(socket,'news received',data=socket.message['pie'])page.ui.button("Send").click([socket.emit("new news",input.dom.content)])page.outs.html_file(path="/templates",name="socket_example")On the server side (using socketio)fromflaskimportFlask,render_template_stringfromflask_socketioimportSocketIO,emitapp=Flask(__name__)app.config['SECRET_KEY']='secret!'socketio=SocketIO(app)@socketio.on('new news',namespace='/news')defnew_news(message):values=getSeries(5,100)result_pie=chart_data.chartJs.y(values,[1,4,5],'g')emit('news received',{"content":message,'pie':result_pie},broadcast=True)From NotebooksWe maintain a separate Github repository of Jupyter Notebooks that contain an
interactive tutorial and examples:https://nbviewer.jupyter.org/github/epykure/epyk-templates-notebooks/To launch a live notebook server with those notebook usingbinderclick on one of the following badge:More examples are available on theofficial repositoryCompatibility / Open Source StackNo dependency hence  the library can be integrated to any existing Python projectEpyk is compatible with the most common Web Python Frameworks (Flask and Django).
By default, the server package embeds a Flask app as it is easier to install and ready to use.The Framework can be included within a Jupyter or JupyterLab project. But this will lead to some limitations - for example Ajax and Socket will not be available.The generated Web pages are compatible with the common modern web frameworks.ResourcesDocumentationChangelogTemplatesGalleryCollab & JupyterStackoverflowComing soonEpyk Studiois a rich and collaborative framework to simplify the use of this library with bespoke configuration / styles. You can start downloading ithereor contribute to the project on theGithub repository. This is still under development hence it is not yet official releasedFeedback and ContributionSeeCONTRIBUTING.mdPlease get in touch if there is any feature you feel Epyk-UI needs.DonateWant to donate? Feel free. Send toblockchain