W HO ? Pradyun Gedam @pradyunsg pradyunsg.me Member of Python - - PowerPoint PPT Presentation

w ho
SMART_READER_LITE
LIVE PREVIEW

W HO ? Pradyun Gedam @pradyunsg pradyunsg.me Member of Python - - PowerPoint PPT Presentation

P YTHON P ACKAGING Where we are Where were headed gg.gg/pycon-in-2019 @pradyunsg W HO ? Pradyun Gedam @pradyunsg pradyunsg.me Member of Python Packaging Authority Maintainer of pip, virtualenv, packaging and more PSF


slide-1
SLIDE 1

Where we are
 Where we’re headed

PYTHON PACKAGING

@pradyunsg gg.gg/pycon-in-2019

slide-2
SLIDE 2

WHO?

Pradyun Gedam
 @pradyunsg pradyunsg.me

Member of


Python Packaging Authority

Maintainer of


pip, virtualenv, packaging and more PSF Fellow College student!

slide-3
SLIDE 3

An Overview of

Tooling in the Python Packaging ecosystem

WHERE WE ARE

slide-4
SLIDE 4

https:/ /www.youtube.com/watch?v=AQsZsgJ30AE

NOT HOW WE GOT HERE

slide-5
SLIDE 5

WHAT’S PACKAGING?

slide-6
SLIDE 6

Package Package Thing 
 Medium for
 Moving Packages Thing

slide-7
SLIDE 7

SOFTWARE DISTRIBUTION

slide-8
SLIDE 8

Distribution Distribution Source Code "Moving" Software Working Software

slide-9
SLIDE 9

AN UNSOLVED PROBLEM

SOFTWARE DISTRIBUTION

https:/ /youtu.be/IVzjVqr_Bzs?t=430

slide-10
SLIDE 10

Distribution Distribution Source Code "Moving" Software Working Software

slide-11
SLIDE 11

Distribution Distribution Source Code "Moving" Software Working Software

Publisher User

slide-12
SLIDE 12

Source Code

Publisher

slide-13
SLIDE 13

Distribution Source Code

Publisher

"build"

slide-14
SLIDE 14

Distribution Source Code

Publisher

  • Build a Distribution from


Source Code

  • Build Environment
  • Build Mechanisms

"build"

slide-15
SLIDE 15

Distribution Source Code

Publisher

"build" "Moving" Software

slide-16
SLIDE 16

Distribution Source Code

Publisher

"build" "Moving" Software "upload"

slide-17
SLIDE 17

Distribution Source Code

Publisher

"build" "Moving" Software

  • Upload the Distribution
  • Upload Mechanisms

"upload"

slide-18
SLIDE 18

"Moving" Software

User

slide-19
SLIDE 19

"Moving" Software Distribution

User

slide-20
SLIDE 20

"Moving" Software Distribution

User

"download"

slide-21
SLIDE 21

"Moving" Software Distribution

User

"download"

  • Download the Distribution
  • Download Mechanisms
  • Choosing what to download
slide-22
SLIDE 22

"Moving" Software Distribution Working Software

User

"download"

slide-23
SLIDE 23

"Moving" Software Distribution Working Software

User

"download" "install"

slide-24
SLIDE 24

"Moving" Software Distribution Working Software

User

"download" "install"

  • Install from the Distribution
  • Install Environment
  • Install Mechanisms
slide-25
SLIDE 25

Distribution Distribution Source Code "Moving" Software Working Software "build" "install" "download" "upload"

Publisher User

slide-26
SLIDE 26

Distribution Distribution "Moving" Software "download" "upload"

Publisher User

slide-27
SLIDE 27

Distribution Distribution Source Code Working Software "build" "install"

Publisher User

slide-28
SLIDE 28

DEALING WITH ENVIRONMENTS

  • The Packaging Gradient


https:/ /sedimental.org/the_packaging_gradient.html
 https:/ /www.youtube.com/watch?v=iLVNWfPWAC8

  • Python Packaging Overview


https:/ /packaging.python.org/overview/

slide-29
SLIDE 29

Tools built by volunteers

PYPA TOOLING

slide-30
SLIDE 30

(mostly)
 
 https:/ /packaging.python.org/specifications/

Built on standards

slide-31
SLIDE 31

Distribution Distribution Python Package Index "download" "upload"

Publisher User Package Index Interfaces

slide-32
SLIDE 32

Distribution Distribution Source Code Working Software "build" "install"

Publisher User

Package Distribution Metadata

slide-33
SLIDE 33

WE WENT TOO FAR ONCE.

  • PEP 426 - Metadata 2.0
  • Was trying to solve all the problems with Python’s
  • metadata. Never became a reality.
  • Incremental Improvements
  • Our current, softer approach — workable approach

with volunteers.

slide-34
SLIDE 34

Distribution Source Code build
 backend

Publisher

  • Usually setuptools
  • PEP 517 and PEP 518
  • "modern" source distributions
  • pyproject.toml
slide-35
SLIDE 35

PyPI

Distribution twine

Publisher

slide-36
SLIDE 36

PyPI

pip

User

Distribution Working Software pip virtualenv
 venv

slide-37
SLIDE 37

It’s not that straightforward.

slide-38
SLIDE 38
slide-39
SLIDE 39

Distribution

PyPI

Working Software pip

User

Distribution Source Code setuptools twine

Publisher

pip virtualenv
 venv

slide-40
SLIDE 40

Distribution

PyPI

Working Software pipenv pip via
 pipenv

User

slide-41
SLIDE 41

Tools built by companies or different volunteers.

NON-PYPA TOOLING

slide-42
SLIDE 42

Environments are difficult.

slide-43
SLIDE 43

Distribution Source Code flit

Publisher

  • Simplifies the "build" experience
  • Metadata in pyproject.toml
slide-44
SLIDE 44

Distribution Working Software pex

User

slide-45
SLIDE 45

Distribution Working Software pipx

User

slide-46
SLIDE 46

Distribution

PyPI

Working Software poetry poetry

User

Distribution Source Code poetry poetry

Publisher

slide-47
SLIDE 47

Conda Packages Conda Packages Source Code

Conda Channels

Working Software conda conda conda conda

Publisher User

slide-48
SLIDE 48

"… all of this stuff is really hard and
 there’s a lot of knowledge scattered around in people’s heads that could really do with being captured somewhere"

— PAUL MOORE

slide-49
SLIDE 49

Future Improvements in Python Packaging

WHERE WE’RE HEADED

slide-50
SLIDE 50

I DON’T HAVE


A TIME MACHINE.

slide-51
SLIDE 51

CORE FUNCTIONALITY IMPROVEMENTS

  • ngoing
  • securing PyPI — The Update Framework (TUF)
  • newer manylinux standards — manylinux2014
  • yanking packages from PyPI
  • better licensing metadata
slide-52
SLIDE 52
  • structured lockfiles in pip
  • package preview functionality from PyPI
  • security notifications for vulnerable packages
  • pip dependency resolver

CORE FUNCTIONALITY IMPROVEMENTS

soon?

slide-53
SLIDE 53

BETTER USER EXPERIENCE

  • better defaults in pip
  • feature flags on PyPI
  • interoperability testing
  • professional UX review
slide-54
SLIDE 54

REDUCING TECHNICAL DEBT

  • virtualenv rewrite
  • making the transition from distutils -> setuptools
  • pip build logic refactor
  • pip "working schemes" cleanup
  • change the right environments
slide-55
SLIDE 55

MOAR STANDARDISATION

  • editable installations
  • better, more powerful, extras
  • less ambiguous licensing
  • interoperability with other package managers
slide-56
SLIDE 56

HOW DO WE GET THERE?

  • Volunteer!
  • Tell us how you deal with "interesting" issues.
  • Fund one of the targeted funded projects.
slide-57
SLIDE 57

Thank you! \o/