5

Documentation on pyreverse is sparse and half of the pages that google presented me, redirect to some exotic pages that will require some explaining should your boss find them in your browser history.
Due to the way how pyreverse seems to work, you have to use it from inside your root project/django app directory (running it when in, say, MyApp/docs/ may not find every ancestor of a class your interested in). Meaning the generated diagrams will 'clog' up your project folder unless you manually move them elsewhere.

Is there a way to designate an output folder for pyreverse?

MatthewMartin
  • 32,326
  • 33
  • 105
  • 164
CoffeeBasedLifeform
  • 2,296
  • 12
  • 27

3 Answers3

1

This is now possible since pylint-2.7.3 with the output-directory option.

For example:

pyreverse -ASmy a.py --output-directory <path to directory>

Alternatively:

pyreverse -ASmy a.py -d <path to directory>

Please see pyreverse --help for this information.

Mark Byrne
  • 85
  • 1
  • 5
0

Well man, the only way I found is scripting...

mkdir -p docs/uml
pyreverse -ASmy -o png -p myproj .
mv *.png docs/uml

Maybe you can write your own setup.py script. In the old way of make.

./my_setups.py docs

0

When you run it via a Python subprocess call you can specify a working directory:

import subprocess

# Possibly put this into a loop to analyse all your files
subprocess.run("pyreverse -AS -o png " + filePath + " -p " + fileName, shell=True, cwd="path/to/output/directory")

Note that you may have to correct your filePaths (by prepending ../s to it) if it is relative.

holzkohlengrill
  • 1,044
  • 19
  • 29