9 ms·
PyJS: write your JavaScript-powered web applications entirely in Python
- mkesper 11y agoIs pyjd dead? https://groups.google.com/forum/#!topic/pyjs-users/kXFZ2RdR2fs https://groups.google.com/forum/#!topic/pyjs-users/kXFZ2RdR2...
- task_queue 11y agohttp://pyjs.org/Translator.html http://pyjs.org/Translator.html >Overall, the general rule is that whoever wants or needs something, they either work around the limitations of JavaScript and the pyjs implementation, or they contribute code to improve the compiler/translator. The lament of the transpiler
- mizzao 11y agoThis looks really old. It doesn't even mention anything about Python 2.7, let alone 3.x. Shouldn't we date the post? Also, I think we have come a long way since the jQuery/AJAX spaghetti that was apparently a huge problem when this was conceived. I don't even think Node was a thing when this started. Things like Meteor and React address most of the issues and much more, such as live data and reactive UI.
- andybak 11y agohttps://github.com/pyjs/pyjs https://github.com/pyjs/pyjs Last updated June 14 > Things like Meteor and React address most of the issues and much more, such as live data and reactive UI. They don't address one major issue - using a language of your choice. (I don't use this project but I keep an eye on all 'Python in the browser' projects' and the minute one looks mature and sensible with some real-world takeup I'll be all over it)
- mizzao 11y agoThat's a valid concern, but I think ES6/ES2015 will help ease the pain of using Javascript.
- andybak 11y agoIt's really not about javascript getting better or worse - it's the fact that I don't enjoy coding in javascript anywhere close to how much I enjoy coding in Python. Javascript would have to morph out of all recognition for that to change. I'm sure other people feel the same about their language of choice too. I'm hoping WebAssembly will open the floodgates for genuine choice in browser scripting.
- dan_blanchard 11y agoThat update was just a README update. Most of the files in the repo haven't been touched in over 2 years and they haven't done a release since 2012.
- andybak 11y agoDamn. In that case - on a related theme: https://github.com/skulpt/skulpt https://github.com/skulpt/skulpt https://github.com/brython-dev/brython https://github.com/brython-dev/brython
- buckbova 11y agoGoodbye pyjamas. I think this project lost its mojo. I really loved the idea but personally decided it best to just use javascript.
- jonathaneunice 11y agoThese "Python in the browser" projects are 1/ very cool 2/ seem entirely doomed. Try the pyjs demos. They're like "the best of the responsive web circa 2007." Some of the demos don't even work, and none of them are particularly snazzy, modern, HTML5-ish, etc. It's difficult to straddle multiple languages, but you can either 1/ bite the bullet and start straddling or 2/ go all-in on JavaScript (or CoffeeScript, TypeScript, Dart... that compiles directly to JS) and a server-side JS implementation (node.js, Meteor, etc.) We're years beyond some-other-langauge in the browser being a gleam in someone's eye, yet it still 1/ doesn't work reliably, with up-to-date or at least near-current Python/Perl/Ruby code, 2/ isn't practical in real life, 3/ has no in-the-wild success examples.
- ralmidani 11y ago> It's difficult to straddle multiple languages, but you can either 1/ bite the bullet and start straddling or 2/ go all-in on JavaScript (or CoffeeScript, TypeScript, Dart... that compiles directly to JS) and a server-side JS implementation (node.js, Meteor, etc.) The problem, as I see it, is nobody in the node.js/io.js world (or anywhere else, for that matter) has built something that even approaches the power, simplicity, and elegance of Django(especially it's Model layer). I've looked at Meteor, but if I'm not mistaken, it currently does not support using a relational database. And Sails.js, while impressive, does not have as nice an ORM as Django's. I initially wanted to build apps in Django. Then for a long time, I thought I could live with Rails because it made up for ActiveRecord's (in my opinion) clunkiness with the built-in asset pipeline and stronger out-of-the-box support for building JSON APIs. Then two things happened: 1) I realized I could just split the app into server and client codebases, and since Ember-CLI is the recommended way to develop Ember apps now, I didn't need the asset pipeline. 2) I discovered just how seamlessly Django Rest Framework integrates with Django, providing a more elegant solution for building JSON APIs than Rails. Since then, I've switched back to Django and never looked back.
- ralmidani 11y agoPersonally, I like CoffeeScript syntax combined with JavaScript's "a hash is an object" better than Python's object syntax (too much unnecessary use of "self" and class method decorators could be better achieved with the @ sigil). What I would really find interesting is a CoffeeScript-like language that can compile to both Python and JS (with snake_case for Python and camelCase for JS). Couple it with a JS client-side library that mimics Django's Model and Field APIs, while keeping the best parts from Ember.js (Handlebars/Emblem templates, Components with Actions for template events, Router, and Routes), plus glue code to make the whole thing seamless, real-time, and with an isomorphic feel. If nobody does it, I plan to study compilers with the express goal of attempting it myself. Edit: To clarify, I already know a decent amount of Python and JS/CoffeeScript. The problem is not in learning multiple languages, but in the amount of duplicated logic (especially in the model layer) that could be eliminated via shared code when you write in a single language.
- jMyles 11y agoI don't understand why this is such a controversial view. I agree in full. I hope that you are successful.
- deleted 11y ago[deleted]
- jMyles 11y ago> It is questionable. > I don't mean to talk a bunch of trash about the idea, because it is a cool one and undoubtedly would be a great learning project. However, in trying to compile down to both Python and JS, you'll end up with a lowest common denominator language. Aside from libraries, it isn't obvious what compiling down to Python gives you; just use Coffeescript or something similar for your entire stack if for some reason ES6 is not an option. > Truthfully you are just better off biting the bullet and getting good at multiple languages which are the best fit to their domains. The best tool for the job and all. Python is a good language, but not great enough to warrant hanging onto if/where it has been eclipsed. My motivation isn't a love for Python (although I do confess one), but contempt for javascript. I do like coffeescript just fine, so my solution is to "just Coffeescript" most of the time. However - and I know I'm not alone here - I end up having to not only repeat but re-represent crucial pieces of logic in both Python (in a model method) and Coffeescript (in a scope method) in order to have complete coherence over my app. In 2015, it doesn’t need to be this way.
- raldu 11y agoFor the interested, Ruby equivalent of the same concept is Opal: http://opalrb.org/ http://opalrb.org/
- adamzubi700 11y agohttp://googler700.blogspot.com/ http://googler700.blogspot.com/
- JustSomeNobody 11y agoNo thanks. I'll write my Python in Python and my Javascript in Javascript. To do otherwise just adds another layer of cruft and makes it harder to debug. I know, I know. There's others out there who dispute this. Okay.
- curiousjorge 11y agowould love to see example codes accompanied with the examples, which seem a bit outdated. what this needs is a fully working app that is modern and source to accompany it. Personally, I'm a huge fan of python, and has a big potential in the web if done right.
- mooreds 11y agoI saw this movie almost a decade ago. It's called GWT, and the end result is code that needs to be debugged at two levels, falls behind both primary platforms, ends up requiring more tooling, and introduces another step to the build process. At least GWT gave you refactoring. Not recommended.