Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

still doesn't build on pypy3 7.0 #111

Closed
glyph opened this issue May 16, 2019 · 7 comments
Closed

still doesn't build on pypy3 7.0 #111

glyph opened this issue May 16, 2019 · 7 comments

Comments

@glyph
Copy link

glyph commented May 16, 2019

following up from #97:

Collecting git+https://github.com/python/typed_ast
  Cloning https://github.com/python/typed_ast to /private/var/folders/5z/sbg483yj7031bkxcptzpyh5w0000gn/T/pip-req-build-39y_vwx6
Building wheels for collected packages: typed-ast
  Running setup.py bdist_wheel for typed-ast ... error
  Complete output from command /Users/glyph/.virtualenvs/tmp-57d83c9d1ed6ccb/bin/pypy3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/5z/sbg483yj7031bkxcptzpyh5w0000gn/T/pip-req-build-39y_vwx6/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/5z/sbg483yj7031bkxcptzpyh5w0000gn/T/pip-wheel-sxm1s6jn --python-tag pp370:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.14-x86_64-3.6
  creating build/lib.macosx-10.14-x86_64-3.6/typed_ast
  copying typed_ast/conversions.py -> build/lib.macosx-10.14-x86_64-3.6/typed_ast
  copying typed_ast/__init__.py -> build/lib.macosx-10.14-x86_64-3.6/typed_ast
  copying typed_ast/ast3.py -> build/lib.macosx-10.14-x86_64-3.6/typed_ast
  copying typed_ast/ast27.py -> build/lib.macosx-10.14-x86_64-3.6/typed_ast
  package init file 'ast3/tests/__init__.py' not found (or not a regular file)
  creating build/lib.macosx-10.14-x86_64-3.6/typed_ast/tests
  copying ast3/tests/test_basics.py -> build/lib.macosx-10.14-x86_64-3.6/typed_ast/tests
  running build_ext
  building '_ast27' extension
  creating build/temp.macosx-10.14-x86_64-3.6
  creating build/temp.macosx-10.14-x86_64-3.6/ast27
  creating build/temp.macosx-10.14-x86_64-3.6/ast27/Parser
  creating build/temp.macosx-10.14-x86_64-3.6/ast27/Python
  creating build/temp.macosx-10.14-x86_64-3.6/ast27/Custom
  gcc -pthread -arch x86_64 -DNDEBUG -O2 -fPIC -Iast27/Include -I/usr/local/Cellar/pypy3/7.0.0/libexec/include -c ast27/Parser/acceler.c -o build/temp.macosx-10.14-x86_64-3.6/ast27/Parser/acceler.o
  gcc -pthread -arch x86_64 -DNDEBUG -O2 -fPIC -Iast27/Include -I/usr/local/Cellar/pypy3/7.0.0/libexec/include -c ast27/Parser/bitset.c -o build/temp.macosx-10.14-x86_64-3.6/ast27/Parser/bitset.o
  gcc -pthread -arch x86_64 -DNDEBUG -O2 -fPIC -Iast27/Include -I/usr/local/Cellar/pypy3/7.0.0/libexec/include -c ast27/Parser/grammar.c -o build/temp.macosx-10.14-x86_64-3.6/ast27/Parser/grammar.o
  gcc -pthread -arch x86_64 -DNDEBUG -O2 -fPIC -Iast27/Include -I/usr/local/Cellar/pypy3/7.0.0/libexec/include -c ast27/Parser/grammar1.c -o build/temp.macosx-10.14-x86_64-3.6/ast27/Parser/grammar1.o
  gcc -pthread -arch x86_64 -DNDEBUG -O2 -fPIC -Iast27/Include -I/usr/local/Cellar/pypy3/7.0.0/libexec/include -c ast27/Parser/node.c -o build/temp.macosx-10.14-x86_64-3.6/ast27/Parser/node.o
  gcc -pthread -arch x86_64 -DNDEBUG -O2 -fPIC -Iast27/Include -I/usr/local/Cellar/pypy3/7.0.0/libexec/include -c ast27/Parser/parser.c -o build/temp.macosx-10.14-x86_64-3.6/ast27/Parser/parser.o
  gcc -pthread -arch x86_64 -DNDEBUG -O2 -fPIC -Iast27/Include -I/usr/local/Cellar/pypy3/7.0.0/libexec/include -c ast27/Parser/parsetok.c -o build/temp.macosx-10.14-x86_64-3.6/ast27/Parser/parsetok.o
  gcc -pthread -arch x86_64 -DNDEBUG -O2 -fPIC -Iast27/Include -I/usr/local/Cellar/pypy3/7.0.0/libexec/include -c ast27/Parser/tokenizer.c -o build/temp.macosx-10.14-x86_64-3.6/ast27/Parser/tokenizer.o
  ast27/Parser/tokenizer.c:17:10: fatal error: 'codecs.h' file not found
  #include "codecs.h"
           ^~~~~~~~~~
  1 error generated.
  error: command 'gcc' failed with exit status 1

It looks like the inclusion of codecs.h was intended to be removed based on discussion on the previous issue?

@glyph
Copy link
Author

glyph commented May 17, 2019

(Same error with pypy3 7.1.1)

@ethanhs
Copy link
Contributor

ethanhs commented May 17, 2019

@glyph if you read my comment there are a lot of changes that would need to be made for typed_ast to work on PyPy (the changes in the comment are just the beginning). Deleting the codecs.h include is not really going to get you far. I gave up around the time I made that comment because I didn't feel life vendoring half of the CPython APIs we use. However, perhaps perhaps PyPy can have an internal parser flag that gets enabled from a typed_ast module, since it will be a while before they reach 3.8?

@glyph
Copy link
Author

glyph commented May 21, 2019

@ethanhs ah, I see. If it’s not worthwhile to have a tracking issue open for pypy compatibility, please feel free to close this; I was just trying to catalogue the failures I encountered trying to get pypy to work for a production codebase.

@gvanrossum
Copy link
Member

Thanks, let’s close this then.

selimb added a commit to selimb/marshmallow_dataclass that referenced this issue Dec 8, 2019
jpgrayson added a commit to westerndigitalcorporation/pyvcd that referenced this issue Mar 12, 2020
All code is updated to use black formatting.

https://github.com/psf/black

A pyproject.toml file is added with configuration for the black tool. Note
that skip-string-normalization is enabled; this allows pyvcd code to
continue using single-quoted strings instead of black's default of
double-quoted strings.

The Makefile's 'lint' and 'format' targets are updated to use black.

N.B. there is an issue with installing/running black with pypy3, so instead
of including it in requirements.txt, it is installed conditionally in
.travis.yml.

    psf/black#727
    python/typed_ast#111
jpgrayson added a commit to westerndigitalcorporation/pyvcd that referenced this issue Apr 2, 2020
They are conditional on cpython because currently neither tool can be
installed in a pypy environment.

psf/black#727
python/typed_ast#111
spenczar added a commit to spenczar/fastavro that referenced this issue May 20, 2020
scottbelden pushed a commit to fastavro/fastavro that referenced this issue Jun 22, 2020
* Add type stubs for read APIs

* Add type stubs for write APIs

* Add type stubs for validation APIs

* Add type stubs for schema APIs

* Add block_reader, remove file_reader from read pyi

Add the block_reader and its partner Block to the type stub
for the read module.

On the way, remove file_reader because it's not in the exported
public API, and it has an ambiguous (or at least complicated)
type for its __iter__, next, and __next__ methods; their return
value types depend upon the concrete subclass.

* Add a py.typed sentinel file for mypy support

As laid out in [0], a specially-named py.typed file is needed to get
mypy support for distributed packages.

[0]: https://github.com/python/mypy/blob/92e3f396b03c69c1d8abc249632bfd2db02350d0/docs/source/installed_packages.rst#making-pep-561-compatible-packages

* Obey flake8 regarding comment spacing

* Include type stubs and sentinel file in distribution

* Add mypy to automated tests

* Skip running mypy on Python 2

* Only install mypy on Python 3+

* Don't run mypy on pypy because it can't be installed

See python/typed_ast#111 for more.

* Fix multiline inline python command

* some day i will learn to bash
jogo added a commit to jogo/git-stacktrace that referenced this issue Jul 16, 2020
So we can automatically fix many formatting issues.

https://black.readthedocs.io/

Drop pypy3 testing due to python/typed_ast#111
@h-vetinari
Copy link

Update for those subscribed here, re:

@ethanhs: However, perhaps perhaps PyPy can have an internal parser flag that gets enabled from a typed_ast module, since it will be a while before they reach 3.8?

typed_ast support in PyPy was implemented by @isidentical, see comment here:

PyPy 3.8 will have typed_ast support natively (just like CPython 3.8), !791 (merged).

PyPy 3.8 is on the horizon, but still likely several months (or more) away.

@ethanhs
Copy link
Contributor

ethanhs commented Jul 2, 2021

It seems that while type comment parsing is implemented, language feature versioning perhaps is not?

@isidentical
Copy link
Sponsor Member

isidentical commented Jul 2, 2021 via email

overcat added a commit to StellarCN/py-stellar-base that referenced this issue Jul 28, 2021
nolar added a commit to nolar/kopf that referenced this issue Oct 10, 2021
PyPy might give 2-4x speedup on pure-Python scripts and save memory by default (as if slots were used in CPython). This enabled Kubernetes operators in CPU-/RAM-tight environments without special improvements and optimizations from Kopf's side. PyPy was unofficially supported and tested manually from time to time. With this change, let's make it official and automated.

MyPy is excluded from test-time dependencies: one of MyPy's sub-dependency ("typed-ast") fails at being installed (python/typed_ast#111). However, PyPy is not used for linting/type-checking, only CPython is. Therefore, MyPy is not needed for PyPy.

Signed-off-by: Sergey Vasilyev <nolar@nolar.info>
nolar added a commit to nolar/kopf that referenced this issue Oct 10, 2021
PyPy might give 2-4x speedup on pure-Python scripts and save memory by default (as if slots were used in CPython). This enabled Kubernetes operators in CPU-/RAM-tight environments without special improvements and optimizations from Kopf's side. PyPy was unofficially supported and tested manually from time to time. With this change, let's make it official and automated.

MyPy is excluded from test-time dependencies: one of MyPy's sub-dependency ("typed-ast") fails at being installed (python/typed_ast#111). However, PyPy is not used for linting/type-checking, only CPython is. Therefore, MyPy is not needed for PyPy.

Signed-off-by: Sergey Vasilyev <nolar@nolar.info>
nolar added a commit to nolar/kopf that referenced this issue Oct 10, 2021
PyPy might give [2-5x speedup](https://speed.pypy.org/) and [2-3x less memory consumption](https://dev.nextthought.com/blog/2018/08/cpython-vs-pypy-memory-usage.html) on pure-Python scripts — compared to equivalent CPython 3.7. This enables Kubernetes operators in CPU-/RAM-tight environments without special improvements and optimizations from Kopf's side.

PyPy was unofficially supported and tested manually from time to time. With this change, let's make it official and automated.

Some implementation nuances:

MyPy is excluded from test-time dependencies: one of MyPy's sub-dependency ("typed-ast") fails at being installed (python/typed_ast#111). However, PyPy is not used for linting/type-checking, only CPython is. Therefore, MyPy is not needed for PyPy.

There are some slowdowns in CI: +2m30s mins for OS-/pip-dependencies — since no wheels are usually available for PyPy. And slower tests: 2m40s vs. 1m50s in CPython — my assumption is because JIT is not very useful for non-repetitive code fragments of tests (but should be faster at runtime; no proofs, though).

Coverage for PyPy is disabled completely — it makes it disastrously slow (13m vs. 3m). The internet hints it is because tracing is not compatible with JIT (old articles from 2013-2015).

Signed-off-by: Sergey Vasilyev <nolar@nolar.info>
nashant pushed a commit to nashant/kopf that referenced this issue Nov 2, 2021
PyPy might give [2-5x speedup](https://speed.pypy.org/) and [2-3x less memory consumption](https://dev.nextthought.com/blog/2018/08/cpython-vs-pypy-memory-usage.html) on pure-Python scripts — compared to equivalent CPython 3.7. This enables Kubernetes operators in CPU-/RAM-tight environments without special improvements and optimizations from Kopf's side.

PyPy was unofficially supported and tested manually from time to time. With this change, let's make it official and automated.

Some implementation nuances:

MyPy is excluded from test-time dependencies: one of MyPy's sub-dependency ("typed-ast") fails at being installed (python/typed_ast#111). However, PyPy is not used for linting/type-checking, only CPython is. Therefore, MyPy is not needed for PyPy.

There are some slowdowns in CI: +2m30s mins for OS-/pip-dependencies — since no wheels are usually available for PyPy. And slower tests: 2m40s vs. 1m50s in CPython — my assumption is because JIT is not very useful for non-repetitive code fragments of tests (but should be faster at runtime; no proofs, though).

Coverage for PyPy is disabled completely — it makes it disastrously slow (13m vs. 3m). The internet hints it is because tracing is not compatible with JIT (old articles from 2013-2015).

Signed-off-by: Sergey Vasilyev <nolar@nolar.info>
Signed-off-by: Anthony Nash <anthony.nash@du.co>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants