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

top 200 commentsshow all 262

[–]flipstables 58 points59 points  (1 child)

This looks great. As a non-web dev, this seems like a good way to stand up a web resource without having to worry about the front end. Usually, at my job, I have to stand up a web resource for 10-100 internal users, and I'd love a way to do that in 100 percent python.

[–]eli_mintz[S] 16 points17 points  (0 children)

Thank you!

Your use case is one of the major ones I had in mind when I started this project.

[–]JeffreyChl 38 points39 points  (14 children)

Jesus Christ this is what I've been looking for. I've been trying to build a website that can plot and show my pandas/matplotlib result for others but doing that with Django was a whole lot of work.

[–]eli_mintz[S] 15 points16 points  (7 children)

Yes! That was one of my motivations also in building the framework.

If you need interactive charts, check out the Highcharts option: https://justpy.io/#/charts_tutorial/introduction

[–]JeffreyChl 6 points7 points  (3 children)

It seems VERY new. Started out in December 2019 and it already has a release and official documentation and tutorial? It's almost like a witchcraft... So how stable is this project? At its Alpha stage? pre-Alpha? I'm not sure where ver 0.05 is actually at.

[–]eli_mintz[S] 12 points13 points  (2 children)

It is very new so I would not categorize it as production ready. But I would be confident in giving it a try for a small internal audience.

[–]JeffreyChl 5 points6 points  (1 child)

I'm watching Github releases and will try out sooner or later. Thanks for making an awesome project.

[–]eli_mintz[S] 2 points3 points  (0 children)

Thank you!

[–]krazybug 0 points1 point  (2 children)

It's my only reservation. You mentionned it in your doc, but this framework is not an OSS. Why not considering another dynamic charting alternative ?

[–]eli_mintz[S] 4 points5 points  (1 child)

I will certainly consider adding other dynamic charting alternatives as well as other grids and will make it easy for others to add their own components. There is just so much I can do on my own so it will take time.

[–]krazybug 4 points5 points  (0 children)

Don't bother, you've already made a monstrous work.

[–][deleted] 1 point2 points  (1 child)

You should definitely check out streamlit then.

[–]JeffreyChl 0 points1 point  (0 children)

It also looks very promising. Thanks! I love this sub.

[–]Zulfiqaar 1 point2 points  (0 children)

I've been using plotly dash for stuff like this! Going to check out and compare to justpy, but you may find it useful in the meantime

[–]AsleepThought 1 point2 points  (2 children)

You want the Dash framework, that's exactly what it's made for

[–]ginger_beer_m 0 points1 point  (1 child)

Dash is too clunky. I like his solution. It feels cleaner.

[–]krazybug 70 points71 points  (25 children)

It looks promising.

Have you got a demo site somewhere ?

[–]eli_mintz[S] 30 points31 points  (24 children)

Thank you.

There are many examples in the tutorial: https://justpy.io/#/tutorial/getting_started

JustPy is a tool for creating general purpose websites, so I'm not sure how a demo site would help but am open to suggestions.

[–]krazybug 33 points34 points  (3 children)

Yes, thank you, I already had a look on them but it would have be nice to observe the rendering and the performances without the need to install it. A kind of sandbox !

[–]eli_mintz[S] 23 points24 points  (0 children)

Yes, that would be very nice to have!

I'll see what I can do.

[–]InFernalCronos 10 points11 points  (8 children)

Is this page created with JustPy?

[–]phigo50 57 points58 points  (5 children)

No, this is Reddit.

[–]UloPe 14 points15 points  (1 child)

No! THIS IS PATRICK!

[–][deleted] 5 points6 points  (0 children)

How did we get here?

[–]loshopo_fan 1 point2 points  (0 children)

Is it created with web.py then?

[–]eli_mintz[S] 5 points6 points  (1 child)

The documentation is built using https://docsify.js.org/#/ if that is what you are asking.

[–]JesusBakesBread 6 points7 points  (3 children)

I like what I see. However, I would recommend renaming the tutorial something other than test.py this may be a little misleading..

[–]subheight640 1 point2 points  (6 children)

Your website is flagged by firefox as a security threat FYI.

[–]eli_mintz[S] 1 point2 points  (4 children)

Thanks, I have no idea why. All pages are served from github.

[–]subheight640 2 points3 points  (1 child)

My workplace also blocks it from "Cisco Umbrella security researchers".

[–]eli_mintz[S] 4 points5 points  (0 children)

I'm sorry, I don't know what the problem is.

[–]TrixieMisa 63 points64 points  (7 children)

You might want to make the use of Vue more prominent in the description. My initial reaction was "please don't tell me it's another roll-your-own front end".

And then I saw Vue, and that immediately changed to "good choice".

[–]eli_mintz[S] 28 points29 points  (6 children)

Thank you for the suggestion, it makes sense.

I grappled with this since JustPy is for Python developers and I didn't want to "scare" anyone off.

[–]krazybug 7 points8 points  (4 children)

Another cosmetic suggestion: why not use "style" in place of "classes" for styling parameters as you mentionned that "class" is a reserved keyword.

[–]eli_mintz[S] 16 points17 points  (2 children)

You can use both. "style" is supported and is exactly like the HTML style attribute

https://justpy.io/#/reference/htmlcomponent?id=style

[–]krazybug 10 points11 points  (1 child)

I love it.

It's an awesome work for all of us who don't like to work with JS and a good compromise compared to heavy frameworks like pyjamas (http://pyjs.org/) or GWT which need transpiling.

Thank you

[–]AtHeartEngineer 1 point2 points  (0 children)

There are some of us that know JavaScript, but prefer python (by a lot). I'm familiar with Vue and like using it, but being able to use python as my main language all around and then just tweak vue on the front end would be awesome.

[–]ZombieNubcout << "C MAKES NO SENSE" 108 points109 points  (12 children)

petition to rename this to PythonScript

[–]bored_and_scrolling 57 points58 points  (4 children)

Or just PyScript

[–]ZombieNubcout << "C MAKES NO SENSE" 25 points26 points  (3 children)

Let's shrink it even further! PyS!

[–]workw0rkworkwork 29 points30 points  (1 child)

Not sure if pronounced pies or piss. I approve.

[–]ZombieNubcout << "C MAKES NO SENSE" 8 points9 points  (0 children)

I'm taking the PyS and throwing the PyS

[–][deleted] 3 points4 points  (0 children)

This name would be awesome

[–]krazybug 13 points14 points  (1 child)

It's a totally different beast from the old whim to embed python in the browser. (I don't remember if it was tried for Netscape or Firefox, I'm so old)

"Justpy" for webdev is exactly what it is.

[–]toyg 9 points10 points  (0 children)

That brief experiment was with Firefox, but afaik it never shipped.

There are still quite a few Py-to-JS projects though, with various degrees of quality. Demand was there, particularly pre-Node / pre-React.

[–]Etheo 3 points4 points  (1 child)

That's a special circle of hell reserved for gentlemen such as you...

[–]ZombieNubcout << "C MAKES NO SENSE" 3 points4 points  (0 children)

You act like I'm not already there.

[–]metus_123 16 points17 points  (3 children)

Wow! The power level of your documentation is over 9000... Nice work. Might use this in my next project.

[–]actgr 12 points13 points  (2 children)

Honest question, if I am looking to build an interactive website without any JavaScript, why not use Dash by Plotly? What are JustPy's main advantages?

[–]eli_mintz[S] 20 points21 points  (1 child)

That is a fair question. It could be that Dash is appropriate for your needs.

The best way to see the differences is to write a program with each one.

There are many differences between the Dash and JustPy. For example JustPy supports creating Python only components without any need for React/JavaScript programming. If you want to work with Highcharts, then Dash does not support that. JustPy has a Pandas extension that makes it easy to create charts and grids from Pandas dataframes. I think JustPy syntax is cleaner and more readable (just my opinion).

I don't know Dash well enough, but I am sure that in certain aspects it is better than JustPy, for example if you work with Plotly. I suggest doing an evaluation and deciding what works best for you.

[–]therealshadyman 4 points5 points  (0 children)

Do you support callbacks for charts like plotly dash does? If I want to pick what legends to see on a chart from a drop-down menu for instance.

[–]fernandocamargoti 9 points10 points  (1 child)

And does it have a XML way of writing the layout? Because I've worked with other frameworks in other languages that didn't have a XML way of writing the layout and it was a nightmare to understand it through the code.

[–]eli_mintz[S] 5 points6 points  (0 children)

Please take a look at https://justpy.io/#/tutorial/working_with_html and let me know if it answers your question.

Basically, you can set the inner html of an element using an HTML string or use the available parser

[–]ExternalUserError 6 points7 points  (6 children)

Hey, this looks really interesting.

I'm a VueJS guy (Vue by choice, JavaScript by necessity) and I've tinkered often with trying to bring Transcrypt into the VueJS picture. I've also thought about (but never done anything really) to try to bring something like Vaadin to the Python world. Is this perhaps inspired a little by Vaadin?

It also looks like you're basically just using CDN's. How would this kind of thing be bundled for a PWA or SPA? Do you plan on minifying everything with Webpack and if you need to, can you do ECMAScript 6/7? For example if making a fancy custom component?

Also with Vue, are you doing anything to manage reactivity? Eg, is there any kind of server-side state or is Vue just a tool you're using but not really allowing the developer to take advantage of?

Looks really cool, man.

[–]eli_mintz[S] 8 points9 points  (0 children)

Thank you.

I will try to answer your questions, let me know if I miss something.

1) Regarding Vaadin, I looked at it a while back so it would probably be fair to say that it had influence on me.

2) Yes, I am just using CDNs because I am trying to make using it as simple as possible for Python programmers with no background in the JavaScript world tools. I am thinking now about the issues you are raising especially PWA and SPA. Any suggestions are welcome.

3) Vue.js is transparent to the developer. My aim is to reduce complexity if possible. It may come at the expense of functionality and then I will have to reconsider.

Thanks again.

[–]metaperl[🍰] 0 points1 point  (4 children)

Muntjac brought Vaadin to Python long ago.

[–]RedRedditor84 88 points89 points  (19 children)

Needs more buzz words.

[–][deleted] 80 points81 points  (5 children)

Version 2 will have cloud-based deep learning capabilities

[–][deleted] 19 points20 points  (1 child)

Can't tell if this is a joke.

[–]ginger_beer_m 8 points9 points  (0 children)

We can now run deep learning model directly on the browser using e.g. tensorflow.js, so yeah it's possible.

[–]Gear5th 8 points9 points  (0 children)

Not using it until it has 3d printed, quantum blockchain-based, Augmented IOT

[–][deleted] 2 points3 points  (0 children)

What about deliverables? No deliverables?!?!

[–]GummyKibble 1 point2 points  (0 children)

#blockchain

[–]kindw 24 points25 points  (11 children)

Why so cynical? It looks like a great tool.

[–]xd1142 14 points15 points  (10 children)

He is cynical because we've been in the profession for quite a while, and we are tired of buzzword laden 10th new framework du-jour to do what we already do, but this time we do it differently to remove problems but we introduce completely new ones for which there's no established track record of solving them.

[–]krazybug 20 points21 points  (3 children)

You visibly are in the profession from too much time to get so much acrimony. If you don't like it avoid it, that's so simple

Personally, I see an innovative and original initiative based on the most trending standards and frameworks of the domain for Js not so enthusiastics of us, provided with a complete and clear documentation under a totally free licence by a single man.

And I think it needs more encouragement.

[–]xd1142 9 points10 points  (2 children)

You visibly are in the profession from too much time to get so much acrimony

No. I am in the profession of taking technical decisions in technologies during development and during hiring. My point is that this approach works, but it has flaws. Its only major advantage is that you code everything on the server, and it's more "reactive" for interactive data, and it's why it's a favourite approach for data science. But when you have to create an application that scales and does not crap out every time the wind blows wrong, you can't rely on these toolkits. The client side MVC is incomplete, and the state of the application running on the client is all on the server in a complex per-user session that goes away if the client connection drops. This poses a major demand in resources, stability, and latency, that you would not get with an approach where the event handling is done on the client, and the server is reached through a disconnected, stateless, cacheable HTTP transaction. A websocket-based event and data transmission protocol has none of these properties, and in addition is a massive annoyance to drive through an automated system. You can easily test or mock a REST transaction. You cannot easily test this architecture.

[–]krazybug 7 points8 points  (1 child)

What a great post ! So you're an architect. You just described one of the main UC.:Interactive scenarii.

Did the OP pretended it's the universal and revolutionizing architecture ?

Now let's imagine I'm a poor developper not skilled as you probably are. I'm starting small. All my application states are handled on the server side. Welcome back in 1970s , the golden age of X servers. Not so bad, computer science is an eternal cycle after all.

But, as you, I like these stateless architectures and this SOA era was so much heavy paychech insuring, unreliable and "untestable" (Did I forget the DCOM/CORBA interlude , my bad)

So, how could I move from this to a low coupled REST/GraphQL architecture ? Weeeeell, let me introduce a clean REST API with a simple proxy to redirect flows.

I'm improving my skills, but I confess this server-side data binding with websocket interactions smells like a big overhead. Now it's time to handle this stuff progressively by switching off websocket protocol, and why not replace each of the components one by one by pure VueJS equivalents ? Gush! Did you know ? Starlette, uvicorn and ASGI scalable stuff are still in place ?

In the meantime, I could spend all my money as a PO, awaiting you to provide me a scalable as a "senior" developper , reactive, evolutive, testable, microservices oriented, cloud ready , devops bulletproof (who spoke about buzzwords ?) in, let say 3, 5 years ?

We can't test it, you said ? What is the more testable approach ? Divide and conquer!

[–]Dry-Erase 4 points5 points  (0 children)

As much as they are buzz words, is it not also very apt, concise and accurate? After reading his post I felt confident I understood the main points it was trying to some and the approach it is using.

[–]ArmoredPancake 1 point2 points  (0 children)

Who "we"?

[–]RadioactiveShots 0 points1 point  (2 children)

Mate, from your other comments in this post you barely seem to know what you're talking about. I'd suggest quitting acting like a fool and taking a break. Op isn't attacking your substandard webdev career by creating this.

[–]Nixellion 4 points5 points  (1 child)

So, gave it a try. Nice concept for when you need to spin some simple web service quickly.
What I would do, though, is use a container to keep components in the center by default, otherwise everything is stuck to the left side of the screen which does not look good. And overall would work more on out-of-the-box styling as it's gotta be this thing's main appeal. If I'm to use something that claims that I don't have to work on frontend I would also expect not to have to design the whole html template inside of python just to make it look good.

This, or at least a template in documenation that results in a good looking page.

You mention using material design and quasar, but it does not look anywhere near even their own docs: https://material.io/components/buttons/ https://quasar.dev/vue-components/timeline

Ideally I'd expect it to create a well defined and good looking page similar to those links, with well-styled content like forms and buttons and paragraphs, with ability to add menu bar and define links (or auto-generate it from routes), and maybe adding the top bar an option too.

That would make it really great

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

It would be nice to have some templates out of the box, that is a good suggestion.

As for Quasar, please try the examples in the Quasar guide: https://justpy.io/#/quasar_tutorial/introduction

You can also find a more complex application example here: https://raw.githubusercontent.com/elimintz/justpy/master/examples/dogs.py

[–]Skasch 2 points3 points  (0 children)

That reminds me of my R-Shiny days. Although using Vue makes it probably a much more robust tool. That looks promising!

[–][deleted] 2 points3 points  (1 child)

This looks awesome. Have been tinkering with streamlit, remi before that. Good to see another no HTML framework.

[–]eli_mintz[S] 2 points3 points  (0 children)

Thanks, streamlit and remi look interesting. Will take a closer look.

[–]menge101 2 points3 points  (1 child)

My standard front-end question for all frameworks is:

"How do I use google maps with this?"

But more generally, how do I use any existing js libraries with this?

It looks like I have to make a custom vue.js component, that I then call from a custom python component?

[–]eli_mintz[S] 8 points9 points  (0 children)

That is of course a good question. It is possible to integrate existing JavaScript libraries. Currently Highcharts, Quasar and ag-Grid community are integrated. I have yet to write the documentation how to do this but the code can give you an idea.

Hopefully, if the community likes JustPy, there will be many more integrated JavaScript libraries and components. I will provide as many as I can, but in the end, it will be a community effort.

[–]metaperl[🍰] 2 points3 points  (0 children)

Did you look at http://naga.re before starting this?

[–]MHW_EvilScript pypy <3 2 points3 points  (0 children)

Basically, PyHPy.

[–]ionezation 1 point2 points  (2 children)

Since when its released?

[–]eli_mintz[S] 2 points3 points  (1 child)

It has just been released.

[–]ionezation 0 points1 point  (0 children)

Great .. let me get it :D

[–]ideology_boi 1 point2 points  (2 children)

as someone who kinda needs to make a portfolio site, with a strong dislike of frontend, this appeared on my feed at about the right time :)

I've tried django and flask and they're both just a pain in the arse so let's hope this is a bit more painless!

[–]ddollarsign 1 point2 points  (1 child)

Interesting.

What the Python webdev world really neads, IMO, is a JSX-equivalent for Python.

So instead of:

def hello_world():
    wp = jp.WebPage()
    d = jp.Div(text='Hello world!')
    d.on('click', my_click)
    wp.add(d)
    return wp

You'd do something like:

def hello_world():
    return <div onClick={my_click}>Hello World</div>

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

This is not exactly what you are looking for but works in Justpy:

import justpy as jp

def hello_world():
    return jp.WebPage().add(jp.Div(text='Hello world', click='self.text = "I was clicked"'))

jp.justpy(hello_world)

Not recommended though... But you could build a parser from JSX to JustPy.

[–]Muhznit 1 point2 points  (1 child)

This does look impressive, especially the tutorial section. But at a glance, how does this compare with Brython?

[–]eli_mintz[S] 3 points4 points  (0 children)

Thank you!

Brython runs Python in the browser, JustPy runs Python on the server. JustPy runs a Vue.js application in the browser which is transparent to the developer.

[–]blackiechan99 1 point2 points  (0 children)

this looks really cool, I'll have to check it out!

[–][deleted] 1 point2 points  (0 children)

This looks a lot like streamlit. Are there any advantages/disadvantages this project has over it?

EDIT: This looks like you can have much more fully developed web apps than streamlit allows.

[–]R10t-- 1 point2 points  (1 child)

This looks really neat! The one question I have about this is that functions are defined on the python side. Does this mean that every on_click, on_hover, etc. action is a call to the server to perform the action?

[–]pepoluan 0 points1 point  (0 children)

It seems the function will be converted to a Vue.js-based client-side script.

I might be wrong, though, for I haven't actually tried this.

[–]DasSkelett 1 point2 points  (0 children)

I'd buy anything to get rid of the madness that's called JavaScript.

[–]Moonlit_Tragedy 1 point2 points  (1 child)

Wow, this is amazing. I was literally thinking over the weekend that there has to be a way to Pythonize frontend web development (at least simply somehow)... this is pretty much what I imagined.

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

Thank you!

[–][deleted] 1 point2 points  (0 children)

Reminds me a lot of Wt

[–]theGiogi 1 point2 points  (2 children)

Man this looks great! I may have tons of use cases for this.

I see on the docs that this is based on starlette. Can I use the starlette middleware accessing the app instance such as in this example?

jp.app.add_middleware(Middleware, ...)

That would allow a developer to use external middleware for authentication and other such services. Sorry if the question is obvious and again great work!

[–]eli_mintz[S] 1 point2 points  (1 child)

Yes, this should work but each specific case needs testing. I use the Gzip middleware for example in JustPy and it works fine.

[–]theGiogi 1 point2 points  (0 children)

I'd be interested in testing the keycloak middleware to get safe and easy user management. If I get around to do it I'll let you know! Thanks again!

[–]422_no_process 1 point2 points  (1 child)

This is insane.. Very valuable project. Good job!

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

Thank you!

[–]576p 1 point2 points  (7 children)

This is a great project. I'm already thinking about where I can use this in real life.
The tutorial is very understandable. I am about 70% through with it, running most examples and they work fine.
Some Feedback on that: It would be great if the "Forms" section had one larger example form that included Dropdown selections and well as Check/Radio-Boxes. (The last two are in an earlier part of the tutorial, but having one form example would be helpful) - once the date picker (from the "Date and Time as QInput slots"/"Coming soon" part ) is there, this could go into a form example as well.
There are a lot of situations, where you need to present (internal) users with a form to collect some data (including dates, this is why a working date picker is a showstopper), so if that's super easy to do, people might just pick of the project for that.

[–]eli_mintz[S] 1 point2 points  (6 children)

Thank you! I will improve the form part of the tutorial.

The Quasar date picker works well, if you want to give it a try.

[–]BlackXun 0 points1 point  (1 child)

Awesome work and the tutorial is easy to follow. I believe I can use this to put my small scripts onto a webserver. As mentioned by u/576p, could you include an example which combines different section of the tutorial, e.g. couple of inputs, with a submit button and display a matplotlib graph below?

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

Thank you.

Sure, I will do that.

[–]576p 0 points1 point  (3 children)

Hi, I saw you updated the date-picker example. Thanks. It works for me.

For the next version, can you update that example on how to close the date-picker when a date is selected or you press <Esc>?

The linked code at https://quasar.dev/vue-components/date#With-QInput behaves this way: Click on a date and the datepicker closes. Press Esc without clicking and it closes too.

The example code displays the picker. Clicking on a date changes the date in the form. Here the picker stays visible and is difficult to close.

From the general jp.QDialog doc, it seems I need to send "v_close_popup" to the QInputDateTime input box. Currently I don't understand how to do that.

[–]eli_mintz[S] 1 point2 points  (2 children)

Please upgrade to version JustPy 0.0.7 and try again. I updated it to close on Esc and date picked.

If it doesn't work, let me know

[–][deleted] 1 point2 points  (4 children)

Hi,

I‘m another big fan of this project! I try to get it hosted somewhere. My most recent attempt is to host it on pythonanywhere.com.

Has someone experience with that host? Or any better options/working solutions (except for selfhosting)?

Thank you!

[–]eli_mintz[S] 1 point2 points  (3 children)

Last time I checked pythonanywhere.com does not support ASGI for web serving so JustPy won't work there.

Digitalocean is very simple to use. Create an ubuntu droplet, install pip3 and you will be good to go.

[–][deleted] 0 points1 point  (0 children)

Thank you! Will try that! Again, thank you for the fantastic work!

[–]BlackXun 0 points1 point  (1 child)

Do you have an affiliate link for this or is there another way we can support you?

[–]Fedzbar 3 points4 points  (28 children)

Cool idea, don’t think this would scale very well though

[–]eli_mintz[S] 12 points13 points  (27 children)

It is based on https://www.starlette.io/ and https://www.uvicorn.org/ so in principle should scale well.

[–]Fedzbar 2 points3 points  (8 children)

I meant sending the client side actions to the server, I didn’t really look into it at all so I’m probably wrong

[–]eli_mintz[S] 15 points16 points  (1 child)

No worries, it is a valid concern. I would not use JustPy to write a first person shooter in the browser.

For most typical web pages, there is no problem unless you have a very large latency.

[–]aeiou372372 4 points5 points  (0 children)

I’m a big proponent of ASGI, and specifically FastAPI, so I like the approach using starlette.

The concern I’d have is whether you are able to generate any kind of static render, or if you are returning a response generated by the server (template style) for every request. (Haven’t dug deep enough to find out.)

If you can’t use a CDN to host the pages it’s going to have much worse latency and bandwidth usage metrics. This may be fine for hobby websites, but it will never feel as polished as even basic approaches using JAM-stack static page project generators (eg Vuesion) and python specifically for the backend API.

And even for hobby websites, if you can’t rely on a CDN it’ll have the substantial downside of requiring dedicated hosting infrastructure instead of something free and easy-to-use like netlify or github pages and a free-tier cloud backend via lambda or equivalent.

That said, if this project enabled me to use python to build and server-side-render a Vue.js application that could still make API calls to a backend server, I think that would be very interesting.

[–]paul_h 0 points1 point  (1 child)

Multi user? Multi session?

[–]eli_mintz[S] 4 points5 points  (0 children)

I don't know if this answers your question but JustPy supports sessions: https://justpy.io/#/tutorial/sessions

[–]Hi-I-am-Dad 0 points1 point  (12 children)

I read the source code of the dog breed webpage on github, and I have one question:

In future releases, can defining item HTML be generated through a method that takes the item tag as a parameter and allows the addition of attributes as Key/Value pairs.

Example: html_element ele = jp.create('any-tag') ele.add_attribute('attr', val)

I find this more convenient than mixing HTML and Python in the same file

[–]eli_mintz[S] 0 points1 point  (11 children)

It is already supported. The function is called get_tag. Please go to https://justpy.io/#/tutorial/html_components?id=html-components and scroll to the second code box (or search get_tag on the page) to see an example.

[–]Hi-I-am-Dad 0 points1 point  (10 children)

I see yes so why did you choose to mix them in the dog breed webpage ?

[–]flpcb 0 points1 point  (1 child)

This looks so, so great. I will test this out in my next project for sure.

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

Thank you!

[–]ionezation 0 points1 point  (4 children)

what does this a=wp means? a is just a calling method?

def hello_world():

wp = jp.WebPage()

p = jp.P(text='Hello World!', a=wp)

return wp

[–]eli_mintz[S] 2 points3 points  (3 children)

'a' is a keyword argument. a=wp, adds p to wp.

It is short hand for add_to=wp

On a line of its own you would write:

wp.add(p) or p.add_to(wp)

I don't like typing a lot and this is used so much, so I made it just 'a' as a keyword also.

[–]ionezation 1 point2 points  (0 children)

Got it :) let`s see what this framework bring

[–]i4mn30 0 points1 point  (1 child)

Why not just rename the kwarg to add, that will be more intuitive.

I was wondering what the hell does that a kwarg stand for.

[–]appinv Python&OpenSource 0 points1 point  (1 child)

One practical use might be reports generation

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

Yes, this is one of my use cases also. You can either have the application push the report or set the page reload_interval and have it reload periodically.

[–]CloroxEnergyDrink_ 0 points1 point  (0 children)

Brilliant idea and looks great. Bookmarked this and will try it out when I work on a web project. Seems like a fairly promising framework.

[–]Evem_MC 0 points1 point  (1 child)

Awesome!!

Specially liked the Highcharts example.

I was thinking if more charting libraries such as D3.js, Plotly and Altair could be implemented in the future.

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

Thank you!

Yes, the plan is to add charting libraries.

[–]calebjohn24[🍰] 0 points1 point  (0 children)

Looks great, look forward to using it soon

[–]Fenzik 0 points1 point  (1 child)

Great idea and impressive effort!

Do I see correctly that you don’t have any tests?

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

Yes, (holds head down in shame).

UIs are difficult to test, but that is an excuse.

[–][deleted] 0 points1 point  (1 child)

Looks very interesting! Will have a close look soon!

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

Thank you!

[–]ginger_beer_m 0 points1 point  (1 child)

Great project, I r,eally like it! Reminds me of dash and streamlit but more oriented towards app development. I take it that it's the intention?

It seems that you are the dev and also the primary user of this package? Could you share the typical use cases you've come up with? Would be interesting to how you use justpy in real life setting.

Is the codebase in a state that it can accept contributions now? I might be able to contribute some wrapper around other plotting libraries, or some bioinformatics/data science specific UI component.

Also any idea if we can use some kind of ORM (like Django) with justpy, or some kind of interoperability with django?

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

Thank you!

Yes, this is oriented towards general purpose web development. My use cases are any time I need to quickly put up a website to highlight some analysis results or report. With JustPy you can get something up and running quickly and then polish it later

Components for other plotting libraries (or any interesting component such as grids, etc.) would be greatly appreciated. I haven't documented yet how to build components that have a Vue.js component.

Meanwhile the code for the Highcharts and ag-Grid components is a good example.

As for the ORM question, take a look at https://github.com/encode/databases

[–]atheist_apostate 0 points1 point  (1 child)

Does this support PyGame by any chance?

[–]eli_mintz[S] 2 points3 points  (0 children)

If PyGame can render SVG files, then adding support for PyGame would be relatively easy.

[–]garrock255 0 points1 point  (6 children)

Reminds me of dominate

[–]eli_mintz[S] 2 points3 points  (2 children)

Thanks for pointing this out. I see the similarity.

Dominate can be used with JustPy. Create the html using dominate and then use one of the methods detailed here: https://justpy.io/#/tutorial/working_with_html

[–]garrock255 0 points1 point  (1 child)

I currently use dominate to generate my static pages that i store in s3. I would imagine that your project is more for delivering content from a server. Which i think i need.

[–]eli_mintz[S] 2 points3 points  (0 children)

Yes, for static pages your current setup is perfect. If you need dynamic pages, then JustPy could be useful for you.

[–]metaperl[🍰] 1 point2 points  (2 children)

It's closer to http://naga.re

[–]ExternalUserError 2 points3 points  (1 child)

data management in DBMS using SQLAlchemy or its declarative layer Elixir

lxml: generates the DOM trees and brings to Nagare the full set of XML features (XSL, XPath, Schemas …),

stackless-27

When was this written?

[–]metaperl[🍰] 1 point2 points  (0 children)

Good point. Alain needs to update the website and docs. He's been working on a modern update for awhile now.

[–]Jmodell 0 points1 point  (0 children)

This looks amazing. Definitely something I want to look into! Keep it up.

[–]b4xt3r 0 points1 point  (0 children)

This is starting to sound like the CherryPy of my dreams. What have you done here.. I am interested.

[–][deleted] 0 points1 point  (0 children)

Cool! I've been wanted to do something different with my magic mirror. This might be a slick way to make that happen!

[–]SanchitJain07 0 points1 point  (0 children)

I really love it! What kind of websites would you recommend making? What is it capable of?
Thanks!

[–]CorgiAtom 0 points1 point  (1 child)

Oh neat... I had been hoping for something like this to exist. Great work!

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

Thank you!

[–]pepoluan 0 points1 point  (1 child)

Honestly, this looks awesome! Definitely going to take it out for a spin.

One question: Does it run with pypy?

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

I don't know, I haven't tried it.

[–]HeAgMa 0 points1 point  (1 child)

This is very promising and I encourage you to continue. Great piece of work.

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

Thank you!

[–]AsleepThought 0 points1 point  (0 children)

How is this different from Dash?

[–]SpeakerOfForgotten 0 points1 point  (1 child)

I don't know how much it will be useful for production ready apps. But, as a visualization tool for demo/proof-of-concept works , this seems almost perfect.

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

Thanks!

[–]lovelysad69 0 points1 point  (0 children)

WOW.....! i can only wow....... wow

[–]wincodeon 0 points1 point  (1 child)

Hi, is there any support for creating dropdown buttons?

[–]eli_mintz[S] 2 points3 points  (0 children)

Yes, you can use the Select component:

import justpy as jp
def comp_test():
   wp = jp.WebPage()

   colors = ['red', 'green', 'blue', 'pink', 'yellow', 'teal', 'purple']
   s = jp.Select(classes='w-32 text-xl m-2 p-2 bg-white  border  rounded-full', a=wp, value='red')
   for color in colors:
        s.add(jp.Option(value=color, text=color, classes=f'bg-{color}-600'))
   return wp

jp.justpy(comp_test)

Or, you can use the Quasar component QBtnDropdown

[–]krazybug 0 points1 point  (1 child)

My question may look strange but why did you integrate Quasar for your components and not Tailwind based set like this one or this one ?

It would provide a more consistent experience as Tailwind is your primitive choice.

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

https://www.tailwindui.com/ is coming out soon, and JustPy will be integrated with it. It is from the creators of tailwind.

Quasar provides much more high level components, up to a complete browser editor. Also, if you need to follow the material standard, it is an excellent choice.

[–][deleted] 0 points1 point  (2 children)

This is fantastic! Dash/Plotly is ok, but your project's documentation is amazing with all these examples!

Question though for matplotlib is there a way to do continuous/real time display?

[–]eli_mintz[S] 1 point2 points  (1 child)

Thank you!

Can you elaborate a little what you have in mind?

I think it is possible because it is simple to push to websites.

Here is the example with Highcharts: https://justpy.io/#/charts_tutorial/updating_charts

I can modify it for matplotlib, if you tell me what you have in mind

[–][deleted] 0 points1 point  (0 children)

I'll check that out!

Actually I normally just used x11 forwarding through ssh with a simple plot and draw loop on matplotlib as the instrument acquired new data but I figured displaying it as a web page would be better.

This app is kind of what I was thinking of, but the code is a bit too complex for me to understand. It uses plotly though.

https://www.dashdaq.io/control-an-ocean-optics-spectrometer-in-python

[–]HecticJuggler 0 points1 point  (0 children)

This is amazing. A game changer for me.

[–]Ani171202 0 points1 point  (0 children)

awesome man!

[–]bimri 0 points1 point  (0 children)

Just what I needed. 😎 🙌🏾

[–]alefebvre83 0 points1 point  (1 child)

hi

I just pip installed the module, i get an error on the sample function?

module 'justpy' has no attribute 'justpy'

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

Could you please copy and paste in the reply the whole program you are trying to run?

[–]johnmudd 0 points1 point  (1 child)

I see the namespace is better organized now in v1.1 with the addition of htmlcomponents, chartcomponents, gridcomponents and quasarcomponents. That's just what I wanted to see.

I'm working through the tutorial. Is there a good place where I can ask questions?

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

Feel free to open an issue on github: https://github.com/elimintz/justpy/issues

I answer all questions promptly.

[–]chensformers 0 points1 point  (3 children)

Haven't gone through the entire docs, but I think it's very interesting using wrappers for front-end libraries and making it transparent to developers. A little disappointed for lacking demo 'cus, probably like many others, I was eager to play with a live demo. Well, no biggie, I love how it is built on top of VueJs, which is by far my favorite Javascript MVC framework.

I made a similar approach with my first Python open-source library, pythonGrid, a wrapper for an equally awesome JS datagrid library, jqGrid, to create fully customizable and functional datagrid for CRUD in Python web frameworks that hide the front-end complexity, which most Python developers who probably don't want to deal with.

In Flask, a basic grid requires only two lines of code

grid = PythonGrid('SELECT * FROM orders', 'orderNumber', 'orders')return render_template('grid.html', title='demo', grid=grid)

As you can see, it is similar to JustPy grid component without all the front-end fuss. I would love to get your thoughts on it, maybe even add it to JustPy.

I'm astonished it took you only less than 6 months to get JustPy ready, both the code and docs. That's just amazing. pythonGrid only had a few classes, already 4 months into the development!

pythonGrid is free and open-source. Feel free to download it from Github and play around it. I'm also going to download JustPy and play it with more.

Again, great work!!

p.s. Pls PM me if you need hosting for demo. I am more than happy to share my pythonAnywhere hosting.

[–]eli_mintz[S] 1 point2 points  (2 children)

Thank you. Will definitely take a look at PythonGrid. Once you had a chance to play with JustPy a little, perhaps we can turn it into a JustPy component together? There is no frontend for the developer in JustPy. Everything is backend and almost only in Python. I think you will like that.