Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

Utility to find unused packages in requirements and to constrain package usage

Project Description

Important

A simple source code import checker that checks your project for whether you:

  • Import and use everything in your requirements.txt file; and/or
  • Import packages with specified frequencies using a constraint file (use to wean a project off of a dependency).

Installation

Install the latest stable version from PyPI using:

pip install important

Otherwise, to grab the latest version on master, use:

pip install git+https://github.com/cfournie/important.git

Requirements

This works best when run from a virtualenv where your project’s requirements are installed (to translate requirements to module names).

This tool requires that it be installed with the same Python version as the source code that it’s analyzing and that the source code is syntactically correct.

Usage

Check for unused requirements using:

$ important -v --requirements requirements.txt .
Parsed 52 imports in 8 files
Error: Unused requirements or violated constraints found
caniusepython3 (unused requirement)

Check for imports that are used too frequently (to prevent further usage of a requirement while you phase it out) using:

$ important -v --constraints constraints.txt .
Parsed 52 imports in 8 files
Error: Unused requirements or violated constraints found
click<=1 (constraint violated by click==2)

Check for unused requirements but exclude test files using:

$ important -v --requirements requirements.txt --exclude **/test_*.py .
Parsed 52 imports in 8 files
Error: Unused requirements or violated constraints found
caniusepython3 (unused requirement)

Ignore errors related to some of your requirements using:

$ important -v --requirements requirements.txt --ignore caniusepython3 .
Parsed 52 imports in 8 files
$ important -v --requirements requirements.txt --ignorefile ignored.txt .
Parsed 52 imports in 8 files

Alternatively, you can configure important using a setup.cfg file in the current working directory, e.g.:

[important]
requirements=
    requirements.txt
constraints=
    constraints.txt
ignore=
    Sphinx
    flake8
exclude=
    .git
sourcecode=.

Then run using:

$ important -v
Parsed 52 imports in 8 files
Release History

Release History

This version
History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

History Node

0.1.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
important-0.1.3.tar.gz (7.3 kB) Copy SHA256 Checksum SHA256 Source Feb 6, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting