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 developers fix their circular dependencies problems. ImportError: Cannot import name X is a python exception that is related to the circular imports, but it’s not clear from the start. This tool automatically analyzes the imports of your projects, and looks for imports that may cause a circular dependency problem.

https://i.imgur.com/QVgTJ8h.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.
  --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.3.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

pycycle-0.0.3-py2-none-any.whl (7.6 kB view details)

Uploaded Python 2

File details

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

File metadata

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

File hashes

Hashes for pycycle-0.0.3.tar.gz
Algorithm Hash digest
SHA256 19d369f435c355e358ad1ed52a7cbe49aa476df9ac07e17af12bfa139c0ccd77
MD5 608969d05ac4ce3c38351f33ca5c705c
BLAKE2b-256 d8c29ae25b5a65952a656b44659f39af99788a3d404a8606e6ecdc910b7ac0d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycycle-0.0.3-py2-none-any.whl
Algorithm Hash digest
SHA256 9a7dc1773f0c1e63744f3c90975deae69b8627a8cb7aa409ff7345ea79529e6c
MD5 b253556f3ffb647ca2bdc8cdbc7d14e9
BLAKE2b-256 8feec5092b13bcdd9a7f84b271ede60e0372b3a49ea196b9546e647dec5929f1

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