Python Packaging and Distribution

Python Packaging and Distribution

Grand Rapids Python Users Group presentation on Poetry and pipx.

https://github.com/GRPUG/grpug-poetry-demo

Eff2cdaa8474520ed29ebc38031fab87?s=128

Jace Browning

November 18, 2019
Tweet

Transcript

  1. Poetry

  2. virtualenv + pip + pip-tools + twine

  3. PEP 518 • • [build-system] requires = ["setuptools", "wheel"]

  4. Poetry is a... • • • [build-system] requires = ["poetry>=0.12"]

    build-backend = "poetry.masonry.api"
  5. Poetry does not... • • •

  6. Why not... • • •

  7. Version Specification

  8. =1.2.3

  9. ~1.2.3

  10. ^1.2.3

  11. *

  12. { git = “https://github.com/owner/repo”, rev = “3846693f2daea2a9f156aba10512161d3a7ed5f6” }

  13. { git = “https://github.com/owner/repo”, rev = “v1.0” }

  14. { git = “https://github.com/owner/repo”, rev = “develop” }

  15. { path = “../my/local/package” }

  16. Generic Commands

  17. $ poetry new <project>

  18. $ poetry init

  19. $ poetry add <dep>

  20. $ poetry add --dev <dep>

  21. $ poetry lock

  22. $ poetry show --tree

  23. $ poetry run <command>

  24. Packaging Commands

  25. $ poetry build

  26. $ poetry publish

  27. $ poetry config http-basic.pypi <username> <password>

  28. https://pypi.org/manage/account/token/

  29. None
  30. $ poetry config pypi-token.pypi <token>

  31. pipx

  32. pip + virtualenv

  33. Why not... • • •

  34. Installation Commands

  35. $ pipx install <package>

  36. $ pipx upgrade <package>

  37. Demo