python-package-folder 2.0.6__py3-none-any.whl → 2.0.7__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.
- python_package_folder/analyzer.py +53 -0
- python_package_folder/manager.py +6 -4
- {python_package_folder-2.0.6.dist-info → python_package_folder-2.0.7.dist-info}/METADATA +1 -1
- {python_package_folder-2.0.6.dist-info → python_package_folder-2.0.7.dist-info}/RECORD +7 -7
- {python_package_folder-2.0.6.dist-info → python_package_folder-2.0.7.dist-info}/WHEEL +0 -0
- {python_package_folder-2.0.6.dist-info → python_package_folder-2.0.7.dist-info}/entry_points.txt +0 -0
- {python_package_folder-2.0.6.dist-info → python_package_folder-2.0.7.dist-info}/licenses/LICENSE +0 -0
|
@@ -328,6 +328,59 @@ class ImportAnalyzer:
|
|
|
328
328
|
if potential_file.exists():
|
|
329
329
|
return potential_file
|
|
330
330
|
|
|
331
|
+
# Check all subdirectories in parent (not just common ones)
|
|
332
|
+
# This handles cases like src/data/spreadsheet_creation/spreadsheet_formatting_dataclasses.py
|
|
333
|
+
if parent.is_dir():
|
|
334
|
+
try:
|
|
335
|
+
for subdir in parent.iterdir():
|
|
336
|
+
if not subdir.is_dir():
|
|
337
|
+
continue
|
|
338
|
+
# Skip common excluded patterns
|
|
339
|
+
if subdir.name.startswith("_SS") or subdir.name.startswith("__SS"):
|
|
340
|
+
continue
|
|
341
|
+
# Check if module file exists directly in subdirectory
|
|
342
|
+
potential_subdir_file = subdir / f"{module_name.split('.')[-1]}.py"
|
|
343
|
+
if potential_subdir_file.exists():
|
|
344
|
+
return potential_subdir_file
|
|
345
|
+
# Check if module directory exists in subdirectory
|
|
346
|
+
potential_subdir_module = subdir / module_name.replace(".", "/")
|
|
347
|
+
if (
|
|
348
|
+
potential_subdir_module.is_dir()
|
|
349
|
+
and (potential_subdir_module / "__init__.py").exists()
|
|
350
|
+
):
|
|
351
|
+
return potential_subdir_module / "__init__.py"
|
|
352
|
+
if potential_subdir_module.with_suffix(".py").is_file():
|
|
353
|
+
return potential_subdir_module.with_suffix(".py")
|
|
354
|
+
# Check nested subdirectories (e.g., data/spreadsheet_creation)
|
|
355
|
+
# Recursively check subdirectories up to 2 levels deep
|
|
356
|
+
try:
|
|
357
|
+
for nested_subdir in subdir.iterdir():
|
|
358
|
+
if not nested_subdir.is_dir():
|
|
359
|
+
continue
|
|
360
|
+
# Check if module file exists in nested subdirectory
|
|
361
|
+
potential_nested_file = (
|
|
362
|
+
nested_subdir / f"{module_name.split('.')[-1]}.py"
|
|
363
|
+
)
|
|
364
|
+
if potential_nested_file.exists():
|
|
365
|
+
return potential_nested_file
|
|
366
|
+
# Check if module directory exists in nested subdirectory
|
|
367
|
+
potential_nested_module = nested_subdir / module_name.replace(
|
|
368
|
+
".", "/"
|
|
369
|
+
)
|
|
370
|
+
if (
|
|
371
|
+
potential_nested_module.is_dir()
|
|
372
|
+
and (potential_nested_module / "__init__.py").exists()
|
|
373
|
+
):
|
|
374
|
+
return potential_nested_module / "__init__.py"
|
|
375
|
+
if potential_nested_module.with_suffix(".py").is_file():
|
|
376
|
+
return potential_nested_module.with_suffix(".py")
|
|
377
|
+
except (OSError, PermissionError):
|
|
378
|
+
# Skip nested directories we can't read
|
|
379
|
+
continue
|
|
380
|
+
except (OSError, PermissionError):
|
|
381
|
+
# Skip directories we can't read
|
|
382
|
+
continue
|
|
383
|
+
|
|
331
384
|
# Check common subdirectories in parent (e.g., _shared, shared, common)
|
|
332
385
|
# This handles cases like src/_shared/better_enum.py
|
|
333
386
|
common_subdirs = ["_shared", "shared", "common", "_common"]
|
python_package_folder/manager.py
CHANGED
|
@@ -563,21 +563,23 @@ class BuildManager:
|
|
|
563
563
|
# Fallback to using the import name
|
|
564
564
|
third_party_packages.add(root_module)
|
|
565
565
|
# If it's ambiguous or unresolved, and not stdlib/local/external,
|
|
566
|
-
#
|
|
566
|
+
# only add as dependency if we can verify it's actually an installed package
|
|
567
567
|
elif imp.classification == "ambiguous" or imp.classification is None:
|
|
568
568
|
# Check if it's not a local or external module
|
|
569
569
|
if not imp.resolved_path:
|
|
570
|
+
# Try to verify it's actually an installed package before adding
|
|
570
571
|
# Check cache first
|
|
571
572
|
if root_module not in package_name_cache:
|
|
572
573
|
package_name_cache[root_module] = self._get_package_name_from_import(
|
|
573
574
|
imp.module_name
|
|
574
575
|
)
|
|
575
576
|
actual_package = package_name_cache[root_module]
|
|
577
|
+
# Only add if we can verify it's an actual installed package
|
|
578
|
+
# Don't add ambiguous imports that we can't verify
|
|
576
579
|
if actual_package:
|
|
577
580
|
third_party_packages.add(actual_package)
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
third_party_packages.add(root_module)
|
|
581
|
+
# If we can't verify it's a package, don't add it
|
|
582
|
+
# (it's likely a local file that wasn't resolved properly)
|
|
581
583
|
|
|
582
584
|
if total_files > 50:
|
|
583
585
|
print() # New line after progress indicator
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-package-folder
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.7
|
|
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>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
python_package_folder/__init__.py,sha256=DQt-uldOEKfh0MUqCvKdeNKOnpuOvpb7blYvXMyO9Wc,719
|
|
2
2
|
python_package_folder/__main__.py,sha256=a-__-VLhYw-J7S7CsHdhtEvQr3RiAZxiYDvKhKTgMX4,291
|
|
3
|
-
python_package_folder/analyzer.py,sha256=
|
|
3
|
+
python_package_folder/analyzer.py,sha256=cmTNUDCWBIh3XZ_mShlQVG1P9NN_oe3FUBTirVtYfTQ,16709
|
|
4
4
|
python_package_folder/finder.py,sha256=_LvJ9xBVKv41UK5sbwbNyKmuYjAOqUbzvZhK7NCYQF8,9130
|
|
5
|
-
python_package_folder/manager.py,sha256=
|
|
5
|
+
python_package_folder/manager.py,sha256=L-NRTUd0q-qhhEXUCPcddRyR736-GpPf2gwznmnMWDs,41268
|
|
6
6
|
python_package_folder/publisher.py,sha256=TSjdOvxvnWLbJCnduTK_xZBRfvsrq9kpEH-sfebeWkU,13507
|
|
7
7
|
python_package_folder/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
python_package_folder/python_package_folder.py,sha256=RPsqRcIy_LjzzTHdp4qdtFJ4-4xhtR_0YLIC0RlUxFo,8841
|
|
@@ -10,8 +10,8 @@ python_package_folder/subfolder_build.py,sha256=LMiJ4Ck6PW1x3hmiSK-9fDH4Q6RrHqot
|
|
|
10
10
|
python_package_folder/types.py,sha256=3yeSRR5p_3PDKEAaehW_RJ7NwJHexOIeA08bGaT1iSY,2368
|
|
11
11
|
python_package_folder/utils.py,sha256=lIkWsFKeAYAJ9TDUM99T4pUBHJVbUvCdUgkWQN-LUho,3111
|
|
12
12
|
python_package_folder/version.py,sha256=kIDP6S9trEfs9gj7lBYGxrWm4RPssRla24UtlO9Jkh4,9111
|
|
13
|
-
python_package_folder-2.0.
|
|
14
|
-
python_package_folder-2.0.
|
|
15
|
-
python_package_folder-2.0.
|
|
16
|
-
python_package_folder-2.0.
|
|
17
|
-
python_package_folder-2.0.
|
|
13
|
+
python_package_folder-2.0.7.dist-info/METADATA,sha256=6BRjE5zR5JZepndwwM6ad0rZMI_uCXa70X9qthD4bMU,33282
|
|
14
|
+
python_package_folder-2.0.7.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
15
|
+
python_package_folder-2.0.7.dist-info/entry_points.txt,sha256=ttu4wAhoYSHGhWQNercLz9IVTTpXxhVlRA9vSTvaLe0,91
|
|
16
|
+
python_package_folder-2.0.7.dist-info/licenses/LICENSE,sha256=vNgRJh8YiecqZoZld7TtwPI5I72HIymKD9g32fiJjCE,1073
|
|
17
|
+
python_package_folder-2.0.7.dist-info/RECORD,,
|
|
File without changes
|
{python_package_folder-2.0.6.dist-info → python_package_folder-2.0.7.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{python_package_folder-2.0.6.dist-info → python_package_folder-2.0.7.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|