Skip to main content

Find and repair your import cycles in any project

Project description

https://img.shields.io/pypi/v/pycycle.svg https://img.shields.io/pypi/l/pycycle.svg https://img.shields.io/pypi/wheel/pycycle.svg https://img.shields.io/pypi/pyversions/pipenv.svg https://api.travis-ci.org/bndr/pycycle.svg?branch=master

Pycycle is an experimental project that aims to help python developers fix their circular dependencies problems.

ImportError: Cannot import name X is a python exception that is related to the circular imports, but the exception tells nothing about where or what.

This tool automatically analyzes the imports of your projects, and looks for imports that may cause a circular dependency problem.

https://i.imgur.com/8JeLQxu.gif

Features

  • Shows you the whole chain of the circular imports.

  • Gives you lines of code where each import is, for you to easily find and fix the problem.

  • Visualizes your imports in a graph (Not Yet Implemented)

Usage

$ pycycle
Usage: pycycle [OPTIONS] COMMAND [ARGS]...


Examples:
    Get the circular imports in current project:
    $ pycycle --here
    Look for circular imports in another project
    $ pycycle --source /home/user/workspace/awesome_project
    Ignore specific directories when looking for circular import
    $ pycycle --source /home/user/workspace/awesome_project --ignore some_dir,some_dir2
    Get verbose output
    $ pycycle --source /home/user/workspace/awesome_project --verbose

Options:
  --verbose        Verbose output.
  --here           Try to find cycles in the current project.
  --source TEXT    Try to find cycles in the path provided.
  --ignore TEXT    Comma separated directories that will be ignored during
                   analysis.
  --encoding TEXT  Change enconding with which the project is read.
  --help           Show this message then exit.
  --version        Show the version and exit.
$ pycycle --here
Project successfully transformed to AST, checking imports for cycles..
Cycle Found :(
a_module.a_file: Line 1 -> a_module.b_module.b_file: Line 1 -> c_module.c_file: Line 1 -> d_module.d_file: Line 1 =>> a_module.a_file
Finished.
$ pycycle --source /Users/vkravcenko/workspace/awesome_project
Target source provided:/Users/vkravcenko/workspace/awesome_project
Project successfully transformed to AST, checking imports for cycles..
No worries, no cycles here!
If you think some cycle was missed, please open an Issue on Github.
Finished.

Installation

$ pip install pycycle

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

pycycle-0.0.8.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

pycycle-0.0.8-py2-none-any.whl (8.7 kB view details)

Uploaded Python 2

File details

Details for the file pycycle-0.0.8.tar.gz.

File metadata

  • Download URL: pycycle-0.0.8.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pycycle-0.0.8.tar.gz
Algorithm Hash digest
SHA256 fdcde6eef1fded7113f211255971dcc93a740cc6fa57a24ab7c9c3c681bf4351
MD5 48c1f4b1429f806a7bf039ccdb4eff23
BLAKE2b-256 99c90a6e09b0d7d0fbc339191b3b37bfab92be84513700418c61a2adbfd3ae2d

See more details on using hashes here.

File details

Details for the file pycycle-0.0.8-py2-none-any.whl.

File metadata

File hashes

Hashes for pycycle-0.0.8-py2-none-any.whl
Algorithm Hash digest
SHA256 37af51d31861449ad05db4d0f79de26e9fdf2519aca8866b57d03af3a8fccf36
MD5 d3f1da622db635924fd35fa4953f1f99
BLAKE2b-256 27f92dbaf7797277db3901086babde14d7a9673ed6b1925193ce4d2a15699ff8

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