python-package-folder 5.1.0__tar.gz → 5.1.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.
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/PKG-INFO +1 -1
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/coverage.svg +2 -2
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/pyproject.toml +1 -1
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/subfolder_build.py +155 -3
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/test_subfolder_build.py +3 -3
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/.copier-answers.yml +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/.cursor/plans/optional_version_+_semantic-release_efed88a6.plan.md +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/.cursor/plans/replace_node.js_semantic-release_with_custom_python_implementation_64e05e1a.plan.md +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/.cursor/rules/general.mdc +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/.cursor/rules/python.mdc +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/.github/workflows/ci.yml +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/.github/workflows/publish.yml +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/.gitignore +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/.vscode/settings.json +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/LICENSE +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/MANIFEST.in +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/Makefile +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/README.md +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/development.md +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/docs/DEVELOPMENT.md +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/docs/INSTALLATION.md +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/docs/PUBLISHING.md +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/docs/REFERENCE.md +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/docs/USAGE.md +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/docs/VERSION_RESOLUTION.md +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/installation.md +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/publishing.md +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/__init__.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/__main__.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/_hatch_build.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/analyzer.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/finder.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/manager.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/publisher.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/py.typed +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/python_package_folder.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/types.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/utils.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/version.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/version_calculator.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/conftest.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/folder_structure/some_globals.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/folder_structure/subfolder_to_build/README.md +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/folder_structure/subfolder_to_build/__init__.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/folder_structure/subfolder_to_build/some_function.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/folder_structure/subfolder_to_build/some_globals.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/folder_structure/utility_folder/_SS/some_superseded_file.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/folder_structure/utility_folder/some_utility.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/test_build_with_external_deps.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/test_exclude_patterns.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/test_linting.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/test_preserve_directory_structure.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/test_publisher.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/test_shared_subdirectory_imports.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/test_spreadsheet_creation_imports.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/test_third_party_dependencies.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/test_utils.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/test_version_calculator.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/test_version_manager.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/tests.py +0 -0
- {python_package_folder-5.1.0 → python_package_folder-5.1.1}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-package-folder
|
|
3
|
-
Version: 5.1.
|
|
3
|
+
Version: 5.1.1
|
|
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>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
|
15
15
|
<text x="31.5" y="15" fill="#010101" fill-opacity=".3">coverage</text>
|
|
16
16
|
<text x="31.5" y="14">coverage</text>
|
|
17
|
-
<text x="81" y="15" fill="#010101" fill-opacity=".3">
|
|
18
|
-
<text x="81" y="14">
|
|
17
|
+
<text x="81" y="15" fill="#010101" fill-opacity=".3">63%</text>
|
|
18
|
+
<text x="81" y="14">63%</text>
|
|
19
19
|
</g>
|
|
20
20
|
</svg>
|
|
@@ -205,13 +205,80 @@ class SubfolderBuildConfig:
|
|
|
205
205
|
has_build_system = any(line.strip().startswith("[build-system]") for line in result)
|
|
206
206
|
if not has_build_system:
|
|
207
207
|
# Insert build-system at the very beginning of the file
|
|
208
|
+
# Include python-package-folder in requires so the build hook is available
|
|
208
209
|
build_system_lines = [
|
|
209
210
|
"[build-system]",
|
|
210
|
-
'requires = ["hatchling"]',
|
|
211
|
+
'requires = ["hatchling", "python-package-folder"]',
|
|
211
212
|
'build-backend = "hatchling.build"',
|
|
212
213
|
"",
|
|
213
214
|
]
|
|
214
215
|
result = build_system_lines + result
|
|
216
|
+
else:
|
|
217
|
+
# Ensure python-package-folder is in requires for build hook availability
|
|
218
|
+
in_build_system = False
|
|
219
|
+
for i, line in enumerate(result):
|
|
220
|
+
if line.strip().startswith("[build-system]"):
|
|
221
|
+
in_build_system = True
|
|
222
|
+
elif in_build_system and line.strip().startswith("requires"):
|
|
223
|
+
# Check if python-package-folder is already in requires
|
|
224
|
+
if "python-package-folder" not in line:
|
|
225
|
+
# Add python-package-folder to requires
|
|
226
|
+
if "]" in line:
|
|
227
|
+
# Single-line requires
|
|
228
|
+
result[i] = line.rstrip().rstrip("]") + ', "python-package-folder"]'
|
|
229
|
+
else:
|
|
230
|
+
# Multi-line requires, find the closing bracket
|
|
231
|
+
for j in range(i + 1, len(result)):
|
|
232
|
+
if "]" in result[j]:
|
|
233
|
+
# Insert before closing
|
|
234
|
+
# Determine indentation from the previous line (last item in list)
|
|
235
|
+
if j > i + 1:
|
|
236
|
+
# Look at the previous line to get indentation
|
|
237
|
+
prev_line = result[j - 1]
|
|
238
|
+
# Extract leading whitespace from previous line
|
|
239
|
+
indent = len(prev_line) - len(prev_line.lstrip())
|
|
240
|
+
indent_str = " " * indent
|
|
241
|
+
else:
|
|
242
|
+
# Fallback: use standard 4-space indent
|
|
243
|
+
indent_str = " "
|
|
244
|
+
result.insert(j, f'{indent_str}"python-package-folder",')
|
|
245
|
+
break
|
|
246
|
+
break
|
|
247
|
+
elif in_build_system and line.strip().startswith("[") and not line.strip().startswith("[build-system"):
|
|
248
|
+
# End of build-system section
|
|
249
|
+
break
|
|
250
|
+
|
|
251
|
+
# Register the build hook to enable exclude patterns
|
|
252
|
+
build_hook_registered = any(
|
|
253
|
+
"[tool.hatch.build.hooks.custom]" in line for line in result
|
|
254
|
+
)
|
|
255
|
+
if not build_hook_registered:
|
|
256
|
+
# Add build hook registration after [tool.hatch.build.targets.wheel] section
|
|
257
|
+
hook_insert_index = len(result)
|
|
258
|
+
for i, line in enumerate(result):
|
|
259
|
+
if line.strip().startswith("[tool.hatch.build.targets.wheel]"):
|
|
260
|
+
# Find the end of this section
|
|
261
|
+
for j in range(i + 1, len(result)):
|
|
262
|
+
if result[j].strip().startswith("[") and not result[j].strip().startswith(
|
|
263
|
+
"[tool.hatch.build.targets"
|
|
264
|
+
):
|
|
265
|
+
hook_insert_index = j
|
|
266
|
+
break
|
|
267
|
+
if hook_insert_index == len(result):
|
|
268
|
+
# Insert after packages line if section continues
|
|
269
|
+
for j in range(i + 1, len(result)):
|
|
270
|
+
if result[j].strip().startswith("["):
|
|
271
|
+
hook_insert_index = j
|
|
272
|
+
break
|
|
273
|
+
break
|
|
274
|
+
|
|
275
|
+
# Insert build hook registration
|
|
276
|
+
hook_lines = [
|
|
277
|
+
"",
|
|
278
|
+
"[tool.hatch.build.hooks.custom]",
|
|
279
|
+
'path = "python_package_folder._hatch_build:CustomBuildHook"',
|
|
280
|
+
]
|
|
281
|
+
result[hook_insert_index:hook_insert_index] = hook_lines
|
|
215
282
|
|
|
216
283
|
# Ensure hatch build section exists if packages path is needed
|
|
217
284
|
if not packages_set and correct_packages_path:
|
|
@@ -570,13 +637,54 @@ class SubfolderBuildConfig:
|
|
|
570
637
|
has_build_system = any(line.strip().startswith("[build-system]") for line in result)
|
|
571
638
|
if not has_build_system:
|
|
572
639
|
# Insert build-system at the very beginning of the file
|
|
640
|
+
# Include python-package-folder in requires so the build hook is available
|
|
573
641
|
build_system_lines = [
|
|
574
642
|
"[build-system]",
|
|
575
|
-
'requires = ["hatchling"]',
|
|
643
|
+
'requires = ["hatchling", "python-package-folder"]',
|
|
576
644
|
'build-backend = "hatchling.build"',
|
|
577
645
|
"",
|
|
578
646
|
]
|
|
579
647
|
result = build_system_lines + result
|
|
648
|
+
else:
|
|
649
|
+
# Ensure python-package-folder is in requires for build hook availability
|
|
650
|
+
in_build_system = False
|
|
651
|
+
requires_modified = False
|
|
652
|
+
for i, line in enumerate(result):
|
|
653
|
+
if line.strip().startswith("[build-system]"):
|
|
654
|
+
in_build_system = True
|
|
655
|
+
elif in_build_system and line.strip().startswith("requires"):
|
|
656
|
+
# Check if python-package-folder is already in requires
|
|
657
|
+
if "python-package-folder" not in line:
|
|
658
|
+
# Add python-package-folder to requires
|
|
659
|
+
if "]" in line:
|
|
660
|
+
# Single-line requires (may have closing bracket on same line)
|
|
661
|
+
if line.strip().endswith("]"):
|
|
662
|
+
result[i] = line.rstrip().rstrip("]") + ', "python-package-folder"]'
|
|
663
|
+
else:
|
|
664
|
+
# Closing bracket might be on same line but not at end
|
|
665
|
+
result[i] = line.rstrip().rstrip("]") + ', "python-package-folder"]'
|
|
666
|
+
else:
|
|
667
|
+
# Multi-line requires, find the closing bracket
|
|
668
|
+
for j in range(i + 1, len(result)):
|
|
669
|
+
if "]" in result[j]:
|
|
670
|
+
# Insert before closing
|
|
671
|
+
# Determine indentation from the previous line (last item in list)
|
|
672
|
+
if j > i + 1:
|
|
673
|
+
# Look at the previous line to get indentation
|
|
674
|
+
prev_line = result[j - 1]
|
|
675
|
+
# Extract leading whitespace from previous line
|
|
676
|
+
indent = len(prev_line) - len(prev_line.lstrip())
|
|
677
|
+
indent_str = " " * indent
|
|
678
|
+
else:
|
|
679
|
+
# Fallback: use standard 4-space indent
|
|
680
|
+
indent_str = " "
|
|
681
|
+
result.insert(j, f'{indent_str}"python-package-folder",')
|
|
682
|
+
break
|
|
683
|
+
requires_modified = True
|
|
684
|
+
break
|
|
685
|
+
elif in_build_system and line.strip().startswith("[") and not line.strip().startswith("[build-system"):
|
|
686
|
+
# End of build-system section
|
|
687
|
+
break
|
|
580
688
|
|
|
581
689
|
# Ensure packages is always set for subfolder builds
|
|
582
690
|
if not packages_set and package_dirs:
|
|
@@ -587,6 +695,50 @@ class SubfolderBuildConfig:
|
|
|
587
695
|
packages_str = ", ".join(f'"{p}"' for p in package_dirs)
|
|
588
696
|
result.append(f"packages = [{packages_str}]")
|
|
589
697
|
|
|
698
|
+
# Register the build hook to enable exclude patterns
|
|
699
|
+
# Always register the build hook if exclude patterns are present, or if we want to support them
|
|
700
|
+
# Check if build hook is already registered
|
|
701
|
+
build_hook_registered = any(
|
|
702
|
+
"[tool.hatch.build.hooks.custom]" in line for line in result
|
|
703
|
+
)
|
|
704
|
+
|
|
705
|
+
if not build_hook_registered:
|
|
706
|
+
# Add build hook registration after [tool.hatch.build.targets.wheel] section
|
|
707
|
+
hook_insert_index = len(result)
|
|
708
|
+
wheel_section_found = False
|
|
709
|
+
for i, line in enumerate(result):
|
|
710
|
+
if line.strip().startswith("[tool.hatch.build.targets.wheel]"):
|
|
711
|
+
wheel_section_found = True
|
|
712
|
+
# Find the end of this section
|
|
713
|
+
for j in range(i + 1, len(result)):
|
|
714
|
+
if result[j].strip().startswith("[") and not result[j].strip().startswith(
|
|
715
|
+
"[tool.hatch.build.targets"
|
|
716
|
+
):
|
|
717
|
+
hook_insert_index = j
|
|
718
|
+
break
|
|
719
|
+
if hook_insert_index == len(result):
|
|
720
|
+
# Insert after packages line if section continues
|
|
721
|
+
for j in range(i + 1, len(result)):
|
|
722
|
+
if result[j].strip().startswith("["):
|
|
723
|
+
hook_insert_index = j
|
|
724
|
+
break
|
|
725
|
+
break
|
|
726
|
+
|
|
727
|
+
# If wheel section not found, insert before sdist section or at end
|
|
728
|
+
if not wheel_section_found:
|
|
729
|
+
for i, line in enumerate(result):
|
|
730
|
+
if line.strip().startswith("[tool.hatch.build.targets.sdist]"):
|
|
731
|
+
hook_insert_index = i
|
|
732
|
+
break
|
|
733
|
+
|
|
734
|
+
# Insert build hook registration
|
|
735
|
+
hook_lines = [
|
|
736
|
+
"",
|
|
737
|
+
"[tool.hatch.build.hooks.custom]",
|
|
738
|
+
'path = "python_package_folder._hatch_build:CustomBuildHook"',
|
|
739
|
+
]
|
|
740
|
+
result[hook_insert_index:hook_insert_index] = hook_lines
|
|
741
|
+
|
|
590
742
|
# Use only-include for source distributions to ensure only the subfolder is included
|
|
591
743
|
# This prevents including files from the project root
|
|
592
744
|
if package_dirs:
|
|
@@ -1011,4 +1163,4 @@ class SubfolderBuildConfig:
|
|
|
1011
1163
|
|
|
1012
1164
|
def __exit__(self, exc_type, exc_val, exc_tb) -> None: # noqa: ARG002
|
|
1013
1165
|
"""Context manager exit - always restore."""
|
|
1014
|
-
self.restore()
|
|
1166
|
+
self.restore()
|
|
@@ -661,7 +661,7 @@ class TestSubfolderBuildTemporaryPyprojectCreation:
|
|
|
661
661
|
|
|
662
662
|
# Verify build-system section is added (required for hatchling)
|
|
663
663
|
assert "[build-system]" in content
|
|
664
|
-
assert 'requires = ["hatchling"]' in content
|
|
664
|
+
assert 'requires = ["hatchling", "python-package-folder"]' in content
|
|
665
665
|
assert 'build-backend = "hatchling.build"' in content
|
|
666
666
|
assert "[tool.hatch.version]" not in content
|
|
667
667
|
assert "[tool.uv-dynamic-versioning]" not in content
|
|
@@ -894,7 +894,7 @@ description = "Subfolder package"
|
|
|
894
894
|
|
|
895
895
|
# Verify build-system section uses hatchling, not setuptools
|
|
896
896
|
assert "[build-system]" in content
|
|
897
|
-
assert 'requires = ["hatchling"]' in content
|
|
897
|
+
assert 'requires = ["hatchling", "python-package-folder"]' in content
|
|
898
898
|
assert 'build-backend = "hatchling.build"' in content
|
|
899
899
|
assert "setuptools" not in content or 'build-backend = "setuptools' not in content
|
|
900
900
|
|
|
@@ -929,7 +929,7 @@ description = "Subfolder package"
|
|
|
929
929
|
|
|
930
930
|
# Verify build-system section is added
|
|
931
931
|
assert "[build-system]" in content
|
|
932
|
-
assert 'requires = ["hatchling"]' in content
|
|
932
|
+
assert 'requires = ["hatchling", "python-package-folder"]' in content
|
|
933
933
|
assert 'build-backend = "hatchling.build"' in content
|
|
934
934
|
|
|
935
935
|
config.restore()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/__init__.py
RENAMED
|
File without changes
|
{python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/__main__.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/analyzer.py
RENAMED
|
File without changes
|
{python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/finder.py
RENAMED
|
File without changes
|
{python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/manager.py
RENAMED
|
File without changes
|
{python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/publisher.py
RENAMED
|
File without changes
|
{python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
{python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/types.py
RENAMED
|
File without changes
|
{python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/utils.py
RENAMED
|
File without changes
|
{python_package_folder-5.1.0 → python_package_folder-5.1.1}/src/python_package_folder/version.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/folder_structure/some_globals.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/test_build_with_external_deps.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/test_third_party_dependencies.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_package_folder-5.1.0 → python_package_folder-5.1.1}/tests/test_version_calculator.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|