@@ -11,7 +11,6 @@ is mostly written with the assumption that software are going to stop Python 2
11
11
support, it does perfectly apply to a package that wishes to not support Python 3,
12
12
or is stopping support for any minor version.
13
13
14
-
15
14
This page gathers information and links to resources allowing a library
16
15
to stop supporting an older version of Python without causing too
17
16
much disruption for users who haven't upgraded to this new version.
@@ -313,7 +312,17 @@ You can look at the [full
313
312
check] ( https://github.com/ipython/ipython/blob/6a3e2db0c299dc05e636653c4a43d0aa756fb1c8/setup.py#L23-L58 )
314
313
that attempt to detect which version of pip is in used.
315
314
316
- ## Upload with Twine.
315
+ ## If your users absolutely need Py2.7 but you want to move on
316
+
317
+ If you have users that still depend on Python 2.7 and you cannot drop support yet,
318
+ it may nonetheless be possible to start using Python 3 in your codebase.
319
+ Through automatic conversion using [ lib3to6] ( https://pypi.org/project/lib3to6/ )
320
+ (similar to Babel for JavaScript)
321
+ you can generate distribution files that will work on both Python 2 and Python 3.
322
+ Lib3to6 is also useful if your project needs to support older versions of Python 3
323
+ such as 3.5 but you want to use the latest Python syntax.
324
+
325
+ ## Upload with Twine
317
326
318
327
You _ must_ upload your package with `` twine `` and NOT with `` setup.py upload `` .
319
328
If you have an old version of setuptools or `` distutils `` , even if
@@ -332,21 +341,21 @@ and that you will hear about. This is an attempt to acknowledge them, and
332
341
explain why they can't work and what are their drawbacks before you attempt to
333
342
implement them.
334
343
335
- ### Use a meta-package
344
+ ### Don't use a meta-package
336
345
337
346
It is possible to release a meta-package that has _ virtually_ no code and relies
338
347
on a conditional dependency to install its actual core code on the user system.
339
348
For example, Frob-6.0 could be a meta-package which depends on
340
349
Frob-real-py2 on Python < 3.0, and Frob-real-py3 on Python ≥ 3.4. While
341
350
this approach is _ doable_ this can make imports confusing.
342
351
343
- ## Depend on setuptools
352
+ ## Don't depend on setuptools (unless version >=24.3)
344
353
345
354
You can mark your library as dependent on setuptools greater than 24.3 as this
346
355
will ensure that during the next upgrade (when the packages drop python 2
347
356
support) will have the right version of setuptools.
348
357
349
- Of course regardless of all the care you will take for your library to no break
358
+ Of course regardless of all the care you will take for your library to not break
350
359
and to install only on python 2, you will likely have cases where it will still
351
360
end up being installed on incompatible versions of Python. Simply because users
352
361
upgrade rarely and only an old version of pip or setuptools is enough to make
@@ -355,8 +364,7 @@ the update process broken.
355
364
Plus setuptools is rarely an actual dependency of your project but a
356
365
requirement to build wheels.
357
366
358
-
359
- ### Multiple sdist files
367
+ ### Don't write multiple sdist files
360
368
361
369
Pip (used to) support a "feature" where a sdist ending in ` -pyX.Y.tar.gz ` would
362
370
only be seen as compatible on Python X.Y, thus it used to be possible to
@@ -365,16 +373,16 @@ publish multiple sdist of a package targeting various python version.
365
373
It is not possible anymore to upload multiple sdist files on PyPI, so this
366
374
solution is no longer tenable.
367
375
368
- ### Wheel only?
376
+ ### Don't release wheel only
369
377
370
378
Releasing a package only using wheels for a given python version is doable, but
371
379
this will break downstream packages that may require the original source to
372
380
reproduce their build.
373
381
374
382
# Why all * this* ?!?
375
383
376
- You might wonder why all this, it's 2018 already, so how come this is still an
377
- issue? Python 3 has been out for 9 + years now!
384
+ You might wonder why all this, it's 2020 already, so how come this is still an
385
+ issue? Python 3 has been out for 11 + years now!
378
386
379
387
Well there are many reasons for this. First of all, this issue mostly affects
380
388
libraries that are currently python 2 and Python 3 compatible at the same time.
@@ -390,10 +398,10 @@ minor versions of Python 3 that saw a majority of single-source projects working
390
398
both on Python 2 and Python 3. These are the projects that will likely be
391
399
affected by this issue.
392
400
393
- The introduction of Python 3 was chaotic; there are still strong arguments in both
401
+ The introduction of Python 3 was chaotic; there were strong arguments in both
394
402
the Python 2 and Python 3 camps. Regardless of what side you take, the ones suffering
395
- the most from this are users (starting with the fact that inevitably some libraries
396
- will stop supporting for Python 2 and release Python 3 only library ). Inevitably, some
403
+ the most from this are users (starting with the fact that some libraries
404
+ have stopped supporting for Python 2 and released Python 3 only versions ). Inevitably, some
397
405
systems and people will not be upgraded to Python 3, so this document hopefully
398
406
helps to _ ensure_ that users get the _ least_ breakage as possible and what are the best
399
407
practices are to follow.
0 commit comments