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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file safe-pip-upgrade-0.0.5.tar.gz.

File metadata

  • Download URL: safe-pip-upgrade-0.0.5.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for safe-pip-upgrade-0.0.5.tar.gz
Algorithm Hash digest
SHA256 50a525e3adcd62061dce3debf5ff19f6e049e4540ddc3099b882fb47638c07d1
MD5 a641d82d61fe5119cbb76558528267ba
BLAKE2b-256 41a9e43e6eee57d6f667b045cb317b817bdcb63bdb2094cece52569998f59104

See more details on using hashes here.

File details

Details for the file safe_pip_upgrade-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: safe_pip_upgrade-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for safe_pip_upgrade-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f6d8452a0d0330e0b774ed7b52f1c1e98813a59446a2f2becab006358746b7b0
MD5 9e89c42f8d4a83aff5467322820637c4
BLAKE2b-256 ae2f60fd4dc8dbe95b1128888d9397981b90caa241f5ba3da50756b5960985ac

See more details on using hashes here.

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