Git Product home page Git Product logo

requirementz's Introduction

Requirementz

  • Checks requirements.txt against installed packages, or latest versions available on PyPi.

  • Shows latest package information from PyPi (for requirements.txt or any package).

  • Searches requirements.txt for text/regex patterns.

  • Sorts requirements.txt lines in place.

  • Finds duplicate entries in requirements.txt.

Installation

This tool is installable with pip:

pip install requirementz

The command is called requirementz.

Dependencies

Requirementz has several python dependencies, all installable with pip. A requirements.txt is provided, for easy installation.

If you've cloned the repo, you can run pip install -r requirements.txt to install all of them. Otherwise, pip install requirementz should install all dependencies for you.

Usage

Usage:
    requirementz (-h | -v) [-D] [-n]
    requirementz [-c | -C] [-e] [-L | -r] [-f file] [-D] [-n]
    requirementz [-a line... | -d]        [-f file] [-D] [-n]
    requirementz -l [-L | -r]             [-f file] [-D] [-n]
    requirementz (-P | -S)                [-f file] [-D] [-n]
    requirementz -p [-L]                            [-D] [-n]
    requirementz -s pat [-i]              [-f file] [-D] [-n]
    requirementz PACKAGE...                         [-D] [-n]

Options:
    PACKAGE              : Show pypi info for package names.
    -a line,--add line   : Add a requirement line to the file.
                           The -a flag can be used multiple times.
    -C,--checklatest     : Check installed packages and latest versions
                           from PyPi against requirements.
    -c,--check           : Check installed packages against requirements.
    -D,--debug           : Print some debug info while running.
    -d,--duplicates      : List any duplicate entries.
    -e,--errors          : Only show packages with errors when checking.
    -f file,--file file  : Requirements file to parse.
                           Default: ./requirements.txt
    -h,--help            : Show this help message.
    -i,--ignorecase      : Case insensitive when searching.
    -L,--location        : When listing, sort by location instead of name.
                           When checking, show the package location.
    -l,--list            : List all requirements.
    -n,--nocolor         : Force plain text, with no color codes.
    -P,--pypi            : Show pypi info for all packages in
                           requirements.txt.
    -p,--packages        : List all installed packages.
    -r,--requirement     : Print name and version requirement only for -c.
                           Useful for use with -e, to get a list of
                           packages to install or upgrade.
    -S,--sort            : Sort the requirements file by package name.
    -s pat,--search pat  : Search requirements for text/regex pattern.
    -v,--version         : Show version.

Examples

Check (installed packages)

Check requirements.txt against installed package versions.

requirementz

Here you can see that the colr >= 0.7.6 requirement was not satisfied, because 0.7.5 is installed:

Output

Show package location while checking:

requirementz -L

Output

Check (latest pypi version)

Check requirements.txt against installed package versions, and the latest pypi version.

requirementz -C

Output

Show package location while checking:

requirementz -C -L

Output

Show pypi info for packages.

-P will show pypi information for all packages in requirements.txt:

requirementz -P

Output

You can do this for any package, whether it's installed or not:

requirementz antigravity

Output

You can use more than one package name.

Find duplicate requirements

Any duplicate entries will be listed by name, with a count of duplicates.

requirementz -d

Notes

This hasn't been tested very well with CVS or local requirements. Any help in that area would be appreciated, as I haven't had to use those requirement types.

Contributions

File an issue or create a pull request. Contributions are welcome.

https://github.com/welbornprod/requirementz

requirementz's People

Contributors

cjwelborn avatar jayvdb avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

requirementz's Issues

Consolidation of similar tools

Since you are actively maintaining this tool, maybe you are interested in subsuming the use-cases of many other less maintained tools which I have found.

You can find my 'list' at

https://build.opensuse.org/project/show/home:jayvdb:py-new

and filter for 'pip'.

Not all of them are building, often they have no tests, so are probably failing.

Or list only green builds and find 'pip' in the page.

Many seem to have been built without intention that other people might also use them, and often they are bitrotting because of the constant pip breakages.

I have raised issues about some

(and lots more, but those are a decent sample)

Suggestion: Allow empty requirements.txt file

Currently running on an empty file result in the following error: "Requirements file is empty." and and exitcode 1.

According to this: pypa/pip#343 pip now allows for empty requirements files, so would be logical that the same behaivor is adopted here.

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.