pysmb icon indicating copy to clipboard operation
pysmb copied to clipboard

Support python 2 and 3 in single codebase

Open dwoz opened this issue 7 years ago • 8 comments

What's the possibility that we condense down to one codebase that supports both python2 and 3 rather than separate directories?

https://github.com/dwoz/pysmb/tree/master/smb3

dwoz avatar Jul 12 '17 10:07 dwoz

@dwoz: The separation arises from the fact that pysmb has been supporting python 2.5 and below. I think python 2.6 is the first python 2.x to have support for the bytes data type. To be honest, I don't want to antagonize existing pysmb users and risk breaking their scripts when we merge the code base.

If there are others users who are for or against the idea, please feel free to comment here.

miketeo avatar Jul 16 '17 11:07 miketeo

@miketeo Makes sense, I agree it's good to remain backwards compatible. We could try is adding those versions of python to the tox.ini

Circle CI is setup to run the tests and we can all see the test results.

dwoz avatar Jul 17 '17 18:07 dwoz

I think you should leave the packages separate. I contribute to some libraries that are dual compatible, and I think this really only works if you are supporting the latest 2.7 and 3.4+ versions. Wanting to support a very legacy version of Python is fine for libraries like this, but it's best if the modern version can eventually take advantage of some fo the newer language features. It can only really do that if it's standalone.

benmoran56 avatar Jul 18 '17 07:07 benmoran56

I think there are valid arguments for both ways. The additional workload that comes with multi-version support is not worth it and also includes higher risk of breaking code or even worse - applications. Having sources that support all possible versions also make code unreadable and crucial to maintain.

r4ph43l-GitHub avatar Oct 04 '17 16:10 r4ph43l-GitHub

Python 2.6 and lower, and 3.0 to 3.3 are EOL.

image

They're also little used.

Here's the pip installs for pysmb from PyPI for April 2018:

python_version percent download_count
2.7 70.53% 11,298
3.4 14.92% 2,390
3.6 7.49% 1,200
3.5 6.45% 1,033
2.6 0.59% 94
3.3 0.02% 3
3.7 0.01% 1
Total 16,019

Source: pypinfo --start-date 2018-04-01 --end-date 2018-04-30 --percent --pip --markdown pysmb pyversion

Python 2.7 is EOL on 2020-01-01, and many projects have committed to dropping all Python 2 support on or before that date. See http://python3statement.org/

One option is decide when to drop Python 2.7, and keep both directories until that date, and then just remove the python2 directory entirely.

hugovk avatar May 17 '18 11:05 hugovk

I agree that they should be separate directories. I also agree that there should be an EOL for Python 2.7 support since Python 2.7 will be EOL in a little over a year. However, I wouldn't delete the directory. There's no reason not to keep it, as long as it's clear that it won't be updated.

troyhoffman avatar Aug 09 '18 18:08 troyhoffman

All versions of Python 2 are now dead.

ldo avatar Oct 29 '20 03:10 ldo

Here's the pip installs for pysmb from PyPI for October 2020 (so far):

category percent downloads
3.6 41.82% 34,610
3.8 19.75% 16,343
3.7 19.22% 15,905
2.7 15.06% 12,462
3.5 2.17% 1,797
null 1.44% 1,194
3.9 0.26% 218
3.4 0.26% 214
3.10 0.01% 7
Total 82,750

Source: pip install -U pypistats && pypistats python_minor pysmb --this-month

A huge drop for Python 2:

  • 71% in April 2018, to 15% now

hugovk avatar Oct 29 '20 07:10 hugovk