Skip to main content

Pip safe auto-upgrade

Project description

Pip-safe-upgrade

Pip-safe-upgrade automatically updates your pip requirements to the highest versions the tests pass.

build codecov PyPI version

Overview

This package can works only with docker-compose projects for now.

Installation

pip install safe-pip-upgrade

Work algorithm

Pip-safe-upgrade try to upgrade the packages versions in requirements file one by one, run your tests after every step and if the tests fail it returns version back. The whole workflow goes without rebuilding the docker image and hence is very fast.

Additionally pip-safe-upgrade add sensible comments to requirements file.

Here is a detailed algorithm of what safe-pip will do after launch:

  1. starts the container in daemon mode (runs docker-compose run project sleep 3590).
  2. read the next package in requirements.
  3. check comment. if the comment is '# the latest working version' go to p. 2.
  4. check comment. if the comment is '# error on the version x.x.x':
    1. check if the is version between current and x.x.x
    2. if there is update requirements file to version in the middle between the current and x.x.x and go to p. 3
    3. if there is not, add comment '# the latest working version' and go to p. 2
  5. check if there is newer version
    1. if there is not go to p. 2
    2. if there is, update requirements file to the newest version
  6. starts the tests
  7. if tests fail set version back, add comment '# error on the version x.x.x' and go to p. 4.
  8. otherwise, go to p. 2

Usage

Using safe-pip-upgrade is basically a two-step process.

  1. Define your app's parameters with a pip_upgrade.ini
  2. Run pip-upgrade.py UPGRADE to start the upgrade of your requirements

A pip_upgrade.ini looks like this:

[MAIN]
working_directory = ./  # change it if you want to start upgrade from other directory.
local_requirements_file = requirements.txt # path and name of the requirements file relative to the working directory
ignore_line_starts = ['#', '-r', 'https://', 'http://', 'git+'] # list of the line beginnings you want to ignore 

[COMPOSE RUNNER]
compose_project_folder = . # path to your docker-compose file
compose_requirements_file = requirements.txt # path and name of the requirements file in docker container relative to CWD in your Dockerfile 
compose_service_name = django # name of the docker-compose service
compose_work_dir = # set it if you want to change working directory in container 

You can run pip_upgrade.py CREATE-INI so that pip-upgrade automatically creates an ini-file for you

All ini-files option can also be defined with command keys. Type pip_upgrade.py to see a detailed description.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

safe-pip-upgrade-0.0.5.tar.gz (10.4 kB view hashes)

Uploaded Source

Built Distribution

safe_pip_upgrade-0.0.5-py3-none-any.whl (11.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page