Skip to content

Commit 31d4340

Browse files
authored
Add information for lib3to6 to practicalities
Also update some prose for 2020; and for people like me who only skim headings, re-wrote the not-recommended mitigations in negative voice.
1 parent d43174c commit 31d4340

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

_practicalities/intro.md

+21-13
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ is mostly written with the assumption that software are going to stop Python 2
1111
support, it does perfectly apply to a package that wishes to not support Python 3,
1212
or is stopping support for any minor version.
1313

14-
1514
This page gathers information and links to resources allowing a library
1615
to stop supporting an older version of Python without causing too
1716
much disruption for users who haven't upgraded to this new version.
@@ -313,7 +312,17 @@ You can look at the [full
313312
check](https://github.com/ipython/ipython/blob/6a3e2db0c299dc05e636653c4a43d0aa756fb1c8/setup.py#L23-L58)
314313
that attempt to detect which version of pip is in used.
315314

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. T
319+
hrough automatic conversion using [lib3to6](https://pypi.org/project/lib3to6/)
320+
(similar to BabelJS for JavaScript)
321+
you can generate distribution files that will work on both Python2 and Python3.
322+
Lib3to6 is also useful if your project needs to support older versions of Python3
323+
such as 3.5 but you want to use the latest Python syntax.
324+
325+
## Upload with Twine
317326

318327
You _must_ upload your package with ``twine`` and NOT with ``setup.py upload``.
319328
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
332341
explain why they can't work and what are their drawbacks before you attempt to
333342
implement them.
334343

335-
### Use a meta-package
344+
### Don't use a meta-package
336345

337346
It is possible to release a meta-package that has _virtually_ no code and relies
338347
on a conditional dependency to install its actual core code on the user system.
339348
For example, Frob-6.0 could be a meta-package which depends on
340349
Frob-real-py2 on Python < 3.0, and Frob-real-py3 on Python ≥ 3.4. While
341350
this approach is _doable_ this can make imports confusing.
342351

343-
## Depend on setuptools
352+
## Don't depend on setuptools
344353

345354
You can mark your library as dependent on setuptools greater than 24.3 as this
346355
will ensure that during the next upgrade (when the packages drop python 2
347356
support) will have the right version of setuptools.
348357

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
350359
and to install only on python 2, you will likely have cases where it will still
351360
end up being installed on incompatible versions of Python. Simply because users
352361
upgrade rarely and only an old version of pip or setuptools is enough to make
@@ -355,8 +364,7 @@ the update process broken.
355364
Plus setuptools is rarely an actual dependency of your project but a
356365
requirement to build wheels.
357366

358-
359-
### Multiple sdist files
367+
### Don't write multiple sdist files
360368

361369
Pip (used to) support a "feature" where a sdist ending in `-pyX.Y.tar.gz` would
362370
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.
365373
It is not possible anymore to upload multiple sdist files on PyPI, so this
366374
solution is no longer tenable.
367375

368-
### Wheel only?
376+
### Don't release wheel only
369377

370378
Releasing a package only using wheels for a given python version is doable, but
371379
this will break downstream packages that may require the original source to
372380
reproduce their build.
373381

374382
# Why all *this*?!?
375383

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!
378386

379387
Well there are many reasons for this. First of all, this issue mostly affects
380388
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
390398
both on Python 2 and Python 3. These are the projects that will likely be
391399
affected by this issue.
392400

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
394402
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
397405
systems and people will not be upgraded to Python 3, so this document hopefully
398406
helps to _ensure_ that users get the _least_ breakage as possible and what are the best
399407
practices are to follow.

0 commit comments

Comments
 (0)