Giter VIP home page Giter VIP logo

pruner's Introduction

Pruner

PyPI version Build Status codecov Code Triagers Badge

Pruner is your best friend when it comes to pruning your Python requirements file. Pruner will run over your requirements and test each one against your test command. If your projects test command fails then we know the package needs to remain in the requirements otherwise we prune it.

Requires Python 3.3+

Installation

pip install pruner

Usage

usage: pruner.py [-h] [--nocolor] [--with_exit_code]
                 requirements_file output_file
                 [test_command [test_command ...]]

A CLI tool to help prune your overgrown requirements file

positional arguments:
  requirements_file  requirements file you want to prune
  output_file        file to store the required requirements
  test_command       command to run to test the project still works

optional arguments:
  -h, --help         show this help message and exit
  --nocolor          turns off colored output
  --with_exit_code   forces exit code to 1 if requirements needed pruning

Example

> pruner requirements.txt pruned_requirements.txt python myproj.py

PRUNER: virtualenv prunertests
PRUNER: source prunertests/bin/activate
PRUNER: pip install -r requirements.txt
PRUNER: Running initial test...
PRUNER: Initial test was a success, beginning requirement tests...
PRUNER: Testing django
PRUNER: django was needed
PRUNER: Testing garbagepackage1
PRUNER: garbagepackage1 was not needed
PRUNER: Testing rancat
PRUNER: rancat was needed
PRUNER: Testing garbagepackage2
PRUNER: garbagepackage2 was not needed
PRUNER: Testing garbagepackage3
PRUNER: garbagepackage3 was not needed
PRUNER: deactivate
PRUNER: rm -rf prunertests
PRUNER: Writing results to pruned_requirements.txt
PRUNER: DONE

> cat requirements.txt
garbagepackage1
rancat
django
garbagepackage1
garbagepackage2

> cat pruned_requirements.txt
django
rancat

> cat myproj.py
import argparse
import sys
import django
import rancat

Contributing

Submitting an issue or feature request

If you find an issue or have a feature request please open an issue at Github Pruner Repo.

pruner's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pruner's Issues

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.