pyfixit-cli 0.1.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.
@@ -0,0 +1,507 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyfixit-cli
3
+ Version: 0.1.0
4
+ Summary: Diagnose common Python import and dependency problems
5
+ Author: Dhanunjay
6
+ License-Expression: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: Python :: 3 :: Only
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
+ Classifier: Topic :: Software Development :: Quality Assurance
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: packaging>=22
19
+ Dynamic: license-file
20
+
21
+ # PyFixIt
22
+
23
+ ### Python Project Troubleshooter
24
+
25
+ PyFixIt is a command-line tool that analyzes Python projects and diagnoses common import and dependency problems.
26
+
27
+ It can detect:
28
+
29
+ - Missing dependencies
30
+ - Undeclared dependencies
31
+ - Version conflicts
32
+ - Unused dependencies
33
+ - Standard-library modules
34
+ - Local project modules
35
+ - Package-name differences such as `sklearn -> scikit-learn`
36
+
37
+ ---
38
+
39
+ ## Features
40
+
41
+ ### Dependency Diagnosis
42
+
43
+ PyFixIt analyzes Python files in a project and compares the detected imports with `requirements.txt`.
44
+
45
+ Example:
46
+
47
+ ```text
48
+ [PROBLEM] sklearn
49
+
50
+ Status: missing_installation
51
+
52
+ Fix: pip install scikit-learn
53
+ ```
54
+
55
+ ---
56
+
57
+ ### Version Conflict Detection
58
+
59
+ PyFixIt checks installed versions against the versions specified in `requirements.txt`.
60
+
61
+ Example:
62
+
63
+ ```text
64
+ [VERSION CONFLICT] requests
65
+
66
+ Required: ==2.30.0
67
+
68
+ Installed: 2.34.2
69
+
70
+ Fix: pip install requests==2.30.0
71
+ ```
72
+
73
+ ---
74
+
75
+ ### Missing Declaration Detection
76
+
77
+ If a package is installed and imported but not declared in `requirements.txt`, PyFixIt reports it.
78
+
79
+ Example:
80
+
81
+ ```text
82
+ [PROBLEM] pandas
83
+
84
+ Status: missing_declaration
85
+
86
+ Fix: Add 'pandas' to requirements.txt
87
+ ```
88
+
89
+ ---
90
+
91
+ ### Unused Dependency Detection
92
+
93
+ PyFixIt can identify packages listed in `requirements.txt` that are not imported by the project.
94
+
95
+ Example:
96
+
97
+ ```text
98
+ [UNUSED] numpy
99
+
100
+ Fix: Remove 'numpy' from requirements.txt
101
+ ```
102
+
103
+ ---
104
+
105
+ ### Requirements Cleanup
106
+
107
+ You can preview unused dependencies:
108
+
109
+ ```bash
110
+ pyfixit clean .
111
+ ```
112
+
113
+ Then apply the cleanup:
114
+
115
+ ```bash
116
+ pyfixit clean . --apply
117
+ ```
118
+
119
+ ---
120
+
121
+ ## Installation
122
+
123
+ ### From Source
124
+
125
+ Clone the repository:
126
+
127
+ ```bash
128
+ git clone <YOUR_GITHUB_REPOSITORY_URL>
129
+ ```
130
+
131
+ Navigate into the project:
132
+
133
+ ```bash
134
+ cd pyfixit
135
+ ```
136
+
137
+ Create a virtual environment:
138
+
139
+ ```bash
140
+ python -m venv .venv
141
+ ```
142
+
143
+ ### Windows
144
+
145
+ Activate the virtual environment:
146
+
147
+ ```bash
148
+ .venv\Scripts\activate
149
+ ```
150
+
151
+ ### Linux / macOS
152
+
153
+ Activate the virtual environment:
154
+
155
+ ```bash
156
+ source .venv/bin/activate
157
+ ```
158
+
159
+ Install PyFixIt in editable mode:
160
+
161
+ ```bash
162
+ python -m pip install -e .
163
+ ```
164
+
165
+ ---
166
+
167
+ ## Usage
168
+
169
+ ### Diagnose a Project
170
+
171
+ Run:
172
+
173
+ ```bash
174
+ pyfixit diagnose .
175
+ ```
176
+
177
+ Example output:
178
+
179
+ ```text
180
+ PyFixIt v0.1.0
181
+ Python Project Troubleshooter
182
+
183
+ Dependencies
184
+ ------------------------------
185
+
186
+ [PROBLEM] sklearn
187
+
188
+ Status: missing_installation
189
+
190
+ Fix: pip install scikit-learn
191
+
192
+ [VERSION CONFLICT] requests
193
+
194
+ Required: ==2.30.0
195
+
196
+ Installed: 2.34.2
197
+
198
+ Fix: pip install requests==2.30.0
199
+
200
+ [PROBLEM] pandas
201
+
202
+ Status: missing_declaration
203
+
204
+ Fix: Add 'pandas' to requirements.txt
205
+
206
+
207
+ Unused dependencies
208
+ ------------------------------
209
+
210
+ [UNUSED] numpy
211
+
212
+ Fix: Remove 'numpy' from requirements.txt
213
+ ```
214
+
215
+ You can also use the shorthand:
216
+
217
+ ```bash
218
+ pyfixit .
219
+ ```
220
+
221
+ ---
222
+
223
+ ## Check a Project
224
+
225
+ The `check` command provides a quick project health summary.
226
+
227
+ Run:
228
+
229
+ ```bash
230
+ pyfixit check .
231
+ ```
232
+
233
+ Example:
234
+
235
+ ```text
236
+ PyFixIt v0.1.0
237
+ Python Project Troubleshooter
238
+
239
+ Checking project...
240
+
241
+ [FAIL] 4 dependency problems found
242
+
243
+ [OK] No unused dependencies found
244
+ ```
245
+
246
+ For a clean project:
247
+
248
+ ```text
249
+ PyFixIt v0.1.0
250
+ Python Project Troubleshooter
251
+
252
+ Checking project...
253
+
254
+ [OK] No dependency problems found
255
+
256
+ [OK] No unused dependencies found
257
+ ```
258
+
259
+ PyFixIt also uses exit codes, so it can be used in scripts and CI pipelines.
260
+
261
+ ---
262
+
263
+ ## JSON Output
264
+
265
+ For machine-readable diagnosis results:
266
+
267
+ ```bash
268
+ pyfixit diagnose . --json
269
+ ```
270
+
271
+ Example:
272
+
273
+ ```json
274
+ {
275
+ "dependencies": [
276
+ {
277
+ "module": "sklearn",
278
+ "package_name": "scikit-learn",
279
+ "import_name": "sklearn",
280
+ "declared": true,
281
+ "installed": false,
282
+ "installed_version": null,
283
+ "required_version": null,
284
+ "operator": null,
285
+ "status": "missing_installation"
286
+ }
287
+ ],
288
+ "unused_dependencies": [
289
+ "numpy"
290
+ ]
291
+ }
292
+ ```
293
+
294
+ JSON output can be useful for automation, CI tools, and other developer tooling.
295
+
296
+ ---
297
+
298
+ ## Clean Requirements
299
+
300
+ PyFixIt can identify unused dependencies and optionally remove them from `requirements.txt`.
301
+
302
+ ### Preview Unused Dependencies
303
+
304
+ Run:
305
+
306
+ ```bash
307
+ pyfixit clean .
308
+ ```
309
+
310
+ Example:
311
+
312
+ ```text
313
+ Cleaning requirements.txt
314
+ ------------------------------
315
+
316
+ [REMOVE] numpy
317
+
318
+ 1 unused dependencies found.
319
+
320
+ Run 'pyfixit clean . --apply' to remove them.
321
+ ```
322
+
323
+ ### Apply the Cleanup
324
+
325
+ Run:
326
+
327
+ ```bash
328
+ pyfixit clean . --apply
329
+ ```
330
+
331
+ Example:
332
+
333
+ ```text
334
+ Cleaning requirements.txt
335
+ ------------------------------
336
+
337
+ [REMOVED] numpy
338
+
339
+ 1 dependencies removed.
340
+ ```
341
+
342
+ Running the command again will show:
343
+
344
+ ```text
345
+ Cleaning requirements.txt
346
+ ------------------------------
347
+
348
+ Nothing to remove.
349
+ ```
350
+
351
+ ---
352
+
353
+ ## Available Commands
354
+
355
+ | Command | Description |
356
+ |---|---|
357
+ | `pyfixit diagnose .` | Diagnose project dependencies |
358
+ | `pyfixit check .` | Quickly check project health |
359
+ | `pyfixit clean .` | Preview unused dependencies |
360
+ | `pyfixit clean . --apply` | Remove unused dependencies |
361
+ | `pyfixit diagnose . --json` | Output diagnosis as JSON |
362
+ | `pyfixit --help` | Show help |
363
+ | `pyfixit --version` | Show version |
364
+
365
+ ---
366
+
367
+ ## What PyFixIt Checks
368
+
369
+ PyFixIt analyzes imports and classifies them into three categories:
370
+
371
+ ```text
372
+ Standard Library
373
+ |
374
+ +-- pathlib
375
+ +-- sys
376
+ +-- ast
377
+
378
+ Local Modules
379
+ |
380
+ +-- project files
381
+ +-- project packages
382
+
383
+ Third-Party Modules
384
+ |
385
+ +-- requests
386
+ +-- pandas
387
+ +-- fastapi
388
+ +-- sklearn
389
+ ```
390
+
391
+ Only third-party modules are checked against project dependencies.
392
+
393
+ This prevents standard-library and local project modules from being incorrectly reported as missing dependencies.
394
+
395
+ ---
396
+
397
+ ## Package Name Mapping
398
+
399
+ Some Python import names are different from their package names.
400
+
401
+ For example:
402
+
403
+ ```python
404
+ import sklearn
405
+ ```
406
+
407
+ The package is installed using:
408
+
409
+ ```bash
410
+ pip install scikit-learn
411
+ ```
412
+
413
+ PyFixIt handles this distinction automatically.
414
+
415
+ ```text
416
+ Import name: sklearn
417
+
418
+ Package name: scikit-learn
419
+ ```
420
+
421
+ This allows PyFixIt to provide more accurate installation suggestions.
422
+
423
+ ---
424
+
425
+ ## Requirements
426
+
427
+ PyFixIt currently requires:
428
+
429
+ - Python 3.10+
430
+ - `packaging >= 22`
431
+
432
+ ---
433
+
434
+ ## Development
435
+
436
+ Clone the repository and install it in editable mode:
437
+
438
+ ```bash
439
+ python -m pip install -e .
440
+ ```
441
+
442
+ Install pytest:
443
+
444
+ ```bash
445
+ python -m pip install pytest
446
+ ```
447
+
448
+ Run the test suite:
449
+
450
+ ```bash
451
+ python -m pytest
452
+ ```
453
+
454
+ ### Test Status
455
+
456
+ Current test suite:
457
+
458
+ ```text
459
+ 47 passed
460
+ ```
461
+
462
+ ---
463
+
464
+ ## Project Structure
465
+
466
+ ```text
467
+ pyfixit/
468
+ |
469
+ +-- src/
470
+ | +-- pyfixit/
471
+ | +-- __init__.py
472
+ | +-- cleaner.py
473
+ | +-- cli.py
474
+ | +-- dependencies.py
475
+ | +-- diagnostics.py
476
+ | +-- environment.py
477
+ | +-- imports.py
478
+ | +-- module_classifier.py
479
+ | +-- package_mapping.py
480
+ | +-- package_names.py
481
+ | +-- requirements_parser.py
482
+ |
483
+ +-- tests/
484
+ | +-- test_cleaner.py
485
+ | +-- test_cli.py
486
+ | +-- test_diagnostics.py
487
+ | +-- test_package_names.py
488
+ | +-- test_requirements_parser.py
489
+ |
490
+ +-- pyproject.toml
491
+ +-- README.md
492
+ +-- requirements.txt
493
+ ```
494
+
495
+ ---
496
+
497
+ ## Version
498
+
499
+ **Current version: `0.1.0`**
500
+
501
+ PyFixIt is currently in its initial release.
502
+
503
+ ---
504
+
505
+ ## License
506
+
507
+ This project is licensed under the MIT License.
@@ -0,0 +1,17 @@
1
+ pyfixit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ pyfixit/cleaner.py,sha256=Z_XtSg0PLfTXYP-MUcYWAtiVCXYQ9E3RRtRXnuqPtKM,1486
3
+ pyfixit/cli.py,sha256=6JPO3YJJBpG_JUfo1tBh8ZwpBg7sUcBa7CBgvXbbGNQ,6048
4
+ pyfixit/dependencies.py,sha256=Ild2XnOnpLoAxW3-VOiG9bXh1ZmGCkHUz7GijUJIPfw,746
5
+ pyfixit/diagnostics.py,sha256=c4K6CG_wFUvcW-eXOQMTKzR5pyZoIcrcZJjfYP8U4uY,6212
6
+ pyfixit/environment.py,sha256=psmEy3ozcn2ADZa4S4nntyjB192mV_VDd9aitSf5Uao,484
7
+ pyfixit/imports.py,sha256=R4f1W_fgpdH56RpyUSpMsf7zQvDMSm-2llOHnOA4DRM,1945
8
+ pyfixit/module_classifier.py,sha256=rVMBnX7b3MuhKvEUsIhIm_ejFhtCGq5s_Xgy0zizFrg,1417
9
+ pyfixit/package_mapping.py,sha256=I6wh6wsEtSwiJfR4oeoSzl8AC6ykpI6jBVIMezs8iYU,395
10
+ pyfixit/package_names.py,sha256=-QeuquPH2fsI1a6jSMRnIILQq-3GijvoxnkbyYjodws,652
11
+ pyfixit/requirements_parser.py,sha256=m-CMHrNVFng3-6o_MaMiY_kRkE5n3p4wAyCULjnMVso,1336
12
+ pyfixit_cli-0.1.0.dist-info/licenses/LICENSE,sha256=affvXa6Im__h90lD3-Vl7qCfEeVHotbGKkLfaJZmoHM,1085
13
+ pyfixit_cli-0.1.0.dist-info/METADATA,sha256=r2_UWxrimz1BMJssu4ZWY_B7QF5Md7m_FIqDln3pX3w,8070
14
+ pyfixit_cli-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
15
+ pyfixit_cli-0.1.0.dist-info/entry_points.txt,sha256=ubDjoIWw1ZbD88Jh4KuZq0DqMGUkwLhZRjWOxkRBxuo,45
16
+ pyfixit_cli-0.1.0.dist-info/top_level.txt,sha256=II0d-gKlvPjfQ4FtlY49YX5fUZ7bSBz5Tvl2tyJ9-RE,8
17
+ pyfixit_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pyfixit = pyfixit.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dhanunjay
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ pyfixit