Live data from Hacker News

Grumpy: Go running Python

opensource.googleblog.com

291–300 of 463 posts

Re: Grumpy: Go running Python

#291
post #204

Earlier quoted context omitted.

The "Wall" is just numbers for Python3, without context for how it compares to Python 2. For 2.7 Pypy reported 419,227,040 downloads for 2016. At the same time, for ALL 3.x versions combined (up to 3.6) there are just: ~52 million downloads. That's 1/8th of the Python 2 downloads.

The PyPy statistics aren't worth much since they're counting all sorts of automated downloads/dependencies/etc. That's why packages like supervisor and graphite - which aren't libraries - are among the top downloads.

>The PyPy statistics aren't worth much since they're counting all sorts of automated downloads/dependencies/etc.

Those would exist for both 2.x and 3.x so it's not a differentiating factor.

Re: Grumpy: Go running Python

#292

Does anyone know if there is an easy way to get involved in open source projects like this? The readme mentions adding PRs, but as someone that doesn't have much experience working with open source projects like this, I don't even know where to begin. It sounds like an incredible learning opportunity though.

You can probably mail a maintainer or a developer for hints of a project you'd be interested in. Or better you can send a question to the project's mailing list. People there often are very helpful. I've done that. It worked. (I haven't tried contributing to any Google-managed projects though.)

Thanks! This is what I'll do. Much appreciated.

Re: Grumpy: Go running Python

#293

Does anyone know if there is an easy way to get involved in open source projects like this? The readme mentions adding PRs, but as someone that doesn't have much experience working with open source projects like this, I don't even know where to begin. It sounds like an incredible learning opportunity though.

The first stop is usually a CONTRIBUTING.md Here's theirs https://github.com/google/grumpy/blob/master/CONTRIBUTING.md There's not a ton there. The next place I'd go is open issues: https://github.com/google/grumpy/issues It looks like at the moment they're mostly random bug reports from people who have tried Grumpy since this announcement, rather than ones filed by people working on Grumpy since before it was made p…

That's super helpful; much appreciated!

Re: Grumpy: Go running Python

#294
post #58

Earlier quoted context omitted.

What does "hard-code compiler" mean?

It seems to be that it pesudo-transpiles python to go and compiles that down using a normal go toolchain.

What's the difference between transpiling and pesudo-transpiling? (Even if you meant pseudo-transpiling, I still don't know what the difference between that and transpiling is.)

Re: Grumpy: Go running Python

#295
post #248

Earlier quoted context omitted.

Python 2.7 is EOL in 2020. Make of that what you will :/

The community will fork the 2.7 codebase and continue to support it, even if Python.org EOLs it.

I can see "the community" doing security fixes, maybe some bug fixing and a few back ports, but so far I havn't seen much effort from any community to bring active development of new features.

Re: Grumpy: Go running Python

#296

Earlier quoted context omitted.

> There are restrictions. I'll update the README to make note of them. Basically, exec and eval don't work. Since we don't use those in production code at Google, this seemed acceptable. I'm guessing pretty much the entire AST module is a no-go?

I think the CPython AST module is written as a C extension module so currently it's a no-go. I don't think there's a fundamental reason Grumpy couldn't run a pure Python AST module, though.

So I take that means Grumpy can't run itself?

Re: Grumpy: Go running Python

#297

Earlier quoted context omitted.

> I'll update the README to make note of them. I managed to run into 2 trying to build a 5 line program :-) $ cat t.py; ./tools/grumpc t.py > t.go;go build t.go;echo '----';./t import sys print sys.stdin.readline() ---- AttributeError: 'module' object has no attribute 'stdin' $ $ cat t.py ;./tools/grumpc t.py c = {} top = sorted(c.items(), key=lambda (k,v): v) Traceback (most recent call last): File "./tools/grumpc",…

Ugh, sorry about that. There's a couple issues here: 1. Lambda tuple args are not yet supported -- I actually didn't know that was a thing :\ -- https://github.com/google/grumpy/issues/17 2. Even if that worked properly, sorted() is not yet implemented: https://github.com/google/grumpy/issues/16

Yeah.. It also used to work with def, but it was removed in python3. You can do this in 2.7:

  def func((a,b)):
      return b

  mytuple = 1,2
  print func(mytuple)
in py3 you need

  def func(t):
      a,b = t
      return b
Not sure if

This is probably the cleaner way to write that:

  key=operator.itemgetter(1)

Re: Grumpy: Go running Python

#298
It's all about performance and concurrency here, but I'm quite happy about this for another reason: static compilation. If I needed really performant code, I'd write it in Go/Cython/[insert your fav language] in the first place. But if I have some existing code that I just want to run without worrying about the Python runtime being installed/correct, this is a good solution.

(Sure, none of my code will work, because it's all Python3 and usually uses C/asm, but it's still early and I'm hopefull.)

Re: Grumpy: Go running Python

#299
post #203

Earlier quoted context omitted.

>(Yes, I'm still on Python 2 but moving soon). I'm like really new to programming and I'm still just learning the basics, but I see this little addendum a lot from people who say everyone should be writing Python 3.

Python 2.7 is EOL in 2020. Make of that what you will :/

That means nothing. Python 3 was also expected to be mainstream by 2015, but it's nowhere near even 30% yet.

Re: Grumpy: Go running Python

#300
post #229
post #6

It seems interesting but my concern is that it's just another Unladen Swallow.

To me it looks like Google essentially is moving everything to Go, and this project is to help with it. They port their python libraries so they can reference them from their Go code, and then module by module will rewrite it in pure Go.

>To me it looks like Google essentially is moving everything to Go, and this project is to help with it.

Interesting - first time I have heard such an opinion. Why do you think it may be so? One reason I can think of, is they get more control over the languages they use.

Post reply on HN