auto-code-fixer 0.3.0__tar.gz → 0.3.1__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.
Files changed (27) hide show
  1. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/PKG-INFO +1 -1
  2. auto_code_fixer-0.3.1/auto_code_fixer/__init__.py +1 -0
  3. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/auto_code_fixer/installer.py +11 -2
  4. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/auto_code_fixer.egg-info/PKG-INFO +1 -1
  5. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/pyproject.toml +1 -1
  6. auto_code_fixer-0.3.0/auto_code_fixer/__init__.py +0 -1
  7. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/LICENSE +0 -0
  8. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/README.md +0 -0
  9. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/auto_code_fixer/cli.py +0 -0
  10. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/auto_code_fixer/command_runner.py +0 -0
  11. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/auto_code_fixer/fixer.py +0 -0
  12. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/auto_code_fixer/models.py +0 -0
  13. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/auto_code_fixer/patcher.py +0 -0
  14. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/auto_code_fixer/plan.py +0 -0
  15. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/auto_code_fixer/runner.py +0 -0
  16. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/auto_code_fixer/sandbox.py +0 -0
  17. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/auto_code_fixer/traceback_utils.py +0 -0
  18. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/auto_code_fixer/utils.py +0 -0
  19. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/auto_code_fixer/venv_manager.py +0 -0
  20. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/auto_code_fixer.egg-info/SOURCES.txt +0 -0
  21. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/auto_code_fixer.egg-info/dependency_links.txt +0 -0
  22. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/auto_code_fixer.egg-info/entry_points.txt +0 -0
  23. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/auto_code_fixer.egg-info/requires.txt +0 -0
  24. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/auto_code_fixer.egg-info/top_level.txt +0 -0
  25. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/setup.cfg +0 -0
  26. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/tests/test_fix_imported_file.py +0 -0
  27. {auto_code_fixer-0.3.0 → auto_code_fixer-0.3.1}/tests/test_internal_imports.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: auto-code-fixer
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Automatically fix Python code using ChatGPT
5
5
  Author-email: Arif Shah <ashah7775@gmail.com>
6
6
  License: MIT
@@ -0,0 +1 @@
1
+ __version__ = "0.3.1"
@@ -4,6 +4,15 @@ import subprocess
4
4
 
5
5
  _MISSING_RE = re.compile(r"No module named '([^']+)'")
6
6
 
7
+ # common import-name -> pip-package mappings
8
+ IMPORT_TO_PIP = {
9
+ "PIL": "Pillow",
10
+ "cv2": "opencv-python",
11
+ "sklearn": "scikit-learn",
12
+ "yaml": "PyYAML",
13
+ "Crypto": "pycryptodome",
14
+ }
15
+
7
16
 
8
17
  def parse_missing_module(stderr: str) -> str | None:
9
18
  m = _MISSING_RE.search(stderr or "")
@@ -43,5 +52,5 @@ def check_and_install_missing_lib(stderr: str, *, python_exe: str, project_root:
43
52
  if is_local_module(lib, project_root=project_root):
44
53
  return False
45
54
 
46
- # naive mapping; user can always fix the requirement name manually.
47
- return install_package(lib, python_exe=python_exe)
55
+ pkg = IMPORT_TO_PIP.get(lib, lib)
56
+ return install_package(pkg, python_exe=python_exe)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: auto-code-fixer
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Automatically fix Python code using ChatGPT
5
5
  Author-email: Arif Shah <ashah7775@gmail.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "auto-code-fixer"
7
- version = "0.3.0"
7
+ version = "0.3.1"
8
8
  description = "Automatically fix Python code using ChatGPT"
9
9
  readme = "README.md"
10
10
 
@@ -1 +0,0 @@
1
- __version__ = "0.3.0"
File without changes