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

Add support for recent CPython and PyPy versions, drop support for Python 2 #680

Merged
merged 31 commits into from
Oct 8, 2022

Conversation

amotl
Copy link
Collaborator

@amotl amotl commented Oct 6, 2022

Dear Chris,

following up on #679 (comment), this patch aims to drop support for CPython 2, PyPy 2 and PyPy 3.5, and add support for PyPy 3.6 - 3.9. While being at it, it also adds support for CPython 3.10. The new Python version labels for Travis CI have been picked from the corresponding documentation at 1.

With kind regards,
Andreas.

Footnotes

  1. https://docs.travis-ci.com/user/languages/python/#python-versions

@amotl

This comment was marked as resolved.

@amotl amotl force-pushed the amo/ci-modernize-pypy branch 2 times, most recently from f784be0 to 6482d9a Compare October 6, 2022 22:07
@codecov-commenter
Copy link

codecov-commenter commented Oct 6, 2022

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (7e47cfd) compared to base (f7244cc).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##            master      #680    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files          112       112            
  Lines        14604     14388   -216     
  Branches      2775      2754    -21     
==========================================
- Hits         14604     14388   -216     
Impacted Files Coverage Δ
apprise/attachment/AttachBase.py 100.00% <ø> (ø)
apprise/cli.py 100.00% <ø> (ø)
apprise/plugins/NotifyEmby.py 100.00% <ø> (ø)
apprise/plugins/NotifyMQTT.py 100.00% <ø> (ø)
apprise/plugins/NotifyMattermost.py 100.00% <ø> (ø)
apprise/plugins/NotifyTwist.py 100.00% <ø> (ø)
apprise/Apprise.py 100.00% <100.00%> (ø)
apprise/AppriseAsset.py 100.00% <100.00%> (ø)
apprise/AppriseAttachment.py 100.00% <100.00%> (ø)
apprise/AppriseConfig.py 100.00% <100.00%> (ø)
... and 62 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@amotl amotl force-pushed the amo/ci-modernize-pypy branch 2 times, most recently from ed190b2 to 0313e0d Compare October 6, 2022 22:52
@amotl amotl force-pushed the amo/ci-modernize-pypy branch 2 times, most recently from 609254d to bb196ec Compare October 6, 2022 23:38
@amotl amotl changed the title CI: Modernize testing on PyPy CI: Modernize CPython and PyPy versions Oct 6, 2022
amotl added 5 commits October 7, 2022 01:47
Drop support for PyPy 2 and PyPy 3.5. Add support for PyPy 3.6 - 3.9.
AttributeError: 'EntryPoints' object has no attribute 'get'

ERROR: InvocationError for command /home/travis/build/caronc/apprise/.tox/pypy37/bin/flake8 . --count --show-source --statistics (exited with code 1)
@amotl amotl force-pushed the amo/ci-modernize-pypy branch from bb196ec to 80680d5 Compare October 6, 2022 23:47
@amotl amotl marked this pull request as ready for review October 7, 2022 00:59
@amotl
Copy link
Collaborator Author

amotl commented Oct 7, 2022

Hi Chris,

The drop in code coverage is originating from places in the code which have been there for Python 2 compatibility.

image

At this point, i don't see the harm in dropping the earlier versions of Python.

Excellent. I will remove the corresponding spots with another commit, please wait with merging the patch.

With kind regards,
Andras.

@amotl amotl changed the title CI: Modernize CPython and PyPy versions Add support for recent CPython and PyPy versions, drop support for Python 2 Oct 7, 2022
@amotl
Copy link
Collaborator Author

amotl commented Oct 7, 2022

Dear Chris,

0a6558f removes most parts of the code which was specific to Python 2.

With kind regards,
Andreas.

@amotl amotl force-pushed the amo/ci-modernize-pypy branch from 47d16fc to 0a6558f Compare October 7, 2022 10:46
@amotl
Copy link
Collaborator Author

amotl commented Oct 7, 2022

image

I think that looks good now, so the patch would be ready to be merged if you don't have any other objections.

Otherwise, the process will try to install the most recent version,
which will need a Rust toolchain. cryptography 3.3 is the last one which
does not.
@caronc
Copy link
Owner

caronc commented Oct 7, 2022

Wow! looks like you nailed it! Great job Andreas!

@amotl
Copy link
Collaborator Author

amotl commented Oct 7, 2022

Thank you very much for jumping in and helping out with many important details so quickly, Chris. It was fun. Let's get it merged quickly before it falls apart again ;].

The new changes, after your io.open patch, are: 2ec6f5f...panodata:amo/ci-modernize-pypy

@amotl amotl requested review from caronc and YoRyan and removed request for caronc and YoRyan October 7, 2022 23:18
@caronc
Copy link
Owner

caronc commented Oct 7, 2022

I promise i will; I just want to be sure it builds correctly on Copr as now CentOS 7 support is completely gone and some significant rewrites to the RPM Spec file.

Once that's green lit, we're good for a merge for sure.

Yikes, there are some hard failures showing up already in fedora rawhide when the unit tests run

@amotl
Copy link
Collaborator Author

amotl commented Oct 7, 2022

All right, here we go. RuntimeWarning: coroutine 'notify' was never awaited all over the place ;].

-- https://download.copr.fedorainfracloud.org/results/lead2gold/apprise/fedora-36-x86_64/04893864-python-apprise/build.log.gz

@amotl
Copy link
Collaborator Author

amotl commented Oct 7, 2022

I see that something uses the /usr/lib/python3.10/site-packages/mock/mock.py, i.e. mock.mock instead of unittest.mock. Maybe I was wrong to add 0a8c012 without actually knowing what I was doing? Please feel free to revert!

@caronc
Copy link
Owner

caronc commented Oct 7, 2022

Erhm.... 😲 ... remember i said i made some changes and i broke everything... that I'd wait for @YoRyan? I think i just pushed that... let me wipe my dev and reset using your branch 🤦‍♂️ .... oh boy, I'll be that's it.

Stand by we're going to try this again.

Edit: Hmm; I'm not sure what it is now. I don't think you or i touched the Async stuff...

@caronc
Copy link
Owner

caronc commented Oct 7, 2022

I see that something uses the /usr/lib/python3.10/site-packages/mock/mock.py, i.e. mock.mock instead of unittest.mock. Maybe I was wrong to add 0a8c012 without actually knowing what I was doing? Please feel free to revert!

Yes, this might be it; stand by

@@ -21,7 +21,6 @@ python_files = test/test_*.py
norecursedirs=test/helpers
filterwarnings =
once::Warning
strict = true
Copy link
Owner

Choose a reason for hiding this comment

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

Just a quick comment as to why we dropped strict? Didn't see this until now (totally un-related to issues on Copr though)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It raised a PytestConfigWarning: Unknown config option: strict, so I removed it with 4f6e18a without thinking much about it. Apologies, feel free to revert!

"""
warnings.warn("A future version of Apprise will add the `async` "
Copy link
Owner

Choose a reason for hiding this comment

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

The #TODO ref is good, but the async is already in place today

We don't need this warning at all. We just didn't have the async keyword there (and had some magic in front of it, so the code could co-exist in a Python v2.7 environment. we're good here for sure.

Copy link
Collaborator Author

@amotl amotl Oct 8, 2022

Choose a reason for hiding this comment

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

Maybe I am not right on track yet, but didn't we just observe that adding async breaks the test suite completely, as it will likewise do for others?

Maybe it is too late at night already for me to correctly understand why adding async is not problematic ;]. Feel free to adjust as necessary. Thanks for your patience!

Copy link
Owner

Choose a reason for hiding this comment

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

You might be right here; but to my knowledge we were async code that under the hood created an async object. The chagne Ryan would make would be more then the bug i introduced by only updating one function. The wrappers under the hood will disappear . But i could also be misinterpreting what is wrong here.

@amotl
Copy link
Collaborator Author

amotl commented Oct 8, 2022

The symptoms as outlined at, for example, [1], are exactly the same when I say async def async_notify on my machine.

28 failed, 278 passed, 7 skipped, 52 warnings in 33.58s

This is what we discussed above at #680 (comment). Are you sure that this eventual change on your machine did not accidentally go to Copr?

[1] https://download.copr.fedorainfracloud.org/results/lead2gold/apprise/fedora-36-x86_64/04893864-python-apprise/build.log.gz

@caronc
Copy link
Owner

caronc commented Oct 8, 2022

The symptoms as outlined at, for example, [1], are the same when I say async def async_notify, what we discussed above. Are you sure that this eventual change on your machine did not accidentally go to Copr?

[1] https://download.copr.fedorainfracloud.org/results/lead2gold/apprise/fedora-36-x86_64/04893864-python-apprise/build.log.gz

No, definitely using the branch as is right now. It's very strange that it's broken. It should at least work on the bleeding edge versions of Fedora. We're so close... ugh. Let me try a few things; i'm not out of ideas yet :)

@amotl
Copy link
Collaborator Author

amotl commented Oct 8, 2022

The symptoms as outlined at, for example, [1], are exactly the same when I say async def async_notify on my machine. Are you sure that this eventual change on your machine did not accidentally go to Copr?

No, definitely using the branch.

I've just downloaded the source RPM from the most recent build [1] and looked at it using Midnight Commander.

image

[1] https://download.copr.fedorainfracloud.org/results/lead2gold/apprise/epel-8-aarch64/04893879-python-apprise/python-apprise-1.0.0-3.el8.src.rpm

@caronc
Copy link
Owner

caronc commented Oct 8, 2022

If found the error in my build process (script piping stuff to &>/dev/null because they were otherwise noisy)... but missing on errors when using your repo. Good catch... we're going green now: https://copr.fedorainfracloud.org/coprs/lead2gold/apprise/build/4893892/

# An extra environment where additional packages are not installed
- python: "3.9"
env:
- TOXENV=bare

install:
- pip install babel
# upgrade tox, pip, and virtualenv so Python 3.6 will build crytography:
# https://travis-ci.community/t/pip-install-cryptography-fails-on-py36/11233
- pip install -U tox pip virtualenv
Copy link
Owner

Choose a reason for hiding this comment

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

Any value in bringing this back? This 1 liner allowed all pip calls to install cryptography (regardless of what version)

Copy link
Collaborator Author

@amotl amotl Oct 8, 2022

Choose a reason for hiding this comment

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

It's right there, just tweaked it a bit and accidentally removed your comment.

# Use up-to-date versions of tox, pip, virtualenv, and wheel.
pip install --upgrade tox pip virtualenv wheel

@caronc
Copy link
Owner

caronc commented Oct 8, 2022

I'm happy; not going to wait until the build finishes.... Thanks for all of your great work @amotl

@caronc caronc merged commit 00afe4e into caronc:master Oct 8, 2022
@caronc caronc deleted the amo/ci-modernize-pypy branch October 8, 2022 00:28
@amotl
Copy link
Collaborator Author

amotl commented Oct 8, 2022

Thanks Chris. It was great working together with you on this patch. Cheers also to Ryan.

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.

4 participants