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

Drop support for Python < 2.6 #195

Merged
merged 3 commits into from
Jan 20, 2018
Merged

Drop support for Python < 2.6 #195

merged 3 commits into from
Jan 20, 2018

Conversation

latk
Copy link
Member

@latk latk commented Jan 13, 2018

The code base needs to be compatible across a wide range of Python versions. But that can only go so far. The user guide mentions these supported versions:

CPython 2.7, 3.4, and 3.5, and PyPy 2.7 and 3.5.

It is also likely that some users are stuck on 2.6, so we shouldn't intentionally break 2.6 compatibility (at least not without a good reason).

But support of earlier versions has disproportianate cost and little value. This PR removes any code that is unreachable under 2.6 or later.

As an additional change, the unit tests now use decorators to annotate the test classes.

@hugovk
Copy link

hugovk commented Jan 15, 2018

Here's the pip installs for gcovr from PyPI for the last month (via pypinfo --percent --pip --markdown gcovr pyversion)

python_version percent download_count
2.7 65.3% 3,716
3.5 16.7% 949
3.4 14.8% 842
2.6 2.1% 118
3.6 1.1% 65

Copy link

@hugovk hugovk left a comment

Choose a reason for hiding this comment

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

You could also add python_requires to setup.py to help pip. For example, see: https://stackoverflow.com/a/44660547/724176

Also, it would be useful to add version classifiers to setup.py (https://pypi.python.org/pypi?%3Aaction=list_classifiers).

And there's a few other bits that can be removed:

  • gcovr/admin/virtualenv.py

    Lines 120 to 121 in 16c81cc

    if minver <= 3:
    REQUIRED_MODULES.extend(['sets', '__future__'])

  • if minver <= 3:
    REQUIRED_MODULES.extend(['sets', '__future__'])

  • if sys.version_info <= (2, 3):
    print('ERROR: %s' % sys.exc_info()[1])
    print('ERROR: this script requires Python 2.4 or greater; or at least the subprocess module.')
    print('If you copy subprocess.py from a newer version of Python this script will probably work')
    sys.exit(101)

(There's probably some old Python 3.x stuff that can go from there too, is only 3.4+ supported?)

@latk
Copy link
Member Author

latk commented Jan 15, 2018

Thank you @hugovk for these statistics – they demonstrate that this change will not hurt users.

And thank you too for the suggestions re classifiers and python_requires, I'll look into those shortly.

The remaining unneeded version checks are constrained to the vendored virtualenv scripts. This will be resolved by deleting the scripts completely in #190.

latk added a commit to latk/gcovr that referenced this pull request Jan 20, 2018
As suggested by hugovk in gcovr#195.

The classifiers now list all versions tested by Travis CI. This
excludes 2.6.

The "python_requires" setting is the minimum allowed version, and will
be checked by pip during installation.
The code base needs to be compatible across a wide range of Python
versions. But that can only go so far. The user guide mentions these
supported versions:

> CPython 2.7, 3.4, and 3.5, and PyPy 2.7 and 3.5.

It is also likely that some users are stuck on 2.6, so we shouldn't
intentionally break 2.6 compatibility (at least not without a good
reason).

But support of earlier versions has disproportianate cost and little
value. This commit removes any code that is unreachable under 2.6 or
later.
As suggested by hugovk in gcovr#195.

The classifiers now list all versions tested by Travis CI. This
excludes 2.6.

The "python_requires" setting is the minimum allowed version, and will
be checked by pip during installation.
@latk latk merged commit db9181f into gcovr:master Jan 20, 2018
@latk latk deleted the drop-ancient-python branch January 20, 2018 18:04
@latk latk removed the needs review label Jan 20, 2018
goriy pushed a commit to goriy/gcovr that referenced this pull request Jan 21, 2018
As suggested by hugovk in gcovr#195.

The classifiers now list all versions tested by Travis CI. This
excludes 2.6.

The "python_requires" setting is the minimum allowed version, and will
be checked by pip during installation.
JamesReynolds pushed a commit to JamesReynolds/gcovr that referenced this pull request Mar 8, 2018
As suggested by hugovk in gcovr#195.

The classifiers now list all versions tested by Travis CI. This
excludes 2.6.

The "python_requires" setting is the minimum allowed version, and will
be checked by pip during installation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants