Giter Club home page Giter Club logo

upgrade-requirements.py's Introduction

upgrade-requirements.py

Current version on PyPI

Upgrade all your outdated requirements.txt in a single command.

Motivation

Even though pip list --outdated exists, sometimes you just want to run pip install --upgrade to upgrade a package, then persist it to your requirements.txt in one big sweep.

Installation

$ pip install upgrade-requirements

Usage

$ upgrade-requirements

(Or use the shortcut command upreq.)

Now's a good time to grab a โ˜• while it runs.

After it finishes, run your tests to make sure an individual upgrade didn't break anything. Then move on to bigger things ๐Ÿš€

Found a problem with an upgraded version?

No worries!

  1. Revert individual entries in requirements.txt with the help of git
  2. Run pip install -r requirements.txt to downgrade to working versions
  3. Commit the upgraded-and-tweaked requirements.txt like normal and carry on ๐ŸŽ‰

More usages

$ upgrade-requirements -h
usage: upgrade-requirements [-h] [-r REQUIREMENTS]

optional arguments:
  -h, --help            show this help message and exit
  -r REQUIREMENTS, --requirements REQUIREMENTS
                        specify the location of the requirements.txt file

Room for improvement

  • This only work with pinned (==) packages at the moment. The intention is to get it to work more generally. This can be broken down into three sub-tasks:

    • Get it to ignore non-pinned requirements instead of fail
    • Get it to work with other specifiers, e.g. >= (how would this work?)
    • Handle all types of requirement entries

Feel free to open an issue or PR with ideas.

upgrade-requirements.py's People

Contributors

emilecaron avatar jamesbroadhead avatar joeyespo avatar ldsink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

upgrade-requirements.py's Issues

Multiline requirements are not parsed correctly

The following requirements.txt triggers an error in upgrade-requirements:

setuptools\
    >=40.3.0,\
    !=50.0.0,==49.6.0

However, this is a valid requirements file. The parser needs to be updated accordingly.

Add a '--pretend' flag

This should print the new requirements.txt, but not write it.
Ideally, it will set sys.exit to 1 if it would have created a diff and 0 if no changes are needed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.