Skip to content

Conversation

@hugovk
Copy link

@hugovk hugovk commented Apr 18, 2020

Fixes #2896.

Also upgrade syntax for Python 3 using https://github.com/asottile/pyupgrade.

@codecov
Copy link

codecov bot commented Apr 18, 2020

Codecov Report

Merging #2919 into master will decrease coverage by 10.74%.
The diff coverage is 36.90%.

@@             Coverage Diff             @@
##           master    #2919       +/-   ##
===========================================
- Coverage   63.30%   52.55%   -10.75%     
===========================================
  Files         466      249      -217     
  Lines       20893    15472     -5421     
  Branches     2901        0     -2901     
===========================================
- Hits        13226     8132     -5094     
- Misses       7301     7340       +39     
+ Partials      366        0      -366     

@hugovk hugovk mentioned this pull request Apr 18, 2020
2 tasks
@bastimeyer
Copy link
Member

bastimeyer commented Apr 18, 2020

Thanks for taking the time doing this and submitting the pull request!
Oh boy, that are a ton of changes (+1,859 −2,728)...

Just a couple of early thoughts from my side after a first quick review:

  • It would probably be better to split this up into more commits, for reviewing reasons. One commit for each operation pyupgrade supports, for example, if it's possible, similar to Flake8 #2804. This would also be better for the commit history, git blame, etc...
  • The string format related changes are probably unneeded or rather too much, as they only make explicit string templates implicit. Also, there's the 3.5 support drop in September, which enables the usage of f-strings once we go >=3.6, making these changes therefore a bit redundant.
  • The included flashmedia package still has a compat file with py2 stuff, even though some of its files were modified.
  • The order of imports in some modules has changed after the removal of the compat module. There's no linting rule for that here and not really important now, just wanted to mention it though.
  • By removing one python version from the build matrix in the GH workflow file, the CodeCov comment threshold also needs to be changed in its config file. (not important now)

@beardypig
Copy link
Member

beardypig commented Apr 19, 2020

I would say the first change should be to update the docs and disallow Python 2 installs by updating setup.py and setup.cfg to remove the Python 2 specifics.

I believe that setup.cfg needs to be updated to remove this:

[wheel]
universal = 1

Perhaps a guard in setup.py needs to be added, something like

if sys.version_info < (3, 5):
    sys.exit('streamlink is only supported on Python 3.5 and later')

Once it is only possible to install streamlink on Python 3, then we can remove the Python 2 cruft.

It would be nice to target Python 3.6+, but I don't know if that will be popular :)

@hugovk
Copy link
Author

hugovk commented Apr 19, 2020

Thanks for the comments! Yeah, it's a big one!

PR #2920 is a minimal version of this, with the first commit from here, plus a few bits from the last commit here, plus @beardypig's suggestions.

Then we can deal with fine-grained pyupgrade and the compat replacements separately.

The order of imports in some modules has changed after the removal of the compat module. There's no linting rule for that here and not really important now, just wanted to mention it though.

I've found https://github.com/timothycrosley/isort/ great for taking the hassle out this.

@bastimeyer
Copy link
Member

#3270 already has all compat imports removed.

@hugovk hugovk closed this Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python 2.7 support

3 participants