From Fedora Project Wiki

< Changes

Revision as of 16:57, 9 August 2016 by Ignatenkobrain (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

System Python

Summary

Separate several subpackages from the python3 packages - a system-python(-libs) that can be required by various tools that consider themselves "system tools".

Owner

  • Email: python-maint@redhat.com
  • Release notes owner:

Current status

Detailed Description

python3 package to be split in several more subpackages:

  • system-python-libs - a subset of standard Python library considered essential to run "system tools" requiring Python
  • system-python - /usr/libexec/system-python binary (interpreter) for the tools to be able to run, provides system-python(abi)
  • python3-libs brings in the remaining subset of standard Python library and will require system-python-libs, thus packages requiring it (directly or indirectly) will get the entire standard Python library
  • python3 still requires python3-libs and provides python(abi)

The term "system tool" in this context means any package where a maintainer wishes to require system-python package instead of python3 package.

Any package requiring "python(abi) = 3.x" (currently all Python modules and apps) will still bring in the entire standard library and thus will not be affected by this change in any way. Since this dependency is automatically generated, macros will be provided to remove it and depend on "system-python(abi) = 3.x" instead.

If a package maintainer wishes to depend on system-python instead of python3 it is their responsibility to cooperate with the maintainers of all the Python dependencies of their package and do the same thing there. For example consider package foo requiring python3-bar; if foo's maintainer wishes to require system-python instead of python3, they must be sure to make sure python3-bar does this as well, otherwise the depednency chain would bring in python3 package anyway.

Benefit to Fedora

system-python(-libs) will be smaller than python3(-libs) and thus it can reduce the size of images where size is critical, such as Fedora Cloud.

Once this change is complete, we can cooperate with maintainers of tools to require system-python instead of python3 and make sure python3 package is not dragged as a dependency on such installations.

Scope

  • Proposal owners:
    • determine what the essential subset of the standard library is (investigate packages that later might become "system tools")
    • split the subset into a subpackage system-python-libs
    • create system-python binary and package
    • invent macros to change the requirement of python-abi
    • test if present packages requiring python3 or python-abi = 3.x work


  • Other developers: N/A (not a System Wide Change)
  • Release engineering: N/A (not a System Wide Change)
  • Policies and guidelines:
    • introduce a change to Python packaging guidelines for package maintainers to be able to profit from this change (after the implementation is ready)


  • Trademark approval: N/A (not needed for this Change)

Upgrade/compatibility impact

N/A (not a System Wide Change)

How To Test

TBD

User Experience

They should not notice any change. Later, when packages depend on system-python, user can benefit form a smaller Cloud image and such.

Dependencies

As explained above, other packages can choose to depend on system-python instead of python3 once this change is done. But we do not require them to do so in order to finish this change.

Contingency Plan

  • Contingency mechanism:
    • Rollback the change in python3.spec
  • Contingency deadline: N/A (not a System Wide Change)
  • Blocks release? No

Documentation

In order to make your package stop depending on regular Python 3 and depend on System Python, use this macro:

%{?system_python_abi}

In case you are dealing with subpackages, which is mostly the case with Python 3, put the macro in the subpackage's scope (in the same place you would put Requires for the subpackage).

This macro uses __requires_exclude and thus have several consequences:

  • It will remove the requirement of python(abi) = 3.* from all of your subpackages and the main package. So if you have multiple Python 3 subpackages and only intend to use it for one, you'll need to put Requires: python(abi) = %{python3_version} manually in for the (sub)packages that should not be affected.
  • If you are already using any other macros for filtering requirements, you should not use %{?system_python_abi} but instead do this manually (filter python(abi) and add system-python(abi))
    • Note that sometimes the filters you find in the spec are unnecessary for modern Fedoras, so try removing them first and see if it has any effect.

At the end of %install section, change the shebang of any Python 3 scripts, for example like this:

%{?system_python_abi:sed -i 's|#!%{__python3}|#!%{_libexecdir}/system-python|' %{buildroot}%{_bindir}/foo}

Release Notes

TBD