Choosing the Right Tools


pipenv and poetry

  • pip and virtualenv are standard tools
  • but situation is changing
  • many different tools and projects
  • overview of current situation
  • future is uncertain

Python Packaging Authority (pypa)

  • working group that maintains many of the relevant projects in Python packaging

Installation

  • pip
    • formats of packages
      • wheels
      • eggs
  • easy_install
    • don't use

Development

  • dependency management
    • requirements.txt
  • project isolation
    • virtualenv
    • venv
  • new projects
    • pipenv
    • poetry
  • NOTE: as of May, 2022: neither pipenv or poetry are standard tools for Python community

Anaconda

  • https://www.anaconda.com/
  • have their own Python distribution
  • have their own package management
  • have their own distribution system
  • have tool called conda
    • does everything pip and virtualenv do
    • installer
    • virtual environment tool
    • and much more
    • can install non-Python packages too
  • mostly aimed at Data Science community
  • NOTE: as of May, 2022: Anaconda isn't really part of standard Python ecosystem

Requirements

  • requirements.txt
    • standard (pip)
    • non-deterministic dependency resolution
  • Pipfile
    • pipenv
    • custom format
    • deterministic dependency resolution
  • pyproject.toml
    • poetry
    • standard (PEP-518)
    • deterministic dependency resolution

pipenv

🚧 TODO 🚧

poetry

Useful and Common Commands

# Create new project
$ poetry new <project_name>

# Add package to project
$ cd ~/path/to/project
$ poetry add <package_name>

# Run script
$ poetry run python ~/path/to/project/some_script.py

# Start shell
$ poetry shell
$ . $HOME/.cache/pypoetry/virtualenvs/<project_name>-<some_hash>-py<version>/bin/activate
Made with Gatsby G Logo