lk-geimfari / mimesis

Mimesis is a robust data generator for Python that can produce a wide range of fake data in multiple languages.
https://mimesis.name
MIT License
4.39k stars 330 forks source link

pypy support #381

Closed sobolevn closed 6 years ago

sobolevn commented 6 years ago

pypy has python3.5 support. http://doc.pypy.org/en/latest/release-v5.10.1.html

So, maybe we can try to support that? It may give our users some performance increase.

Checklist:

lk-geimfari commented 6 years ago

@sobolevn Literally yesterday I thought about the same thing.

lk-geimfari commented 6 years ago

@sobolevn So. I have tried to add support of PyPy and seems this is impossible (or almost). Here you can look at the report. As I can judge it's related to typing, possibly to mypy or typed_ast.

sobolevn commented 6 years ago

Are there any resources about typing and pypy? I have not touched pypy for several years now.

lk-geimfari commented 6 years ago

@sobolevn I have found almost nothing about using ones together.

sobolevn commented 6 years ago

Well, maybe we just have to wait. Should we close this issue?

lk-geimfari commented 6 years ago

@sobolevn Let's will leave it opened, maybe someone can work on this issue.

duckyou commented 6 years ago

@lk-geimfari Some time ago i also tested it with pypy3. It works, but mypy module not supported by pypy bcz cpython reasons like you say here https://github.com/lk-geimfari/mimesis/issues/381#issuecomment-359244973 0_o We can just skip mypy module in pipfile for pypy and ignore mypy tests. :bulb:

lk-geimfari commented 6 years ago

@duckyou How we can skip dependencies selectively? I mean, how we can skip mypy only on PyPY? Is there any way to remove package from Pipfile on the fly?

Something like this:

  - if [[ $TRAVIS_PYTHON_VERSION == "pypy3" ]]; then pipenv install --dev --skip mypy; fi

UPD:

We can try this: https://github.com/pypa/pipenv/issues/1334#issuecomment-359313432

sobolevn commented 6 years ago

@lk-geimfari no, that's not possible.

duckyou commented 6 years ago

@lk-geimfari @sobolevn Yes, like says here https://github.com/pypa/pipenv/issues/1334#issuecomment-359313432 we can filter deps:

mypy = {version="*", platform_python_implementation="!='PyPy'"}
# or
mypy = {version="*", markers="platform_python_implementation != 'PyPy'"}

(Other supported markers we can find here, or read PEP508 - Environment Markers)

But! Heres problem... pypy3 cant work with mypy bcz mypy have in deps typed-ast which should be compile with cpython. And if we filter mypy in pipfile and lock it, its deps not be sub-filtered 😞

If we want fix this issue we should filter mypy with typed-ast, like:

mypy = {version="*", platform_python_implementation="!='PyPy'"}
typed-ast = {version=">=1.1.0,<1.2.0", platform_python_implementation="!='PyPy'"}

If you know more canonical solution, please, share with me 😺

lk-geimfari commented 6 years ago

@duckyou Have you tried it? Does it work? I mean the last solution which you showed above.

duckyou commented 6 years ago

@lk-geimfari yes, its work!

screenshot_2018-01-22_12-02-17 screenshot_2018-01-22_12-05-19

lk-geimfari commented 6 years ago

@duckyou Can you create PR, please?

duckyou commented 6 years ago

@sobolevn @lk-geimfari Appveyor don't have pypy3 enviroment 😞 Need write install script... but its so necessary tests it on travis/appveyor? PyPy3 really more faster than cpython in this situation? Maybe first benchmark it?)

lk-geimfari commented 6 years ago

@duckyou Sure. Better to benchmark it.

duckyou commented 6 years ago

💡 For speed increasing we can implement some functions with C or use Cython. But this decision excludes pypy support and maybe other exotic python implementations 🌵 Also may affect on windows supporting missclick :sweat_smile:

lk-geimfari commented 6 years ago

@duckyou I think that at this moments this is overhead. But if we find a really slow solution we can try to optimize ones, including using C.

lk-geimfari commented 6 years ago

Here are too many problems with PyPy. Let's close it and come to back to it in next year :smile:.

sobolevn commented 6 years ago

Please, reconsider adding Cython. It may cause too many problems within the building step. And provide a little performance gain.

duckyou commented 6 years ago

OK, les save it for dessert 😸