rolling-pin 0.9.6__tar.gz → 0.10.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rolling-pin
3
- Version: 0.9.6
3
+ Version: 0.10.0
4
4
  Summary: A library of generic tools for ETL work and visualization of JSON blobs and python repositories
5
5
  License: MIT
6
6
  Keywords: ETL,blob,dependency,graph,svg,networkx,transform,code metrics,dependency diagram,build system
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "rolling-pin"
3
- version = "0.9.6"
3
+ version = "0.10.0"
4
4
  description = "A library of generic tools for ETL work and visualization of JSON blobs and python repositories"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -29,13 +29,13 @@ classifiers = [
29
29
  requires-python = ">=3.8"
30
30
  dependencies = [
31
31
  "click>=8.1.3",
32
- "cufflinks",
33
32
  "graphviz",
34
33
  "ipython",
35
34
  "lunchbox",
36
35
  "networkx",
37
36
  "numpy>=1.23.4,<=1.24.4",
38
37
  "pandas>=1.1.5",
38
+ "plotly>=5.22.0",
39
39
  "pydot<=1.4.2",
40
40
  "pyyaml",
41
41
  "radon<6.0.0",
@@ -5,13 +5,13 @@ import os
5
5
  import re
6
6
  from pathlib import Path
7
7
 
8
- import cufflinks as cf
8
+ from pandas import DataFrame
9
+ from radon.cli import CCHarvester, HCHarvester, MIHarvester, RawHarvester
10
+ from radon.cli import Config
9
11
  import numpy as np
10
12
  import pandas as pd
11
- from pandas import DataFrame
13
+ import plotly.express as px
12
14
  import radon.complexity
13
- from radon.cli import Config
14
- from radon.cli import CCHarvester, HCHarvester, MIHarvester, RawHarvester
15
15
 
16
16
  from rolling_pin.blob_etl import BlobETL
17
17
  import rolling_pin.tools as rpt
@@ -413,8 +413,6 @@ class RadonETL():
413
413
  Returns:
414
414
  RadonETL: self.
415
415
  '''
416
- cf.go_offline()
417
-
418
416
  def remove_test_modules(data):
419
417
  # type: (DataFrame) -> DataFrame
420
418
  mask = data.fullpath\
@@ -436,13 +434,6 @@ class RadonETL():
436
434
  bugs='bugs (B) - V / 3000 - an estimate of the errors in the implementation',
437
435
  )
438
436
 
439
- params = dict(
440
- theme='henanigans',
441
- colors=rpt.COLOR_SCALE,
442
- dimensions=(900, 900),
443
- asFigure=True,
444
- )
445
-
446
437
  html = '<body style="background: #242424">\n'
447
438
 
448
439
  raw = remove_test_modules(self.raw_metrics)
@@ -452,42 +443,64 @@ class RadonETL():
452
443
 
453
444
  raw['docstring_ratio'] = raw.multiline_comment / raw.code
454
445
  raw.sort_values('docstring_ratio', inplace=True)
455
- html += raw.iplot(
456
- x='fullpath',
457
- kind='barh',
446
+
447
+ # line count
448
+ fig = px.bar(
449
+ raw,
458
450
  title='Line Count Metrics',
459
- **params
460
- ).to_html()
451
+ x=raw.drop(columns='fullpath').columns.tolist(),
452
+ y='fullpath',
453
+ orientation='h',
454
+ barmode='group',
455
+ width=900,
456
+ height=900,
457
+ color_discrete_sequence=rpt.COLOR_SCALE,
458
+ )
459
+ fig.layout.update(rpt.PLOTLY_LAYOUT_THEME)
460
+ html += fig.to_html()
461
461
 
462
- html += mi.iplot(
463
- x='fullpath',
464
- kind='barh',
462
+ # maintainability
463
+ fig = px.bar(
464
+ mi,
465
465
  title='Maintainability Metrics',
466
- **params
467
- ).to_html()
468
-
469
- params['dimensions'] = (900, 500)
466
+ x='maintainability_index',
467
+ y='fullpath',
468
+ orientation='h',
469
+ barmode='group',
470
+ width=900,
471
+ height=900,
472
+ color_discrete_sequence=rpt.COLOR_SCALE,
473
+ )
474
+ fig.layout.update(rpt.PLOTLY_LAYOUT_THEME)
475
+ html += fig.to_html()
470
476
 
471
- cols = ['cyclomatic_complexity', 'cyclomatic_rank']
472
- html += cc[cols].iplot(
473
- kind='hist',
474
- bins=50,
477
+ # cyclomatic
478
+ fig = px.histogram(
479
+ cc[['cyclomatic_complexity', 'cyclomatic_rank']],
475
480
  title='Cyclomatic Metric Distributions',
476
- **params
477
- ).to_html()
481
+ nbins=10,
482
+ width=900,
483
+ height=500,
484
+ color_discrete_sequence=rpt.COLOR_SCALE,
485
+ )
486
+ fig.layout.update(rpt.PLOTLY_LAYOUT_THEME)
487
+ html += fig.to_html()
478
488
 
489
+ # halstead
479
490
  cols = [
480
491
  'h1', 'h2', 'n1', 'n2', 'vocabulary', 'length', 'calculated_length',
481
492
  'volume', 'difficulty', 'effort', 'time', 'bugs'
482
493
  ]
483
- html += hal[cols]\
484
- .rename(mapper=lambda x: lut[x], axis=1)\
485
- .iplot(
486
- kind='hist',
487
- bins=50,
488
- title='Halstead Metric Distributions',
489
- **params)\
490
- .to_html()
494
+ fig = px.histogram(
495
+ hal[cols].rename(mapper=lambda x: lut[x], axis=1),
496
+ title='Halstead Metric Distributions',
497
+ nbins=10,
498
+ width=1400,
499
+ height=500,
500
+ color_discrete_sequence=rpt.COLOR_SCALE,
501
+ )
502
+ fig.layout.update(rpt.PLOTLY_LAYOUT_THEME)
503
+ html += fig.to_html()
491
504
 
492
505
  html += '\n</body>'
493
506
 
@@ -38,18 +38,83 @@ COLOR_SCHEME = dict(
38
38
  edge_module='#B6ECF3',
39
39
  ) # type: Dict[str, str]
40
40
 
41
+
42
+ PLOTLY_COLOR_SCHEME = dict(
43
+ bg='#242424',
44
+ blue1='#5F95DE',
45
+ blue2='#93B6E6',
46
+ cyan1='#7EC4CF',
47
+ cyan2='#B6ECF3',
48
+ dark1='#040404',
49
+ dark2='#141414',
50
+ dialog1='#444459',
51
+ dialog2='#5D5D7A',
52
+ green1='#8BD155',
53
+ green2='#A0D17B',
54
+ grey1='#343434',
55
+ grey2='#444444',
56
+ light1='#A4A4A4',
57
+ light2='#F4F4F4',
58
+ orange1='#EB9E58',
59
+ orange2='#EBB483',
60
+ purple1='#C98FDE',
61
+ purple2='#AC92DE',
62
+ red1='#F77E70',
63
+ red2='#DE958E',
64
+ yellow1='#E8EA7E',
65
+ yellow2='#E9EABE',
66
+ )
67
+
68
+
41
69
  COLOR_SCALE = [
42
- '#B6ECF3',
43
- '#DE958E',
44
- '#EBB483',
45
- '#A0D17B',
46
- '#93B6E6',
47
- '#AC92DE',
48
- '#E9EABE',
49
- '#7EC4CF',
50
- '#F77E70',
51
- '#EB9E58',
70
+ 'cyan2', 'red2', 'green2', 'blue2', 'orange2', 'purple2', 'yellow2',
71
+ 'light2', 'cyan1', 'red1', 'green1', 'blue1'
52
72
  ] # type: List[str]
73
+ COLOR_SCALE = [PLOTLY_COLOR_SCHEME[x] for x in COLOR_SCALE]
74
+
75
+
76
+ PLOTLY_LAYOUT_THEME = {
77
+ 'legend': {
78
+ 'bgcolor': PLOTLY_COLOR_SCHEME['bg'],
79
+ 'title': {'text': ''},
80
+ 'font': {
81
+ 'color': PLOTLY_COLOR_SCHEME['light2']
82
+ }
83
+ },
84
+ 'paper_bgcolor': PLOTLY_COLOR_SCHEME['bg'],
85
+ 'plot_bgcolor': PLOTLY_COLOR_SCHEME['bg'],
86
+ 'title': {
87
+ 'font': {
88
+ 'color': PLOTLY_COLOR_SCHEME['light2']
89
+ }
90
+ },
91
+ 'xaxis': {
92
+ 'gridcolor': PLOTLY_COLOR_SCHEME['grey1'],
93
+ 'showgrid': True,
94
+ 'tickfont': {
95
+ 'color': PLOTLY_COLOR_SCHEME['light1']
96
+ },
97
+ 'title': {
98
+ 'font': {
99
+ 'color': PLOTLY_COLOR_SCHEME['light1']
100
+ }
101
+ },
102
+ 'zerolinecolor': PLOTLY_COLOR_SCHEME['grey2']
103
+ },
104
+ 'yaxis': {
105
+ 'gridcolor': PLOTLY_COLOR_SCHEME['grey1'],
106
+ 'showgrid': True,
107
+ 'tickfont': {
108
+ 'color': PLOTLY_COLOR_SCHEME['light1']
109
+ },
110
+ 'title': {
111
+ 'font': {
112
+ 'color': PLOTLY_COLOR_SCHEME['light1']
113
+ }
114
+ },
115
+ 'zerolinecolor': PLOTLY_COLOR_SCHEME['grey2']
116
+ }
117
+ }
53
118
 
54
119
 
55
120
  # PREDICATE-FUNCTIONS-----------------------------------------------------------
File without changes
File without changes