codelexity 0.1.0__tar.gz → 0.2.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.4
2
2
  Name: codelexity
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: A package that measures code complexity in the age of AI slop.
5
5
  Keywords: complexity,halstead,maintainability,cyclomatic,static-analysis,metrics
6
6
  License-Expression: MIT
@@ -17,14 +17,15 @@ Maintainer: nickgiki
17
17
  Requires-Python: >=3.11
18
18
  Project-URL: Homepage, https://github.com/nickgiki/codelexity
19
19
  Project-URL: Issues, https://github.com/nickgiki/codelexity/issues
20
+ Project-URL: Changelog, https://github.com/nickgiki/codelexity/blob/main/CHANGELOG.md
20
21
  Description-Content-Type: text/markdown
21
22
 
22
23
  <small>_This project was created with minimal help from AI assistants, mainly for the tests and a couple helper functions. This document is 100% human written._</small>
23
24
 
24
25
  # `Codelexity`
25
26
 
26
- ![version](https://img.shields.io/badge/version-0.1.0-blue)
27
- ![coverage](https://img.shields.io/badge/coverage-78%25-yellow)
27
+ ![version](https://img.shields.io/pypi/v/codelexity)
28
+ ![coverage](https://img.shields.io/badge/coverage-77%25-green)
28
29
  ![python](https://img.shields.io/badge/python-3.11%2B-blue)
29
30
 
30
31
  A python package that helps you measure, visualize and ultimately manage code complexity.
@@ -38,7 +39,7 @@ In the age of AI, codebases are becoming messier and more difficult to maintain.
38
39
  - Step 1: `uv add codelexity`
39
40
  - Step 2: `uv run codelexity <your_package_path> --plot` - this will create a `codelexity.html` that you can open and play with in your browser.
40
41
 
41
- ![Codelexity Graph](assets/codelexity_codelexity.png)
42
+ ![Codelexity Graph](https://raw.githubusercontent.com/nickgiki/codelexity/main/assets/codelexity_codelexity.png)
42
43
  _Codelexity HTML report on the `codelexity` repo_
43
44
 
44
45
 
@@ -63,7 +64,7 @@ where:
63
64
  - $n = n_1 + n_2$ the vocabulary of the program and
64
65
  - $N = N_1 + N_2$ the length of the program
65
66
 
66
- Another important metric is the [**Mc Cabe Cyclomatic Complexity**](https://en.wikipedia.org/wiki/Cyclomatic_complexity) measured as:
67
+ Another important metric is the [Mc Cabe Cyclomatic Complexity](https://en.wikipedia.org/wiki/Cyclomatic_complexity) measured as:
67
68
 
68
69
  $$M=E-N+2P$$
69
70
 
@@ -93,7 +94,7 @@ This is a result for the [`networkx` library](https://networkx.org/en/), a large
93
94
  codelexity networkx --json --plot
94
95
  ```
95
96
 
96
- ![Codelexity on NetworkX](/assets/codelexity_networkx.png)
97
+ ![Codelexity on NetworkX](https://raw.githubusercontent.com/nickgiki/codelexity/main/assets/codelexity_networkx.png)
97
98
 
98
99
  Note that the flags `json` and `plot` denote whether the output will be stored as a json named `codelexity.json` and as an html `codelexity.html` in the working directory.
99
100
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  # `Codelexity`
4
4
 
5
- ![version](https://img.shields.io/badge/version-0.1.0-blue)
6
- ![coverage](https://img.shields.io/badge/coverage-78%25-yellow)
5
+ ![version](https://img.shields.io/pypi/v/codelexity)
6
+ ![coverage](https://img.shields.io/badge/coverage-77%25-green)
7
7
  ![python](https://img.shields.io/badge/python-3.11%2B-blue)
8
8
 
9
9
  A python package that helps you measure, visualize and ultimately manage code complexity.
@@ -17,7 +17,7 @@ In the age of AI, codebases are becoming messier and more difficult to maintain.
17
17
  - Step 1: `uv add codelexity`
18
18
  - Step 2: `uv run codelexity <your_package_path> --plot` - this will create a `codelexity.html` that you can open and play with in your browser.
19
19
 
20
- ![Codelexity Graph](assets/codelexity_codelexity.png)
20
+ ![Codelexity Graph](https://raw.githubusercontent.com/nickgiki/codelexity/main/assets/codelexity_codelexity.png)
21
21
  _Codelexity HTML report on the `codelexity` repo_
22
22
 
23
23
 
@@ -42,7 +42,7 @@ where:
42
42
  - $n = n_1 + n_2$ the vocabulary of the program and
43
43
  - $N = N_1 + N_2$ the length of the program
44
44
 
45
- Another important metric is the [**Mc Cabe Cyclomatic Complexity**](https://en.wikipedia.org/wiki/Cyclomatic_complexity) measured as:
45
+ Another important metric is the [Mc Cabe Cyclomatic Complexity](https://en.wikipedia.org/wiki/Cyclomatic_complexity) measured as:
46
46
 
47
47
  $$M=E-N+2P$$
48
48
 
@@ -72,7 +72,7 @@ This is a result for the [`networkx` library](https://networkx.org/en/), a large
72
72
  codelexity networkx --json --plot
73
73
  ```
74
74
 
75
- ![Codelexity on NetworkX](/assets/codelexity_networkx.png)
75
+ ![Codelexity on NetworkX](https://raw.githubusercontent.com/nickgiki/codelexity/main/assets/codelexity_networkx.png)
76
76
 
77
77
  Note that the flags `json` and `plot` denote whether the output will be stored as a json named `codelexity.json` and as an html `codelexity.html` in the working directory.
78
78
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "codelexity"
3
- version = "0.1.0"
3
+ version = "0.2.0"
4
4
  description = "A package that measures code complexity in the age of AI slop."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -33,6 +33,7 @@ name = "nickgiki"
33
33
  [project.urls]
34
34
  Homepage = "https://github.com/nickgiki/codelexity"
35
35
  Issues = "https://github.com/nickgiki/codelexity/issues"
36
+ Changelog = "https://github.com/nickgiki/codelexity/blob/main/CHANGELOG.md"
36
37
 
37
38
  [project.scripts]
38
39
  codelexity = "codelexity.main:main"
@@ -42,7 +43,7 @@ path = "src"
42
43
  editable = true
43
44
 
44
45
  [tool.bumpver]
45
- current_version = "0.1.0"
46
+ current_version = "0.2.0"
46
47
  version_pattern = "MAJOR.MINOR.PATCH"
47
48
  push = false
48
49
 
@@ -51,7 +52,6 @@ push = false
51
52
  'current_version = "{version}"',
52
53
  'version = "{version}"',
53
54
  ]
54
- "README.md" = ["version-{version}-"]
55
55
 
56
56
  [tool.ruff]
57
57
  line-length = 120
@@ -62,6 +62,7 @@ select = [
62
62
  "F",
63
63
  "I",
64
64
  ]
65
+ ignore = ["E731"]
65
66
 
66
67
  [tool.ruff.lint.isort]
67
68
  force-single-line = false
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "codelexity"
3
- version = "0.1.0"
3
+ version = "0.2.0"
4
4
  description = "A package that measures code complexity in the age of AI slop."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -28,6 +28,7 @@ classifiers = [
28
28
  [project.urls]
29
29
  Homepage = "https://github.com/nickgiki/codelexity"
30
30
  Issues = "https://github.com/nickgiki/codelexity/issues"
31
+ Changelog = "https://github.com/nickgiki/codelexity/blob/main/CHANGELOG.md"
31
32
 
32
33
  [project.scripts]
33
34
  codelexity = "codelexity.main:main"
@@ -47,14 +48,14 @@ dev = [
47
48
  ]
48
49
 
49
50
  [tool.bumpver]
50
- current_version = "0.1.0"
51
+ current_version = "0.2.0"
51
52
  version_pattern = "MAJOR.MINOR.PATCH"
52
53
  push = false # inspect the tag before it leaves the machine
53
54
 
54
55
  [tool.bumpver.file_patterns]
55
56
  # The version appears twice in this file: [project] version and current_version above.
56
57
  "pyproject.toml" = ['current_version = "{version}"', 'version = "{version}"']
57
- "README.md" = ['version-{version}-']
58
+ # No README pattern: its version badge reads live from PyPI, so there is no literal to rewrite.
58
59
 
59
60
  [tool.ruff]
60
61
  # Set your preferred line length rule
@@ -64,6 +65,8 @@ line-length = 120
64
65
  # E, F = standard errors/warnings
65
66
  # I = Isort (handles argument/import sorting rules)
66
67
  select = ["E", "F", "I"]
68
+ ignore = ["E731"]
69
+
67
70
 
68
71
  [tool.ruff.lint.isort]
69
72
  # Forces arguments/imports into a specific sorted structure
@@ -171,6 +171,11 @@ def advanced_analysis(package_data: dict):
171
171
  "total_lines": sum(d["total_lines"] for d in package_data.values()),
172
172
  "total_functions": sum(len(d["contained_function_length"]) for d in package_data.values()),
173
173
  "total_modules": len(package_data.keys()),
174
+ "total_man_hours": int(
175
+ round(
176
+ sum(d["halstead_metrics"]["time"] for d in package_data.values()) / 3600,
177
+ )
178
+ ),
174
179
  }
175
180
 
176
181
 
@@ -86,7 +86,8 @@ def create_viz(package_data: dict, fpath: str):
86
86
  f"Maintainability: {maintainability_score}%</div><br>"
87
87
  f"Total lines of code: {package_data['analytics']['total_lines']}<br>"
88
88
  f"Total modules: {package_data['analytics']['total_modules']}<br>"
89
- f"Total functions/methods: {package_data['analytics']['total_functions']}</div>"
89
+ f"Total functions/methods: {package_data['analytics']['total_functions']}<br>"
90
+ f"Total comprehension time (h): {package_data['analytics']['total_man_hours']}</div>"
90
91
  )
91
92
  path = Path(fpath)
92
93
  path.write_text(path.read_text().replace("<body>", f"<body>\n{legend}", 1))
File without changes