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

make + pip + pip-tools

make + pip + pip-tools

Slides da lighting apresentada no meetup Python Floripa na Hostgator

Caio Carrara

August 03, 2019
Tweet

More Decks by Caio Carrara

Other Decks in Programming

Transcript

  1. 1 / 20
    make + pip + pip-tools
    caiocarrara.com.br

    View full-size slide

  2. 2 / 20
    make + pip + pip-tools

    Necessidade:
    – Gerenciar dependências Python

    Contexto:
    – Aplicações server side

    View full-size slide

  3. 3 / 20
    make + pip + pip-tools
    Necessidade:
    Gerenciar dependências Python
    Contexto:
    Aplicações server side ONLY

    View full-size slide

  4. 6 / 20
    make + pip + pip-tools

    Princípios:
    – Do one thing and do it well – DOTADIW
    (Unix)
    – Se apoiar no ombro de gigantes
    – Não perder ou complicar o controle das
    coisas
    – Manter as coisas o mais simples possível

    View full-size slide

  5. 7 / 20
    make + pip + pip-tools

    O que eu quero:
    – Especificar e rastrear as dependências do
    meu projeto
    – (Re)Instalar as dependências

    View full-size slide

  6. 8 / 20
    make + pip + pip-tools

    O que eu não quero:
    – Rodar scripts/programas Python
    – Criar pacotes Python para distribuir
    – Criar/editar/mexer no virtual environment

    View full-size slide

  7. 9 / 20
    make + pip + pip-tools

    View full-size slide

  8. 10 / 20
    make + pip + pip-tools

    make
    – Executar as ações/tarefas

    pip
    – Instalar os pacotes Python

    pip-tools
    – Ajudante para lock and sync

    View full-size slide

  9. 11 / 20
    pip
    pip install [package]
    pip install django
    pip install requests
    pip install pytest

    View full-size slide

  10. 13 / 20
    pip
    pip freeze > requirements.txt
    celery==4.3.0
    Click==7.0
    Django==2.2.4
    requests==2.22.0

    View full-size slide

  11. 14 / 20
    pip-tools
    requirements.in
    flask

    View full-size slide

  12. 15 / 20
    pip-tools

    View full-size slide

  13. 16 / 20
    make

    Makefile

    View full-size slide

  14. 17 / 20
    make

    Makefile

    View full-size slide

  15. 18 / 20
    make

    Commands:
    make test
    make run
    make shell
    make test-coverage

    View full-size slide

  16. 19 / 20
    make + pip + pip-tools

    View full-size slide

  17. 20 / 20
    Obrigado

    Make
    – https://www.gnu.org/software/make/

    Pip
    – https://pip.pypa.io/en/stable/

    Pip-Tools
    – https://github.com/jazzband/pip-tools
    caiocarrara.com.br
    speakerdeck.com/cacarrara

    View full-size slide