Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#8505] Run PyPy with Travis-CI #226

Merged
merged 4 commits into from
Aug 10, 2019
Merged

[#8505] Run PyPy with Travis-CI #226

merged 4 commits into from
Aug 10, 2019

Conversation

adiroiban
Copy link
Member

.travis.yml Outdated
"$PYENV_ROOT/bin/pyenv" install --skip-existing "pypy-$PYPY_VERSION"
virtualenv --python="$PYENV_ROOT/versions/pypy-$PYPY_VERSION/bin/python" "$HOME/virtualenvs/pypy-$PYPY_VERSION"
source "$HOME/virtualenvs/pypy-$PYPY_VERSION/bin/activate"
fi
- pip install tox tox-travis

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't technically need to install tox explicitly, since tox-travis depends on tox... :-)

@markrwilliams
Copy link
Member

@adiroiban it looks like travis did not to run on the last two commits -- was that intentional??

@adiroiban
Copy link
Member Author

@adiroiban it looks like travis did not to run on the last two commits -- was that intentional??

Nope. Something is broken with Travis-CI as it was ignoring my push commits.

@markrwilliams
Copy link
Member

@adiroiban fair enough. i'm happy to help if i can!

@adiroiban
Copy link
Member Author

I have other PR and travis-ci is not triggered ... so I need to investigate ...I have sent an email to Travis-CI support team

anyway we need to fix the coverage issue and this will also need to be deployed on our buildbot env

.travis.yml Outdated
virtualenv --python="$PYENV_ROOT/versions/pypy-$PYPY_VERSION/bin/python" "$HOME/virtualenvs/pypy-$PYPY_VERSION"
source "$HOME/virtualenvs/pypy-$PYPY_VERSION/bin/activate"
echo "import sys; sys.setrecursionlimit(10000)" > $HOME/virtualenvs/pypy-$PYPY_VERSION/
/lib-python/2.7/sitecustomize.py

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this line supposed to do? This line introduces YAML syntax error, so Travis CI build will not run.

@markrwilliams
Copy link
Member

@adiroiban so it didn't fix the issue but it did seem to let the code advance a little farther. if you're willing to give it another shot, you can bump the recursion limit to 10000. otherwise i'll report back after i've gotten a chance to run coverage & trial under a debug build of pypy.

@adiroiban
Copy link
Member Author

if you're willing to give it another shot, you can bump the recursion limit to 10000. otherwise i'll report back after i've gotten a chance to run coverage & trial under a debug build of pypy.

The limit is already at 10.000 ... as I have just copy pasted from your comment :)

Maybe is worth getting in touch with coverage people to see if something special is needed for PyPy

@markrwilliams
Copy link
Member

@adiroiban sorry, i meant 100,000 - github ate my comment and i hastily retyped it.

i can reach out to the coverage people, but i'm pretty sure this is a pypy specific issue :( i'll update this PR when i know more.

@rodrigc
Copy link
Contributor

rodrigc commented Jul 4, 2016

@markrwilliams
Copy link
Member

@rodrigc Sorry, I should have mentioned that I've filed an issue with PyPy about this: https://bitbucket.org/pypy/pypy/issues/2335/maximum-recursion-depth-exceeded-with
I'll update this PR when a solution is found.

@rodrigc
Copy link
Contributor

rodrigc commented Jul 5, 2016

@markrwilliams How many Pypy patches for Twisted do you have?
Can you extract a subset of those changes which do not require if PYPY, and
can run completely on Python 2.7, and pass the coverage tests on Python 2.7?
If we can get a subset of those patches committed into Twisted, that will allow some forward progress.

Getting blocked because the coverage tool itself doesn't work under Pypy is :(

@adiroiban
Copy link
Member Author

The codecov patch protection was lifted see twisted-infra/braid#213

so you can no merge pypy patches even if their coverage is not reported

@markrwilliams
Copy link
Member

Armin Rigo just pushed a fix for the coverage issue. Looks like we can revist it this after the next PyPy release!

@codecov-io
Copy link

codecov-io commented Jul 24, 2016

Codecov Report

Merging #226 into trunk will decrease coverage by -45.47%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##            trunk     #226       +/-   ##
===========================================
- Coverage   91.28%   45.82%   -45.47%     
===========================================
  Files         844      156      -688     
  Lines      147616    19990   -127626     
  Branches    13059     2898    -10161     
===========================================
- Hits       134756     9160   -125596     
+ Misses      10623    10222      -401     
+ Partials     2237      608     -1629

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e8e8e8a...93f7ec5. Read the comment docs.

@adiroiban
Copy link
Member Author

I have pushed a version with 100.000 recursion limit... but not luck.... so I am reverting that change.

Rather than having this code unmerged, I have pushed it for review as at least it can run pypy on travis ci... once a new pypy release is ready, in theory we should only update the version in the travis install.sh

When is the new pypy version planned to be released?

I had a quick look at the pypy website, but the release notes are done without any date ... very strange.

Similar with the bad habit that we have in Twisted, when a ticket is closed as fixed there is no note about when it will be released ... or in which version it was released

@glyph
Copy link
Member

glyph commented Aug 9, 2016

@adiroiban - can you update your branch please? hopefully the push of the merge commit will also fix whatever broke the documentation buildbot…

@adiroiban
Copy link
Member Author

@glyph updated. thanks!

@glyph
Copy link
Member

glyph commented Aug 12, 2016

Updating again in the hopes that the CI gods will be with us this time…

@glyph
Copy link
Member

glyph commented Aug 29, 2016

Ugh. They were, but now conflicts need to be resolved.

@glyph
Copy link
Member

glyph commented Sep 10, 2016

@adiroiban - the build is failing because the topfile is in the wrong place. Move it into src/ and I think we can merge this…

source ~/.venv/bin/activate
fi

# Temporary workaround for https://github.com/pypa/setuptools/issues/776;
# install (and thereby cache a built wheel of) cryptography. (NB: We're
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why delete this comment? Seems irrelevant to the change in question.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed it as for pypy this is no longer valid.

In travis we have pypy 2.5 and in venv we have pypy 5.4

@adiroiban
Copy link
Member Author

adiroiban commented Sep 11, 2016

Thanks @glyph for the review. I have moved to src and also updated the travis cache functionality

It would be nice to have a command in pip which can remove packages which are not used for a long time.

for pyenv, I went for this simple pyenv uninstall command, but we might need a .travis/pyenv.cleanup.sh script which will remove any version, other than PYPY_VERSION ... and in the future we might want to keep other versions if pyenv

@adiroiban
Copy link
Member Author

we are caching on travis the full ~/.cache/pip , but maybe we should only cache ~/.cache/pip/wheels

@njsmith
Copy link

njsmith commented Feb 21, 2017

Instead of doing all this work with pyenv and caching, wouldn't it be easier to install squeaky's portable pypy from scratch on each build? (The travis cache has to be downloaded to the build worker every time anyway, so it's only really useful for artifacts that you're building on travis.)

@glyph
Copy link
Member

glyph commented Feb 21, 2017

@njsmith - An alternate PR would be appreciated, but given that "all this work" is already done, is there much benefit to getting rid of it?

@njsmith
Copy link

njsmith commented Feb 21, 2017 via email

@markrwilliams
Copy link
Member

@adiroiban I agree with @njsmith and would prefer to use squeaky's portable PyPy. I can take up this PR if that approach seems OK to you.

@adiroiban
Copy link
Member Author

@markrwilliams go for it. Thanks!

I have never used pypy so my work from here was just trying to pay it forward for all the good things I use in Twisted basically great python 2.7 as I don't care for the rest :)

I think that I have just checked what Travis-CI was doing and I went on those lines.

@ulidtko
Copy link

ulidtko commented Aug 9, 2019

/me zaps a blessed wand of dead turning on the "Twisted on PyPy" thread. The PR rises from the dead.

@glyph
Copy link
Member

glyph commented Aug 9, 2019

@ulidtko You have successfully nerd-sniped me.

@Julian
Copy link
Member

Julian commented Aug 10, 2019

What's wrong with the travis-provided PyPy that means pyenv needs to be involved?

@glyph
Copy link
Member

glyph commented Aug 10, 2019

Historically it has been unspeakably ancient, and only the most recent pypys are really worth testing. If travis is on the latest we could revert that part.

@glyph
Copy link
Member

glyph commented Aug 10, 2019

(I’d rather just land this as-is and do that as a follow-up though)

@Julian
Copy link
Member

Julian commented Aug 10, 2019 via email

realFromFD = socket.fromfd
if realFromFD.__name__ == fromFDWithoutModifyingFlags.__name__:
return
socket.fromfd = fromFDWithoutModifyingFlags
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So... personally I have experienced cases where twisted has monkey patched globally a thing and that monkey patch introduced bugs in non-twisted code...

I realize how tempting this is over instead just changing code to use a level of indirection, since I presume fromfd is reasonably widely used but... severe :(

Tell me to go away though I guess, and that this is the best way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the best way, at least in this specific case.

  • It's only monkeypatched on pypy3
  • The behavior on pypy3 is buggy as heck and this will fix it for other programs as well.
  • The monkeypatch is harmless (even if the monkeypatch were to get invoked on a different cpython, it would at worst be slightly inefficient unless someone is doing something truly batty with threads).
  • I expect this to be relatively short-lived; it links to the bug, the bug is super straightforward and has a reproducer that's only a half a dozen lines. The other bug I filed today, Armin has already fixed.

Copy link
Member

@Julian Julian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really dislike the monkey patching, but other than that, lgtm.

@glyph glyph merged commit c55c778 into trunk Aug 10, 2019
@glyph glyph deleted the 8505-pypy-travis branch August 10, 2019 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants