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 Python 2.6 support in unit tests and scripts, deprecate it in psutil #1053

Closed
giampaolo opened this issue May 6, 2017 · 4 comments · Fixed by #2039 or #2099
Closed

Drop Python 2.6 support in unit tests and scripts, deprecate it in psutil #1053

giampaolo opened this issue May 6, 2017 · 4 comments · Fixed by #2039 or #2099

Comments

@giampaolo
Copy link
Owner

giampaolo commented May 6, 2017

Maintaining Python 2.6 support is a pain in the butt from a CI / testing perspective for a variety of reason (unittest2, a specific version of mock, setuptools, etc.). Also, both pip and setuptools dropped support for 2.6, so installing psutil on 2.6 is becoming harder (although still possible). For these reasons I would like to drop python 2.6 for tests only.

There is an argument for not dropping 2.6 support in psutil "as a lib" (so excluding tests) yet: CentOS 6. CentOS 6 still ships 2.6 by default and AFAIK it is still in use on a non negligible number of servers (unfortunately). Being psutil a "system library" I am kind of worried about that so I think it'd be nice to keep support for a little while longer and just deprecate it by issuing a warning on import.

CentOS 6 EOL is scheduled for November 2020. I am not sure I want to maintain support 'till then, but the point is that there currently are no 2.7-only features such as set literals, set/dict comprehensions, multiple ctx managers or OrderedDict which I may want to use in psutil code, so why break it?

On the other hand, some of those 2.7-only features may be used in the test suite (e.g. replace contextlib.nexted with multiple ctx managers). As far as 2.6 goes I would still like travis to test it by installing psutil on 2.6 and import it (that's it), but the test suite will not be run.
At the same time, setup.py may print a warning telling that 2.6 is supported but not testable.

As for scripts (/scripts dir): we can also drop support (and e.g. be free to use the argparse module).

TODOs:

  • drop 2.6 support in unit tests and scritps
  • deprecate 2.6 support in psutil by issuing a deprecation warning
@giampaolo giampaolo changed the title Drop Python 2.6 support in unit tests and scripts Drop Python 2.6 support in unit tests and scripts, deprecate it in psutil May 6, 2017
giampaolo added a commit that referenced this issue May 6, 2017
@hugovk
Copy link
Contributor

hugovk commented Oct 28, 2017

Here's the pip installs for psutil from PyPI for the last month, showing relatively low numbers for 2.6.

$ pypinfo --percent --pip psutil pyversion
python_version percent download_count
-------------- ------- --------------
2.7              87.1%      2,389,860
3.5               5.9%        161,854
3.6               4.1%        113,205
3.4               1.7%         47,173
2.6               1.1%         30,921
3.3               0.0%          1,240
3.7               0.0%            573
3.2               0.0%             40
None              0.0%             13
2.8               0.0%             11

Python 3.3 also went EOL and has even lower numbers, so you could consider dropping that too. However, there's not as great a benefit as in dropping 2.6.

@giampaolo
Copy link
Owner Author

Thanks a lot for this. I will definitively drop support for 3.3 as well then. I had no idea download numbers were so big.

@hugovk
Copy link
Contributor

hugovk commented Oct 28, 2017

psutil was the 42nd most-pip-installed from PyPI over the last month!

$ pypinfo --limit 50 "" project
project         download_count
--------------- --------------
simplejson          23,078,938
six                 19,041,813
botocore            15,899,209
python-dateutil     15,430,094
setuptools          14,958,714
pip                 14,831,254
pyyaml              13,845,784
pyasn1              13,394,480
s3transfer          13,238,510
requests            13,192,679
futures             13,108,981
docutils            13,098,192
jmespath            12,148,874
awscli              11,265,646
wheel               11,065,452
rsa                 10,926,175
colorama            10,395,206
idna                 8,962,018
certifi              8,434,862
urllib3              7,975,828
chardet              7,069,936
awscli-cwlogs        6,730,363
cffi                 5,673,479
pbr                  5,630,646
virtualenv           5,384,684
pytz                 4,874,941
boto3                4,746,767
markupsafe           4,739,582
jinja2               4,735,081
pycparser            4,699,732
cryptography         4,364,089
setuptools-scm       4,297,094
enum34               4,212,387
asn1crypto           3,523,116
ipaddress            3,431,710
boto                 3,399,856
decorator            3,065,377
lxml                 3,039,605
pytest-runner        3,000,335
numpy                2,920,002
pyparsing            2,902,246
psutil               2,892,245
click                2,834,914
pyopenssl            2,709,848
argparse             2,658,687
flask                2,553,760
future               2,494,573
werkzeug             2,418,321
tornado              2,354,768
mock                 2,306,457

giampaolo added a commit that referenced this issue Nov 8, 2017
nlevitt added a commit to nlevitt/psutil that referenced this issue Apr 9, 2019
* 'pslisten' of github.com:nlevitt/psutil: (922 commits)
  Update INSTALL.rst
  Pass python_requires argument to setuptools (giampaolo#1208)
  giampaolo#1152: fix doc to mention CLI command necessary to enable disk_io_counters() on win
  pre release
  pre release
  pre release
  pre-release
  fix giampaolo#1201: document that timeout kwarg is expressed in seconds
  Add mount points to disk_partitions() in Windows (giampaolo#775) (giampaolo#1192)
  add test for cpu_affinity
  what a stupid bug! (giampaolo#1190)
  update doc
  pre release
  pre-release; also get rid of PSUTIL_DEBUG doc instructions (it's kinda useless for the user after all)
  Use FutureWarning instead of DeprecationWarning (giampaolo#1188)
  fix test
  refactor environ() test
  Fix OSX pid 0 bug (giampaolo#1187)
  change assert in test
  refactor Process.__repr__
  Faster Process.children(recursive=True) (giampaolo#1186)
  Speedup Process.children()  (giampaolo#1185)
  update doc
  update HISTORY
  fix giampaolo#1179 / linux / cmdline: handle processes erroneously overwriting /proc/pid/cmdline by using spaces instead of null bytes as args separator
  set x bit to test_aix.py
  fix giampaolo#1181: raise AD if task_for_pid() fails with 5 and errno == ENOENT
  fix posix failure
  Arguments for NoSuchProcess and AccessDenied for the C ext (giampaolo#1180)
  fix travis failure https://travis-ci.org/giampaolo/psutil/jobs/306424509
  be smarter in searching python exe
  do not test platf specific modules on wheelhouse
  try to fix travis failure
  fix travis failures
  try to use PYTHON_EXE instead of sys.executable
  giampaolo#1177: give credits to @wiggin15
  OSX: implement sensors_battery (giampaolo#1177)
  improve error msg for old windows systems giampaolo#811
  add debug messages
  do not mention apt-get as method of installation as it's not recommended
  syntax highlight in doc files
  syntax highlight in doc files
  fix doc indentation
  1173 debug mode (giampaolo#1176)
  code style
  update MANIFEST
  giampaolo#1174: use TimeoutExpired in wait_pid()
  sort imports by name
  Move exceptions to separate file (giampaolo#1174)
  appveyor: enable python warnings when running tests
  refactor winmake.py
  use a C global variable to figure out whether we're in testing mode
  fix unicode err
  define a setup() function which is called on import by all C modules
  move PyUnicode compt fun definition up in the file
  rename C func
  re-enable test on appveyor; remove unused C code
  refactor PSUTIL_TESTING C APIs
  inspect PSUTIL_TESTING env var from C again
  giampaolo#1152: (DeviceIOControl), skip disk on ERROR_INVALID_FUNCTION and ERROR_NOT_SUPPORTED
  giampaolo#1152 / win / disk_io_counters(): DeviceIOControl errors were ignored; che return value and retry call on ERROR_INSUFFICIENT_BUFFER
  upgrade dist cmds
  change make cmds
  disable IPv6 tests if IPv6 is not supported
  travis / OSX: run py 3.6 instead of 3.4
  fix giampaolo#1169: (Linux) users() hostname returns username instead
  update README, bump up version
  get rid of PSUTIL_TESTING env var: it must be necessarily set from cmdline, hence 'python -m psutil.tests' won't work out of the box
  try to set PSUTIL_TESTING env var from python before failing
  skip cpu_freq tests if not available (giampaolo#1170)
  update doc
  pre-release
  giampaolo#1053: drop python 3.3 support
  try to fix appveyor failure; also refactor generate_manifest.py
  giampaolo#1167 give CREDITS to @matray
  Including non-unicast packets in packet count calculation (giampaolo#1167)
  fix giampaolo#1166 (doc mistake)
  provide a 'make help' command
  ifconfig.py humanize bytes
  try to limit false positives on appveyor/windows
  reap_children() in a finally block in order to limit false positives
  unicode tests: use different name for test dir
  fix failure on osx/travis
  update Makefile
  fix test
  giampaolo#1164 give CREDITS to @wiggin15
  AIX: implement num_ctx_switches (giampaolo#1164)
  use new PYTHON_EXE
  improve logic to determine python exe location
  add DEVNOTES file; move TODO.aix into _psutil_aix.c
  Fix test_emulate_energy_full_not_avail (giampaolo#1163)
  update README
  try to limit occasional appveyor failure
  Remove trove classifiers for untested and unsupported platforms (giampaolo#1162)
  Fix giampaolo#1154: remove 'threads' method on older AIX (giampaolo#1156)
  give CREDITS to @adpag for giampaolo#1159, giampaolo#1160 and giampaolo#1161
  Fix test asserts due to leftover test subprocesses (giampaolo#1161)
  Fix network tests for newer ifconfig versions. (giampaolo#1160)
  Fix pre-commit hook for python 3.x. (giampaolo#1159)
  revert last commit
  ...
@mayeut
Copy link
Contributor

mayeut commented Apr 3, 2021

Stats from last month:

$ pypinfo --percent psutil pyversion
| python_version | percent | download_count |
| -------------- | ------- | -------------- |
| 3.7            |  30.58% |      6,453,415 |
| 3.8            |  28.27% |      5,965,917 |
| 3.6            |  24.25% |      5,118,593 |
| 2.7            |   9.41% |      1,985,177 |
| 3.9            |   4.35% |        918,440 |
| 3.5            |   3.07% |        647,434 |
| 3.4            |   0.04% |          8,518 |
| 2.6            |   0.02% |          3,904 |
| 3.10           |   0.01% |          2,384 |
| 3.3            |   0.00% |             64 |
| Total          |         |     21,103,846 |

giampaolo added a commit that referenced this issue Apr 15, 2022
Signed-off-by: Giampaolo Rodola <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants