python-package-folder 8.2.0__py3-none-any.whl → 8.3.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.
@@ -777,6 +777,9 @@ class BuildManager:
777
777
  1. Imports of copied dependencies (e.g., `from _shared.image_utils` -> `from ._shared.image_utils`)
778
778
  2. Imports of local files within the subfolder (e.g., `from detect_empty_drawings_utils` -> `from .detect_empty_drawings_utils`)
779
779
 
780
+ Only imports classified as "external" or "local" are converted. Imports classified
781
+ as "ambiguous", "third_party", or "stdlib" are left unchanged.
782
+
780
783
  Args:
781
784
  python_files: List of Python files in the source directory
782
785
  external_deps: List of external dependencies that were copied
@@ -784,6 +787,9 @@ class BuildManager:
784
787
  import ast
785
788
  import re
786
789
 
790
+ # Create analyzer for classifying imports
791
+ analyzer = ImportAnalyzer(self.project_root)
792
+
787
793
  # Build a set of import names that were copied
788
794
  copied_import_names: set[str] = set()
789
795
  for dep in external_deps:
@@ -838,7 +844,22 @@ class BuildManager:
838
844
  if node.module is None:
839
845
  continue
840
846
 
847
+ # Classify the import to determine if it should be converted
848
+ import_info = ImportInfo(
849
+ module_name=node.module,
850
+ import_type="from",
851
+ line_number=node.lineno,
852
+ file_path=file_path,
853
+ )
854
+ analyzer.classify_import(import_info, self.src_dir)
855
+
856
+ # Only convert imports classified as "external" or "local"
857
+ # Skip ambiguous, third_party, and stdlib imports
858
+ if import_info.classification not in ("external", "local"):
859
+ continue
860
+
841
861
  # Check if this import matches a copied dependency or a local file
862
+ # (additional safety check, but classification takes precedence)
842
863
  root_module = node.module.split(".")[0]
843
864
  is_copied_dependency = (
844
865
  root_module in copied_import_names or node.module in copied_import_names
@@ -874,6 +895,22 @@ class BuildManager:
874
895
  elif isinstance(node, ast.Import):
875
896
  # Handle "import X" statements
876
897
  for alias in node.names:
898
+ # Classify the import to determine if it should be converted
899
+ import_info = ImportInfo(
900
+ module_name=alias.name,
901
+ import_type="import",
902
+ line_number=node.lineno,
903
+ file_path=file_path,
904
+ )
905
+ analyzer.classify_import(import_info, self.src_dir)
906
+
907
+ # Only convert imports classified as "external" or "local"
908
+ # Skip ambiguous, third_party, and stdlib imports
909
+ if import_info.classification not in ("external", "local"):
910
+ continue
911
+
912
+ # Check if this import matches a copied dependency or a local file
913
+ # (additional safety check, but classification takes precedence)
877
914
  root_module = alias.name.split(".")[0]
878
915
  is_copied_dependency = root_module in copied_import_names
879
916
  is_local_file = root_module in local_file_names
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-package-folder
3
- Version: 8.2.0
3
+ Version: 8.3.0
4
4
  Summary: Python package to automatically package and build a folder, fetching all relevant dependencies.
5
5
  Project-URL: Repository, https://github.com/alelom/python-package-folder
6
6
  Author-email: Alessio Lombardi <work@alelom.com>
@@ -2,7 +2,7 @@ python_package_folder/__init__.py,sha256=DQt-uldOEKfh0MUqCvKdeNKOnpuOvpb7blYvXMy
2
2
  python_package_folder/__main__.py,sha256=a-__-VLhYw-J7S7CsHdhtEvQr3RiAZxiYDvKhKTgMX4,291
3
3
  python_package_folder/analyzer.py,sha256=8DCc5AaVpYF9qh8NbMJ5igeW5AVYnQqy_XqRtl16ZLc,15981
4
4
  python_package_folder/finder.py,sha256=wChaKPcku_U9LBQD2i6xIEKmUsKQzVUpO6H2cnxqPTE,13089
5
- python_package_folder/manager.py,sha256=znZMn6BjXy6BlIgBCfPhDyNQMXcrF8pUfkiCDfW9ZXI,63375
5
+ python_package_folder/manager.py,sha256=DMuTL2RhRQRx8-OOEunVgoRZ7w4yXTmpBnCVl51s_Sw,65408
6
6
  python_package_folder/publisher.py,sha256=fmf3l0zMY9CD49gurxlXyvm9mOP0FzDjmiSt0yDqt1M,18813
7
7
  python_package_folder/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  python_package_folder/python_package_folder.py,sha256=QZ-vdOZ40wF-eGbp39JotDhMwIhhT3Z_sC5obQj3i4s,17024
@@ -11,8 +11,8 @@ python_package_folder/types.py,sha256=3yeSRR5p_3PDKEAaehW_RJ7NwJHexOIeA08bGaT1iS
11
11
  python_package_folder/utils.py,sha256=b6Ukcc0fctXdxS5zhGLS86kqn0vz1yOEK7XjCY9fjfY,5621
12
12
  python_package_folder/version.py,sha256=kIDP6S9trEfs9gj7lBYGxrWm4RPssRla24UtlO9Jkh4,9111
13
13
  python_package_folder/version_calculator.py,sha256=_gcc8IbMjt27UxePcc7RZlFTMCG3AGnRI_-Mp_4qRG0,39568
14
- python_package_folder-8.2.0.dist-info/METADATA,sha256=Up5d-XslEXQZOjv1od0o9qwqzp1VqWekDIIHHxNR-Ro,7838
15
- python_package_folder-8.2.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
16
- python_package_folder-8.2.0.dist-info/entry_points.txt,sha256=ttu4wAhoYSHGhWQNercLz9IVTTpXxhVlRA9vSTvaLe0,91
17
- python_package_folder-8.2.0.dist-info/licenses/LICENSE,sha256=vNgRJh8YiecqZoZld7TtwPI5I72HIymKD9g32fiJjCE,1073
18
- python_package_folder-8.2.0.dist-info/RECORD,,
14
+ python_package_folder-8.3.0.dist-info/METADATA,sha256=4zxtwkzaae2NQh0D1fCaH18q8g6Ma-HLFE-OaJk8Bq8,7838
15
+ python_package_folder-8.3.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
16
+ python_package_folder-8.3.0.dist-info/entry_points.txt,sha256=ttu4wAhoYSHGhWQNercLz9IVTTpXxhVlRA9vSTvaLe0,91
17
+ python_package_folder-8.3.0.dist-info/licenses/LICENSE,sha256=vNgRJh8YiecqZoZld7TtwPI5I72HIymKD9g32fiJjCE,1073
18
+ python_package_folder-8.3.0.dist-info/RECORD,,