Skip to content

Commit

Permalink
Document new cycle code.
Browse files Browse the repository at this point in the history
  • Loading branch information
theotherbjorn committed Jan 1, 2025
1 parent 997978e commit 2ef1a2e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 36 deletions.
24 changes: 12 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Usage
[--find-package] [-v] [-o file] [-T FORMAT] [--display PROGRAM]
[--noshow] [--show-deps] [--show-raw-deps] [--deps-output DEPS_OUT]
[--show-dot] [--dot-output DOT_OUT] [--nodot] [--no-output]
[--show-cycles] [--debug-mf INT] [--noise-level INT]
[--debug-mf INT] [--noise-level INT]
[--max-bacon INT] [--max-module-depth INT] [--pylib] [--pylib-all]
[--include-missing] [-x PATTERN [PATTERN ...]]
[-xx MODULE [MODULE ...]] [--only MODULE_PATH [MODULE_PATH ...]]
Expand Down Expand Up @@ -80,7 +80,7 @@ Usage
--dot-output write dot code to file (instead of screen)
--nodot, --no-dot skip dot conversion
--no-output don't create .svg/.png file, implies --no-show (-t/-o will be ignored)
--show-cycles show only import cycles
--show-cycles [deprecated] show only import cycles
--debug-mf INT set the ModuleFinder.debug flag to this value
--noise-level INT exclude sources or sinks with degree greater than noise-level
--max-bacon INT exclude nodes that are more than n hops away (default=2, 0 -> infinite)
Expand All @@ -105,6 +105,9 @@ Usage
before ``fname``, separate the arguments from the filename with ``--`` otherwise ``fname``
will be parsed as an argument of the option. Example: ``$ pydeps -x os sys -- pydeps``.

**Note:** the ``--show-cycles`` option is deprecated and will be removed in a future release,
cycles are now always shown.

You can of course also import ``pydeps`` from Python and use it as a library, look in
``tests/test_relative_imports.py`` for examples.

Expand Down Expand Up @@ -198,20 +201,16 @@ filter:
Import cycles
-------------

``pydeps`` can detect and display cycles with the ``--show-cycles``
parameter. This will *only* display the cycles, and for big libraries
it is not a particularly fast operation. Given a folder with the
``pydeps`` detects and displays cycles. Given a folder with the
following contents (this uses yaml to define a directory structure,
like in the tests)::

relimp:
- __init__.py
- a.py: |
from . import b
- b.py: |
from . import a
cycles:
__init__.py: ''
a.py: from . import b
b.py: from . import a

``pydeps relimp --show-cycles`` displays:
``pydeps cycles`` displays:

.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-cycle.svg?sanitize=true

Expand Down Expand Up @@ -346,6 +345,7 @@ eg. the output from ``pydeps --show-deps ..`` looks like this::

Version history
---------------
**Version 3.0.0** Python 3.10+ only. Cycles are now always shown.

**Version 2.0.0** Python 3.8+ only. Thanks to timhoffm_ for the PR.

Expand Down
49 changes: 25 additions & 24 deletions docs/_static/pydeps-cycle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2ef1a2e

Please sign in to comment.