1
0

faq-py2-deprecation.rst 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. .. _faq-py2-deprecation:
  2. Python 2 Deprecation FAQ
  3. ========================
  4. .. contents:: FAQ
  5. Why are we deprecating Python 2?
  6. --------------------------------
  7. Python 2.7.18 was the final release of Python2, released in April 2020.
  8. At this point, Python 2 will no longer receive any unpaid support. The
  9. Python core developers are focusing their efforts on improving and
  10. enhancing Python 3. Additionally, many libraries that Salt depends on
  11. have also dropped Python 2 support.
  12. To take advantage of continued support and improvements, Salt is joining
  13. the ranks of projects that are dropping legacy Python support in favor
  14. of Python 3.
  15. Was this announced/decided before making the change?
  16. ----------------------------------------------------
  17. `SEP
  18. 5 <https://github.com/saltstack/salt-enhancement-proposals/blob/master/accepted/0005-retire-py2-support.md>`__
  19. was approved in April, 2019.
  20. Can I contribute Python 2 code?
  21. -------------------------------
  22. For several years, Salt has been a Python 2/3 codebase, requiring Python
  23. 3 support for all contributions. The only changes contributors can
  24. expect to this process is that we will now accept Python 3-only code
  25. changes.
  26. While there *is* a significant subset of Python that is compatible with
  27. both Python 3 and legacy Python, changes requiring ``six`` or otherwise
  28. removing Python 3-only code will not be accepted.
  29. What if my OS does not include Python 3 packages? Or, how do I upgrade from Salt on Python 2 to Salt on Python 3?
  30. -----------------------------------------------------------------------------------------------------------------
  31. There are several options to upgrade to Python 3.
  32. On Modern Platforms
  33. ~~~~~~~~~~~~~~~~~~~
  34. At this point, most modern Linux distributions have Python 3 packages.
  35. Ubuntu 20.04 LTS has moved to Python 3.8 as it’s default system Python.
  36. On Other Platforms
  37. ~~~~~~~~~~~~~~~~~~
  38. Build Your Own
  39. ^^^^^^^^^^^^^^
  40. If your current distribution does not have Python 3 it’s `pretty simple
  41. to use Salt <https://www.youtube.com/watch?v=Zq0XXtIKx_Q>`__ to build
  42. and distribute Python 3 on your own. Installing Python 3 and pip
  43. installing Salt gives you the most control over your distribution.
  44. ``pop-build`` distributions
  45. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  46. Another approach is to use the ``pop-build`` distribution of Salt. With
  47. the Sodium release we will begin releasing packages for Salt using
  48. ``pop-build``, in tandem with our normal build process. The
  49. ``pop-build`` distribution will contain Salt, Python, and any necessary
  50. dependencies, which will make it trivial to have a completely supported
  51. version of Salt.
  52. Will you support a Python 3 master with an older Python 2 minion?
  53. -----------------------------------------------------------------
  54. Yes! Our policy of keeping newer masters backwards compatible with *at
  55. least* the most recent minion version is not changing. You should be
  56. able to run modern Salt Masters on Python 3 with slightly older minions
  57. running on legacy Python. Of course, if you want your minions to be able
  58. to take advantage of the newest features in Salt, upgrading to Python 3
  59. will be necessary.
  60. Will you support Python 2 master with a new Python 3 minion?
  61. ------------------------------------------------------------
  62. In keeping with our existing policy, we make no guarantees about older
  63. masters with newer minions. It *may* work, but breakages are common and
  64. should be expected.
  65. How does this impact Salt-SSH support?
  66. --------------------------------------
  67. Salt-SSH will need Python 3 on the target minions. We will be upgrading
  68. Salt-SSH to provide instructions or recommendations on adding Python3 if
  69. it is not detected.
  70. What is your plan for removing Python 2 code?
  71. ---------------------------------------------
  72. Legacy Python code will be gradually removed from the Salt codebase.
  73. While we could remove most of it at once, that introduces a high level
  74. of risk. Instead, beginning with the Sodium (v3001) release, Salt will
  75. simply drop support for Python 2. PRs will no longer be required to
  76. support Python 2 before merging.
  77. Over time, as modules are changed, ``six`` and other legacy Python
  78. syntax will be removed. It may be at some point in the future it becomes
  79. necessary to remove the last vestiges of legacy Python from Salt, but
  80. currently the plan is to take a more measured approach.
  81. Will Salt continue to package for Python 2?
  82. -------------------------------------------
  83. No. Beginning with Sodium (v3001), Salt will no longer release packages
  84. for, or support Python 2.