Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

excludes in .pydeps ignored! #20

Closed
eqvis opened this issue Feb 7, 2019 · 5 comments
Closed

excludes in .pydeps ignored! #20

eqvis opened this issue Feb 7, 2019 · 5 comments

Comments

@eqvis
Copy link

eqvis commented Feb 7, 2019

Hi,

after some tries I get something now, but I tried to configure excludes (pywin...) into my config-file...
I looked into the code and in the docs for argparser:

Note that parser-level defaults always override argument-level defaults

The same ocurrs for the other defaults! Perhaps you want to remove all the default=... in add_argument() and add your defaults into defaults before:

C:\temp>diff -u c:\Python27\Lib\site-packages\pydeps\cli.py c:\Python27\Lib\site-packages\pydeps\cli.ORG.py
--- c:\Python27\Lib\site-packages\pydeps\cli.py Thu Feb 07 13:18:36 2019
+++ c:\Python27\Lib\site-packages\pydeps\cli.ORG.py     Thu Feb 07 12:02:52 2019
@@ -75,11 +75,9 @@
     defaults = dict(
         T='svg',
         noise_level=200,
-        max_bacon=2,
+        max_bacon=200,
         exclude=[],
         display=None,
-        verbose=0,
-        debug_mf=0,
     )

     if not _args.no_config:
@@ -109,7 +107,7 @@
     # -vv   decision data (computed/converted/replaced values)
     # -vvv  status data (program state at fixed intervals, ie. not in loops)
     # -vvvv execution trace
-    p.add_argument('-v', '--verbose', action='count', help="be more verbose (-vv, -vvv for more verbosity)")
+    p.add_argument('-v', '--verbose', action='count', help="be more verbose (-vv, -vvv for more verbosity)", default=0)
     p.add_argument('-o', dest='output', metavar="file", help="write output to 'file'")
     p.add_argument('-T', dest='format', help="output format (svg|png)")
     p.add_argument('--display', help="program to use to display the graph (png or svg file depending on the T parameter)", metavar="PROGRAM")
@@ -121,13 +119,13 @@
     p.add_argument('--nodot', action='store_true', help="skip dot conversion")
     p.add_argument('--show-cycles', action='store_true', help="show only import cycles")
     p.add_argument('--debug', action='store_true', help="turn on all the show and verbose options")
-    p.add_argument('--debug-mf', type=int, metavar="INT", help="set the ModuleFinder.debug flag to this value")
+    p.add_argument('--debug-mf', default=0, type=int, metavar="INT", help="set the ModuleFinder.debug flag to this value")
     p.add_argument('--noise-level', type=int, metavar="INT", help="exclude sources or sinks with degree greater than noise-level")
-    p.add_argument('--max-bacon', type=int, metavar="INT", help="exclude nodes that are more than n hops away (default=2, 0 -> infinite)")
+    p.add_argument('--max-bacon', type=int, default=2, metavar="INT", help="exclude nodes that are more than n hops away (default=2, 0 -> infinite)")
     p.add_argument('--pylib', action='store_true', help="include python std lib modules")
     p.add_argument('--pylib-all', action='store_true', help="include python all std lib modules (incl. C modules)")
     p.add_argument('--include-missing', action='store_true', help="include modules that are not installed (or can't be found on sys.path)")
-    p.add_argument('-x', '--exclude', nargs="+", metavar="FNAME", help="input files to skip")
+    p.add_argument('-x', '--exclude', nargs="+", default=[], metavar="FNAME", help="input files to skip")
     p.add_argument('--externals', action='store_true', help='create list of direct external dependencies')
     p.add_argument('--reverse', action='store_true', help="draw arrows to (instead of from) imported modules")
@eqvis
Copy link
Author

eqvis commented Feb 7, 2019

Could you please add a simple configuration file too!? People without ConfigParser-knowledge would have difficulties!

[pydeps]
# See pydeps --help

# Console output
log=NOTSET
verbose=0
debug=0
debug-mf=0

# Graph output
format=svg
display=C:\Program Files (x86)\Inkscape\inkview.exe
output=C:\Users\my_name\tmp\pydeps-ouput.svg
noshow=1
show_deps=0
show__raw_deps=0
show_dot=0
nodot=0
show_cycles=0

# What and how to show
max_bacon=3
noise_level=200
exclude=pywin* win32* pythoncom winerror ntsecuritycon
externals=1
include_missing=0
pylib=0
pylib_all=0
reverse=0

@thebjorn
Copy link
Owner

thebjorn commented Feb 8, 2019

Hi @eqvis and thank you for the problem report and for taking the time to look for a solution!

Your first issue sounds like a bug -- do you want to create a PR for it?

Your second issue seems like a feature request, and perhaps not directly related to the first bug? We can split the issues if they're not absolutely related so each issue is focused on describing the bug/feature in question, i.e. what you did, what happened, what should have happened.

For the second issue I'll need more information (are you thinking of something that creates a .pydeps file with the default options?)

@thebjorn
Copy link
Owner

thebjorn commented Feb 8, 2019

I'm working on a fix for the .pydeps vs defaults issue right now (it's a bit more complicated than your diff..)

@thebjorn
Copy link
Owner

I've released a fix for the .pydeps excludes issue in v1.7.1, now available on PyPI.

@thebjorn
Copy link
Owner

I've split your second issue into #23 so I can close this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants