Live data from Hacker News

PyJS: write your JavaScript-powered web applications entirely in Python

pyjs.org

21–30 of 41 posts

Re: PyJS: write your JavaScript-powered web applications entirely in Python

#21

Personally, 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-sid…

CoffeeScript feels for me like more flexible Python. Only thing I was missing until ES6 were generators. I simply love how I can wrap line from csv file in custom CoffeeScript object just by declaring class like: class Entry constructor: ([@id, @description, @amount]) -> and doing new Entry(line.split(','))

An equivalent in Python is

>>> Entry = namedtuple("Entry", "id description amount")

>>> Entry(*line.split(','))

Entry(id='1', description='an entry', amount='99')

Re: PyJS: write your JavaScript-powered web applications entirely in Python

#22
would 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.

Re: PyJS: write your JavaScript-powered web applications entirely in Python

#23

Personally, 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-sid…

Speaking of coffeescript, there's a python/coffeescript inspired language that I stumbled upon recently: http://breuleux.github.io/earl-grey/ Basically es6-ified coffeescript it looks like.

Re: PyJS: write your JavaScript-powered web applications entirely in Python

#24

Personally, 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-sid…

Speaking of coffeescript, there's a python/coffeescript inspired language that I stumbled upon recently: http://breuleux.github.io/earl-grey/ Basically es6-ified coffeescript it looks like.

Wow. Definitely a language to check out.

Thanks for the link!

Re: PyJS: write your JavaScript-powered web applications entirely in Python

#25
post #8
post #4

This 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.

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)

That 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.

Re: PyJS: write your JavaScript-powered web applications entirely in Python

#26
post #11

Earlier quoted context omitted.

> 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…

> but contempt for javascript Opinions like this make me very sad. And not because I love JavaScript: I love all the languages (take a look if you want to see the list: https://klibert.pl/articles/programming_langs.html ). It's sad, because we have now more languages than ever before, yet almost no one uses them, because they all "contempt" some of them, "dislike" others and are "not interested" in the rest. "Using t…

> It's sad, because we have now more languages than ever before, yet almost no one uses them, because they all "contempt" some of them, "dislike" others and are "not interested" in the rest. "Using the best tool for the job" was never that easy, yet nobody wants to do it, choosing to try and translate completely incompatible semantics and features of one tool on top of another. It's really disappointing.

JS is used to develop client-side web applications not because it's the best language for the job, but because it's the only language supported by all browsers.

Those who like the philosophy and/or reach of the Web but don't want to use JS have no alternative to using languages like CoffeeScript.

Re: PyJS: write your JavaScript-powered web applications entirely in Python

#27
post #8

Earlier quoted context omitted.

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)

That 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.

Damn.

In that case - on a related theme:

https://github.com/skulpt/skulpt

https://github.com/brython-dev/brython

Re: PyJS: write your JavaScript-powered web applications entirely in Python

#28
post #5

Goodbye pyjamas. I think this project lost its mojo. I really loved the idea but personally decided it best to just use javascript.

These "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, TypeSc…

> 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.

Re: PyJS: write your JavaScript-powered web applications entirely in Python

#29

Earlier quoted context omitted.

> but contempt for javascript Opinions like this make me very sad. And not because I love JavaScript: I love all the languages (take a look if you want to see the list: https://klibert.pl/articles/programming_langs.html ). It's sad, because we have now more languages than ever before, yet almost no one uses them, because they all "contempt" some of them, "dislike" others and are "not interested" in the rest. "Using t…

> It's sad, because we have now more languages than ever before, yet almost no one uses them, because they all "contempt" some of them, "dislike" others and are "not interested" in the rest. "Using the best tool for the job" was never that easy, yet nobody wants to do it, choosing to try and translate completely incompatible semantics and features of one tool on top of another. It's really disappointing. JS is used t…

> Those who like the philosophy and/or reach of the Web but don't want to use JS have no alternative to using languages like CoffeeScript.

Could you explain what you mean by "languages like CoffeeScript"? If you mean it as "languages compiled to JS" then many of them are completely unlike Coffee in both syntax and semantics. There's a great many of them to choose from, too.

But I think you completely missed my point, which is that you have an alternative for JS (in the form of compile to JS languages, but why should it matter if a language is compiled to JVM bytecode of JS code? It's an implementation detail!). You have an alternative for every single language out there, and a wide array of languages optimized for different use cases. Yet, instead of embracing this diversity, people try to push their favorite[1] language everywhere. Yeah, it's easier to write something that way, but until we have "sufficiently smart compilers" the effect is going to be worse than if you just used a best-suited language for each component of your system.

[1] Maybe because it's the only one they know?

Re: PyJS: write your JavaScript-powered web applications entirely in Python

#30
I 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.

Post reply on HN