Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Python Packaging in Fedora

Python Packaging in Fedora

For Flock (Fedora contributors' conference) in Krakow

Petr Viktorin

August 02, 2016
Tweet

More Decks by Petr Viktorin

Other Decks in Technology

Transcript

  1. Python Packaging in Fedora
    Petr Viktorin
    [email protected]
    Flock, 2016-08-02

    View full-size slide

  2. Python 1991
    Java 1995

    View full-size slide

  3. Python 1991
    Java 1995
    Python 3.0 2008
    Node.js 2009

    View full-size slide

  4. Python 1991
    Java 1995
    Python 3.0 2008
    Node.js 2009
    Python 3.5 2015

    View full-size slide

  5. Python 1991
    Java 1995
    Python 3.0 2008
    Node.js 2009
    Python 3.5 2015
    Python 2 EOL 2020

    View full-size slide

  6. Python 3 Porting Database
    http://fedora.portingdb.xyz

    View full-size slide

  7. at least
    49,9%
    of Python software
    packaged in Fedora
    supports Python 3

    View full-size slide

  8. at least
    49,9%
    of Python software
    packaged in Fedora
    supports Python 3
    45,5%
    has the Py 3 version packaged

    View full-size slide

  9. Help us port!
    3
    PYTHON3
    PYTHON3
    PYTHON
    http://fedora.portingdb.xyz

    View full-size slide

  10. Fedora infra
    Desktop toolkits
    Big non-Python apps

    View full-size slide

  11. I. Python 3
    II. Automating
    Packaging

    View full-size slide

  12. A packager should:
    1. Make sure SW plays nice
    2. Integrate with rest of system
    3. Check licenses, patents, etc.

    View full-size slide

  13. A packager should:
    1. Make sure SW plays nice
    2. Integrate with rest of system
    3. Check licenses, patents, etc.
    4. Read 50 pages of guidelines
    5. Know a weird macro language

    View full-size slide

  14. %global pypi_name mypkg
    Name: python -%{pypi_name}
    Version: 2.4.25.1
    Release: 1%{?dist}
    License: Python
    URL: https://github.com
    /%{pypi_name}/%{pypi_name}
    Source0: https://pypi.python
    .org/packages/source/p/%{
    pypi_name}/%{pypi_name}-%{version
    }.tar.gz

    View full-size slide

  15. %if 0%{?rhel} && 0%{?rhel} <= 6
    %{!?__python2: %global \
    __python2 /usr/bin/python2}
    %{!?python2_sitelib: %global \
    python2_sitelib %(%{__python2} -c
    %endif
    %if 0%{?fedora} > 12 || 0%{?rhel} >
    %global with_python3 1
    %global __python3 python3
    %endif

    View full-size slide

  16. from distutils.core import setup
    setup(
    name='mypkg ',
    version='2.4.25.1',
    author='Me',
    url='github.com/me/mypkg/',
    packages=['mypkg '],
    install_requires=['six '],
    )

    View full-size slide

  17. Enter pyp2rpm
    # dnf install /usr/bin/pyp2rpm
    $ pyp2rpm mypkg

    View full-size slide

  18. Enter pyp2rpm
    # dnf install /usr/bin/pyp2rpm
    $ pyp2rpm mypkg
    It might actually work!

    View full-size slide

  19. We can use pyp2rpm to...
    Auto-build all of PyPI in COPR!

    View full-size slide

  20. We can use pyp2rpm to...
    Auto-build all of PyPI in COPR!
    Why?

    View full-size slide

  21. We can use pyp2rpm to...
    Auto-build all of PyPI in COPR!
    Why?
    - Test pyp2rpm

    View full-size slide

  22. We can use pyp2rpm to...
    Auto-build all of PyPI in COPR!
    Why?
    - Test pyp2rpm
    - Run upstream tests

    View full-size slide

  23. We can use pyp2rpm to...
    Auto-build all of PyPI in COPR!
    Why?
    - Test pyp2rpm
    - Run upstream tests
    - Provide a repository

    View full-size slide

  24. dnf pip install -r requirements.txt
    (hypothetical command)

    View full-size slide

  25. “PyPI” name Fedora pkg
    pyopencl python3-pyopencl
    mypy-lang python3-mypy

    View full-size slide

  26. “PyPI” name Fedora pkg
    pyopencl python3-pyopencl
    mypy-lang python3-mypy
    $ dnf repoquery --provides
    python3 -pyopencl
    ...
    python3.5dist(pyopencl) = 2015.2
    ...

    View full-size slide

  27. “PyPI” name Fedora pkg
    pyopencl python3-pyopencl
    mypy-lang python3-mypy
    $ dnf repoquery --provides
    python3 -pyopencl
    ...
    python3.5dist(pyopencl) = 2015.2
    ...
    Live in Fedora 25!

    View full-size slide

  28. I. Python 3
    II. Automating Packaging
    III. System
    Python

    View full-size slide

  29. System Python
    /usr/libexec/system-python
    An effort to minimize minimal
    installs
    (cloud images)

    View full-size slide

  30. Python stdlib by disk size
    test
    asyncio
    email
    tkinter
    encodings
    distutils
    unittest
    pydoc_data
    ensurepip
    ctypes
    lib2to3
    idlelib
    individual
    modules

    View full-size slide

  31. System Python libs
    /usr/libexec/system-python
    /usr/lib/python3.5/
    lib2to3
    unittest
    venv
    ensurepip
    pydoc
    encodings
    sqlite3
    collections
    logging
    distutils
    html
    test
    tkinter
    turtledemo
    idlelib
    system-python-libs
    python3-libs
    python3-test
    python3-tkinter
    python3
    system-python
    /usr/bin/python3

    View full-size slide

  32. Possible users: DNF, cloud-init

    View full-size slide

  33. Possible users: DNF, cloud-init
    Future: Isolation of system
    tools?

    View full-size slide

  34. I. Python 3
    II. Automating Packaging
    III. System Python
    IV. Python 3.6

    View full-size slide

  35. Python 3.6
    * Format Strings
    * Large Speedups
    * Advanced class creation tools

    View full-size slide

  36. Python 3.6 Alpha 1 2016-05-17
    Fedora 25 Alpha Freeze 2016-08-09

    View full-size slide

  37. Python 3.6 Alpha 1 2016-05-17
    Fedora 25 Alpha Freeze 2016-08-09
    Python 3.6 Beta 1 2016-09-12
    Fedora 25 Beta Freeze 2016-09-20

    View full-size slide

  38. Python 3.6 Alpha 1 2016-05-17
    Fedora 25 Alpha Freeze 2016-08-09
    Python 3.6 Beta 1 2016-09-12
    Fedora 25 Beta Freeze 2016-09-20
    Python 3.6 RC 1 2016-12-05
    Fedora 25 Final Freeze 2016-10-25

    View full-size slide

  39. Python 3.6 Alpha 1 2016-05-17
    Fedora 25 Alpha Freeze 2016-08-09
    Python 3.6 Beta 1 2016-09-12
    Fedora 25 Beta Freeze 2016-09-20
    Python 3.6 RC 1 2016-12-05
    Fedora 25 Final Freeze 2016-10-25
    Python 3.6 Final 2016-12-16
    Fedora 26 Branches 2016-12-???

    View full-size slide

  40. I. Python 3
    II. Automating Packaging
    III. System Python
    IV. Python 3.6
    V. Who's “we”?

    View full-size slide

  41. python-maint @ Red Hat

    View full-size slide

  42. python-maint @ Red Hat

    View full-size slide

  43. python-maint @ Red Hat

    View full-size slide

  44. python-maint @ Red Hat

    View full-size slide

  45. python-maint @ Red Hat

    View full-size slide

  46. python-maint @ Red Hat

    View full-size slide

  47. Sorry!
    We'll do better!

    View full-size slide

  48. We're Python SIG
    python-devel
    @lists.fedoraproject.org
    #fedora-python on Freenode
    fedora-python on Github

    View full-size slide

  49. I. Python 3
    II. Automating Packaging
    III. System Python
    IV. Python 3.6
    V. Who's “we”?

    View full-size slide