codesize 1.0.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.
- codesize/__init__.py +24 -0
- codesize/__main__.py +28 -0
- codesize/_version.py +1 -0
- codesize/argbuilder.py +1426 -0
- codesize/cli.py +169 -0
- codesize/output.py +281 -0
- codesize/scanner.py +237 -0
- codesize/version.py +35 -0
- codesize-1.0.0.dist-info/METADATA +109 -0
- codesize-1.0.0.dist-info/RECORD +13 -0
- codesize-1.0.0.dist-info/WHEEL +4 -0
- codesize-1.0.0.dist-info/entry_points.txt +2 -0
- codesize-1.0.0.dist-info/licenses/LICENSE +24 -0
codesize/version.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# ----------------------------------------------------------------------------------------
|
|
2
|
+
# version.py
|
|
3
|
+
# ----------
|
|
4
|
+
#
|
|
5
|
+
# Version string handling - imports from generated _version.py at build time,
|
|
6
|
+
# falls back to "dev" when not built.
|
|
7
|
+
#
|
|
8
|
+
# (c) 2026 WaterJuice — Unlicense; see LICENSE in the project root.
|
|
9
|
+
#
|
|
10
|
+
# Authors
|
|
11
|
+
# -------
|
|
12
|
+
# bena (via Claude)
|
|
13
|
+
#
|
|
14
|
+
# Version History
|
|
15
|
+
# ---------------
|
|
16
|
+
# Mar 2026 - Created
|
|
17
|
+
# ----------------------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
# ----------------------------------------------------------------------------------------
|
|
20
|
+
# Version
|
|
21
|
+
# ----------------------------------------------------------------------------------------
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _get_version() -> str:
|
|
25
|
+
try:
|
|
26
|
+
# fmt: off
|
|
27
|
+
from ._version import __version__ as _v # pyright: ignore[reportMissingImports,reportUnknownVariableType] # noqa: I001
|
|
28
|
+
# fmt: on
|
|
29
|
+
|
|
30
|
+
return str(_v) # pyright: ignore[reportUnknownArgumentType]
|
|
31
|
+
except ImportError:
|
|
32
|
+
return "dev"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
VERSION_STR: str = _get_version()
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codesize
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A simple CLI tool to analyse code statistics in a directory
|
|
5
|
+
Project-URL: Repository, https://gitlab.com/waterjuice/codesize
|
|
6
|
+
Author: WaterJuice
|
|
7
|
+
License-Expression: Unlicense
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: cli,code-analysis,metrics,python,statistics
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: The Unlicense (Unlicense)
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Requires-Python: >=3.12
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# codesize
|
|
21
|
+
|
|
22
|
+
A simple CLI tool that scans directories for code files and displays statistics.
|
|
23
|
+
Supports Python, Go, Rust, and Elixir.
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
- Recursively scans directories for supported code files
|
|
28
|
+
- Reports per-language breakdown:
|
|
29
|
+
- Number of files
|
|
30
|
+
- Total size (KB/MB)
|
|
31
|
+
- Total lines
|
|
32
|
+
- Code lines (excluding blank lines, docstrings, and decorative comments)
|
|
33
|
+
- Combined totals when multiple languages are present
|
|
34
|
+
- Only shows languages that have files — no clutter
|
|
35
|
+
- Beautiful ASCII box output with ANSI colours (when running in a terminal)
|
|
36
|
+
- Plain text and JSON output formats available
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Using uv
|
|
42
|
+
uv pip install codesize
|
|
43
|
+
|
|
44
|
+
# Using pip
|
|
45
|
+
pip install codesize
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Scan current directory
|
|
52
|
+
codesize
|
|
53
|
+
|
|
54
|
+
# Scan a specific directory
|
|
55
|
+
codesize /path/to/project
|
|
56
|
+
|
|
57
|
+
# Plain text output (no box)
|
|
58
|
+
codesize --plain
|
|
59
|
+
|
|
60
|
+
# JSON output
|
|
61
|
+
codesize --json
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Example Output
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
╭──────────────────────────────────────────────╮
|
|
68
|
+
│ Code Stats: my-project │
|
|
69
|
+
│──────────────────────────────────────────────│
|
|
70
|
+
│ Files Size Lines Code │
|
|
71
|
+
│ Python 42 128.50 KB 3,847 2,691 │
|
|
72
|
+
│ Go 18 65.20 KB 1,523 1,210 │
|
|
73
|
+
│ Rust 7 22.00 KB 580 445 │
|
|
74
|
+
│──────────────────────────────────────────────│
|
|
75
|
+
│ Total 67 215.70 KB 5,950 4,346 │
|
|
76
|
+
╰──────────────────────────────────────────────╯
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Development
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Set up development environment
|
|
83
|
+
make dev
|
|
84
|
+
|
|
85
|
+
# Run linting and type checks
|
|
86
|
+
make check
|
|
87
|
+
|
|
88
|
+
# Format code
|
|
89
|
+
make format
|
|
90
|
+
|
|
91
|
+
# Build wheel and docs
|
|
92
|
+
make build
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Publishing
|
|
96
|
+
|
|
97
|
+
Publishing requires `cal-publish-python` configuration.
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Build first
|
|
101
|
+
make build
|
|
102
|
+
|
|
103
|
+
# Publish wheel to PyPI and docs to GitLab Pages
|
|
104
|
+
make publish
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Licence
|
|
108
|
+
|
|
109
|
+
Unlicense — public domain. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
codesize/__init__.py,sha256=6mELafwlK17KCvILUDgHverZu44-zGeIgUAFuQWt1zw,607
|
|
2
|
+
codesize/__main__.py,sha256=OHof6xXAEBCei1kVu28xOjg6N7bEjaSEETo8HJ7zoUM,713
|
|
3
|
+
codesize/_version.py,sha256=J-j-u0itpEFT6irdmWmixQqYMadNl1X91TxUmoiLHMI,22
|
|
4
|
+
codesize/argbuilder.py,sha256=WMbhsYRJFxoPOBOeMIewF08c3lS2B5nr1WaeSXt6Wbw,53732
|
|
5
|
+
codesize/cli.py,sha256=iU-ig_32BxhhHdvAqsOmnmGd67XxLfoBX277sSZiimc,5640
|
|
6
|
+
codesize/output.py,sha256=VuV2CYTDYEcL6_mr7JrMYiQwYMZrR8dxC4FXQ2AsaqU,9256
|
|
7
|
+
codesize/scanner.py,sha256=Jnv8A3mDj5R17wKXo-eOYA55qdPxBRlNWwruZ510XeA,7955
|
|
8
|
+
codesize/version.py,sha256=GyeWkXT7qnFOrpqpjqDoauuMsUTYUXDwPrk86jk9seU,1071
|
|
9
|
+
codesize-1.0.0.dist-info/METADATA,sha256=JtoU1PJ_VF7-vzdsWhhW47EF-Ltn9xx2Of2ntDJmFao,2946
|
|
10
|
+
codesize-1.0.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
11
|
+
codesize-1.0.0.dist-info/entry_points.txt,sha256=mk0MbHsm6hb-PytrpxcW32lTb74RL6OloQG3-CJqS3s,47
|
|
12
|
+
codesize-1.0.0.dist-info/licenses/LICENSE,sha256=awOCsWJ58m_2kBQwBUGWejVqZm6wuRtCL2hi9rfa0X4,1211
|
|
13
|
+
codesize-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
|
2
|
+
|
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
4
|
+
distribute this software, either in source code form or as a compiled
|
|
5
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
6
|
+
means.
|
|
7
|
+
|
|
8
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
9
|
+
of this software dedicate any and all copyright interest in the
|
|
10
|
+
software to the public domain. We make this dedication for the benefit
|
|
11
|
+
of the public at large and to the detriment of our heirs and
|
|
12
|
+
successors. We intend this dedication to be an overt act of
|
|
13
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
14
|
+
software under copyright law.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
20
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
21
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
|
|
24
|
+
For more information, please refer to <https://unlicense.org>
|