Skip to main content

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

Project description

https://travis-ci.org/cfournie/important.svg?branch=master https://coveralls.io/repos/github/cfournie/important/badge.svg?branch=master

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

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

important-0.1.2.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

important-0.1.2-py2.py3-none-any.whl (11.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file important-0.1.2.tar.gz.

File metadata

  • Download URL: important-0.1.2.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for important-0.1.2.tar.gz
Algorithm Hash digest
SHA256 18b03898cc1dc6c5554fbb6ae0fa5ff223743858dc1ed0dda20ac6b17bb04a7a
MD5 f0a10bc31c5350a38ec7bb45021edde4
BLAKE2b-256 4d5a568fc4c23c9d2b9c056a144ca211d4c7f043803a8cb1f38ca9e254cfece5

See more details on using hashes here.

File details

Details for the file important-0.1.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for important-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b3e9afabd100c61dcc46f086eb813ae5e24930d1c604f55207b07b6567c53f26
MD5 903161285b202c8c416cc58557b727c8
BLAKE2b-256 c3e274ca33361c10e54a3979b5c5c2b6af2e9b21f9f493c3863f46411c176d15

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