Live data from Hacker News

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

pyjs.org

11–20 of 41 posts

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

#11
post #7

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…

I don't understand why this is such a controversial view. I agree in full. I hope that you are successful.

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

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

#12

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…

90% of the duplicate logic is data validation.

How about using PyV8 to run javascript on the server, so you can share validation logic between the frontend and backend?

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

#13
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's a valid concern, but I think ES6/ES2015 will help ease the pain of using Javascript.

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

#14
post #13
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's a valid concern, but I think ES6/ES2015 will help ease the pain of using Javascript.

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

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

#15

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…

90% of the duplicate logic is data validation. How about using PyV8 to run javascript on the server, so you can share validation logic between the frontend and backend?

Routing could also be shared; you could declare endpoints in one place, but the implementations for client and server would be different.

At the risk of oversimplifying: on the server, routed actions are concerned with getting data from a database, serializing it, and sending it to the client. On the client, routed actions get data from the server and use it to render a template.

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

#17
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, 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.

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

#18

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(','))

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

#19
post #11
post #7

Earlier quoted context omitted.

I don't understand why this is such a controversial view. I agree in full. I hope that you are successful.

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

This presentation sums up my dreams about how development should look like pretty nicely: https://www.youtube.com/watch?v=qluiQgbXZBQ

Post reply on HN