mvn-tree-visualizer 1.6.0__py3-none-any.whl → 1.7.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mvn-tree-visualizer might be problematic. Click here for more details.

@@ -1,5 +1,8 @@
1
1
  import argparse
2
+ import sys
2
3
  import time
4
+ import traceback
5
+ from importlib import metadata
3
6
  from pathlib import Path
4
7
  from typing import NoReturn
5
8
 
@@ -12,6 +15,14 @@ from .outputs.json_output import create_json_output
12
15
  from .validation import find_dependency_files, validate_dependency_files, validate_output_directory
13
16
 
14
17
 
18
+ def get_version() -> str:
19
+ """Get the current version of the package."""
20
+ try:
21
+ return metadata.version("mvn-tree-visualizer")
22
+ except metadata.PackageNotFoundError:
23
+ return "unknown"
24
+
25
+
15
26
  def generate_diagram(
16
27
  directory: str,
17
28
  output_file: str,
@@ -20,6 +31,7 @@ def generate_diagram(
20
31
  output_format: str,
21
32
  show_versions: bool,
22
33
  theme: str = "minimal",
34
+ quiet: bool = False,
23
35
  ) -> None:
24
36
  """Generate the dependency diagram with comprehensive error handling."""
25
37
  timestamp = time.strftime("%H:%M:%S")
@@ -31,7 +43,7 @@ def generate_diagram(
31
43
 
32
44
  # Show what files we found
33
45
  dependency_files = find_dependency_files(directory, filename)
34
- if len(dependency_files) > 1:
46
+ if len(dependency_files) > 1 and not quiet:
35
47
  print(f"[{timestamp}] Found {len(dependency_files)} dependency files")
36
48
 
37
49
  # Setup paths
@@ -103,24 +115,27 @@ def generate_diagram(
103
115
  except Exception as e:
104
116
  raise OutputGenerationError(f"Error generating {output_format.upper()} output: {e}")
105
117
 
106
- print(f"[{timestamp}] Diagram generated and saved to {output_file}")
118
+ if not quiet:
119
+ print(f"[{timestamp}] SUCCESS: Diagram generated and saved to {output_file}")
107
120
 
108
121
  except MvnTreeVisualizerError as e:
109
122
  # Our custom errors already have helpful messages
110
- print(f"[{timestamp}] ❌ Error: {e}")
123
+ print(f"[{timestamp}] ERROR: {e}", file=sys.stderr)
124
+ raise # Re-raise the exception for the caller to handle
111
125
  except KeyboardInterrupt:
112
- print(f"\n[{timestamp}] ⏹️ Operation cancelled by user")
126
+ print(f"\n[{timestamp}] Operation cancelled by user", file=sys.stderr)
127
+ raise # Re-raise for the caller to handle
113
128
  except Exception as e:
114
129
  # Unexpected errors
115
- print(f"[{timestamp}] Unexpected error: {e}")
116
- print("This is an internal error. Please report this issue with the following details:")
117
- print(f" - Directory: {directory}")
118
- print(f" - Filename: {filename}")
119
- print(f" - Output: {output_file}")
120
- print(f" - Format: {output_format}")
121
- import traceback
130
+ print(f"[{timestamp}] UNEXPECTED ERROR: {e}", file=sys.stderr)
131
+ print("This is an internal error. Please report this issue with the following details:", file=sys.stderr)
132
+ print(f" - Directory: {directory}", file=sys.stderr)
133
+ print(f" - Filename: {filename}", file=sys.stderr)
134
+ print(f" - Output: {output_file}", file=sys.stderr)
135
+ print(f" - Format: {output_format}", file=sys.stderr)
122
136
 
123
137
  traceback.print_exc()
138
+ raise # Re-raise for the caller to handle
124
139
 
125
140
 
126
141
  def cli() -> NoReturn:
@@ -128,6 +143,14 @@ def cli() -> NoReturn:
128
143
  prog="mvn-tree-visualizer",
129
144
  description="Generate a dependency diagram from a file.",
130
145
  )
146
+
147
+ parser.add_argument(
148
+ "-v",
149
+ "--version",
150
+ action="version",
151
+ version=f"mvn-tree-visualizer {get_version()}",
152
+ )
153
+
131
154
  parser.add_argument(
132
155
  "directory",
133
156
  type=str,
@@ -186,6 +209,13 @@ def cli() -> NoReturn:
186
209
  help="Theme for the diagram visualization. Default is 'minimal'.",
187
210
  )
188
211
 
212
+ parser.add_argument(
213
+ "-q",
214
+ "--quiet",
215
+ action="store_true",
216
+ help="Suppress all console output except errors. Perfect for CI/CD pipelines and scripted usage.",
217
+ )
218
+
189
219
  args = parser.parse_args()
190
220
  directory: str = args.directory
191
221
  output_file: str = args.output
@@ -195,20 +225,37 @@ def cli() -> NoReturn:
195
225
  show_versions: bool = args.show_versions
196
226
  watch_mode: bool = args.watch
197
227
  theme: str = args.theme
228
+ quiet: bool = args.quiet
198
229
 
199
230
  # Generate initial diagram
200
- print("Generating initial diagram...")
201
- generate_diagram(directory, output_file, filename, keep_tree, output_format, show_versions, theme)
231
+ if not quiet:
232
+ timestamp = time.strftime("%Y-%m-%d %H:%M:%S")
233
+ print(f"[{timestamp}] Generating initial diagram...")
234
+
235
+ try:
236
+ generate_diagram(directory, output_file, filename, keep_tree, output_format, show_versions, theme, quiet)
237
+ except MvnTreeVisualizerError:
238
+ sys.exit(1)
239
+ except KeyboardInterrupt:
240
+ sys.exit(130) # Standard exit code for SIGINT
241
+ except Exception:
242
+ sys.exit(1)
202
243
 
203
244
  if not watch_mode:
204
- print("You can open it in your browser to view the dependency tree.")
205
- print("Thank you for using mvn-tree-visualizer!")
245
+ if not quiet:
246
+ print("You can open it in your browser to view the dependency tree.")
247
+ print("Thank you for using mvn-tree-visualizer!")
206
248
  return
207
249
 
208
250
  # Watch mode
209
251
  def regenerate_callback():
210
252
  """Callback function for file watcher."""
211
- generate_diagram(directory, output_file, filename, keep_tree, output_format, show_versions, theme)
253
+ try:
254
+ generate_diagram(directory, output_file, filename, keep_tree, output_format, show_versions, theme, quiet)
255
+ except Exception:
256
+ # In watch mode, we don't want to exit on errors, just log them
257
+ print("Error during diagram regeneration:", file=sys.stderr)
258
+ traceback.print_exc()
212
259
 
213
260
  watcher = FileWatcher(directory, filename, regenerate_callback)
214
261
  watcher.start()
@@ -216,7 +263,8 @@ def cli() -> NoReturn:
216
263
  try:
217
264
  watcher.wait()
218
265
  finally:
219
- print("Thank you for using mvn-tree-visualizer!")
266
+ if not quiet:
267
+ print("Thank you for using mvn-tree-visualizer!")
220
268
 
221
269
 
222
270
  if __name__ == "__main__":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mvn-tree-visualizer
3
- Version: 1.6.0
3
+ Version: 1.7.0
4
4
  Summary: A simple command line tool to visualize the dependency tree of a Maven project in a graphical format.
5
5
  Project-URL: source, https://github.com/dyka3773/mvn-tree-visualizer
6
6
  Author-email: Iraklis Konsoulas <dyka3773@gmail.com>
@@ -10,10 +10,13 @@ Keywords: cli,command-line,dependency,graph,maven,mermaid,tool,tree,visualizatio
10
10
  Classifier: Development Status :: 4 - Beta
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
13
16
  Classifier: Programming Language :: Python :: 3.13
14
17
  Classifier: Topic :: Software Development :: Build Tools
15
18
  Classifier: Typing :: Typed
16
- Requires-Python: >=3.13
19
+ Requires-Python: >=3.10
17
20
  Requires-Dist: jinja2>=3.1.6
18
21
  Requires-Dist: watchdog>=6.0.0
19
22
  Description-Content-Type: text/markdown
@@ -21,7 +24,7 @@ Description-Content-Type: text/markdown
21
24
  # Maven Dependency Tree Visualizer
22
25
 
23
26
  [![PyPI version](https://badge.fury.io/py/mvn-tree-visualizer.svg)](https://badge.fury.io/py/mvn-tree-visualizer)
24
- ![Python](https://img.shields.io/badge/python-3.13+-blue.svg)
27
+ ![Python](https://img.shields.io/badge/python-3.10%20|%203.11%20|%203.12%20|%203.13-blue.svg)
25
28
  ![License](https://img.shields.io/badge/license-MIT-green.svg)
26
29
  [![Downloads](https://pepy.tech/badge/mvn-tree-visualizer)](https://pepy.tech/project/mvn-tree-visualizer)
27
30
  [![CI](https://github.com/dyka3773/mvn-tree-visualizer/workflows/CI/badge.svg)](https://github.com/dyka3773/mvn-tree-visualizer/actions)
@@ -112,6 +115,15 @@ mvn-tree-visualizer --filename "maven_dependency_file" --output "dependencies.js
112
115
  mvn-tree-visualizer --filename "maven_dependency_file" --output "diagram.html" --watch
113
116
  ```
114
117
 
118
+ #### Quiet Mode (For Automation/Scripts)
119
+ ```bash
120
+ # Only show errors, suppress success messages
121
+ mvn-tree-visualizer --filename "maven_dependency_file" --output "diagram.html" --quiet
122
+
123
+ # Short form also available
124
+ mvn-tree-visualizer --filename "maven_dependency_file" --output "diagram.html" -q
125
+ ```
126
+
115
127
  > **💡 Tip:** In watch mode, the tool will monitor for changes to your Maven dependency files and automatically regenerate the diagram. Perfect for development workflows! Press `Ctrl+C` to stop watching.
116
128
 
117
129
  ### Step 3: View the output
@@ -143,6 +155,8 @@ Each example includes:
143
155
  | `--watch` | Watch for file changes and auto-regenerate diagram | `False` |
144
156
  | `--directory` | The directory to scan for the Maven dependency file(s) | current directory |
145
157
  | `--keep-tree` | Keep the intermediate `dependency_tree.txt` file | `False` |
158
+ | `--quiet`, `-q` | Suppress all console output except errors | `False` |
159
+ | `--version`, `-v` | Show the current version and exit | - |
146
160
  | `--help` | Show the help message and exit | - |
147
161
 
148
162
  ### Theme Options
@@ -1,6 +1,6 @@
1
1
  mvn_tree_visualizer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  mvn_tree_visualizer/__main__.py,sha256=yIQFAdWjthKAFbSzzRuz5_YGlK0c6BnR2ypjNRDq180,82
3
- mvn_tree_visualizer/cli.py,sha256=Kq29UoFPHEKjWzmrs7b-yn4T1bT76PXx984WD3rRco8,8371
3
+ mvn_tree_visualizer/cli.py,sha256=luwm0Xsz6ws1JUWzvCOlr5kly7Tc7X6zOebiA8FLsPA,9935
4
4
  mvn_tree_visualizer/diagram.py,sha256=UfvP_J4Im4JQLe3EWlY3TsP4tua3oYk5NiCGbZNQwoA,933
5
5
  mvn_tree_visualizer/enhanced_template.py,sha256=AwK4gw5U8Ag-RmeD8Y11LXLRSnVzMFZhWja__c2iF4M,9813
6
6
  mvn_tree_visualizer/exceptions.py,sha256=R4nnJ0xrOpd84GfPD9rFSDk40etDLoph7iZpj1CCR0c,543
@@ -10,8 +10,8 @@ mvn_tree_visualizer/themes.py,sha256=T7vdNVTHPtYYkh4HusGG1MUWk1mJcqFBjCc5IK5l6Dc
10
10
  mvn_tree_visualizer/validation.py,sha256=UR_v6Jt7IGsgozE3aK0pB-t2-n1ivvS4YKxEa7p4VLQ,3206
11
11
  mvn_tree_visualizer/outputs/html_output.py,sha256=Y0IY-UF0UMTa5w8mVFoLidgcW6BUBTxASO0iRo26hH4,5531
12
12
  mvn_tree_visualizer/outputs/json_output.py,sha256=cXntw9ndE_BcrmFnuV61cEwZaRMp9Ev0SxaK1SUedlw,2037
13
- mvn_tree_visualizer-1.6.0.dist-info/METADATA,sha256=3u4CUISws1yO3X-CTmo7ydS26o-7QBJ_1h8Ne5IxnNM,8477
14
- mvn_tree_visualizer-1.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
- mvn_tree_visualizer-1.6.0.dist-info/entry_points.txt,sha256=Mu3QZhrlvbYuCxqmluVGi2efgKjkQY6T8Opf-vdb7hU,68
16
- mvn_tree_visualizer-1.6.0.dist-info/licenses/LICENSE,sha256=4zi6unpe17RUDMBu7ebh14jdbyvyeT-UA3n8Zl7aW74,1075
17
- mvn_tree_visualizer-1.6.0.dist-info/RECORD,,
13
+ mvn_tree_visualizer-1.7.0.dist-info/METADATA,sha256=9I5whXjVtgJ6l9FhHiT1xEJJizFLcAZyuCVn3Pqzz30,9096
14
+ mvn_tree_visualizer-1.7.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
+ mvn_tree_visualizer-1.7.0.dist-info/entry_points.txt,sha256=Mu3QZhrlvbYuCxqmluVGi2efgKjkQY6T8Opf-vdb7hU,68
16
+ mvn_tree_visualizer-1.7.0.dist-info/licenses/LICENSE,sha256=4zi6unpe17RUDMBu7ebh14jdbyvyeT-UA3n8Zl7aW74,1075
17
+ mvn_tree_visualizer-1.7.0.dist-info/RECORD,,