python-package-folder 3.1.0__py3-none-any.whl → 3.1.1__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.
@@ -141,8 +141,9 @@ class SubfolderBuildConfig:
141
141
  result = []
142
142
  in_hatch_build = False
143
143
  in_hatch_build_section = False
144
+ in_sdist_section = False
144
145
  packages_set = False
145
- paths_exclude_set = False
146
+ only_include_set = False
146
147
 
147
148
  for line in lines:
148
149
  # Detect hatch build section
@@ -165,10 +166,20 @@ class SubfolderBuildConfig:
165
166
  # End of hatch build section
166
167
  in_hatch_build_section = False
167
168
  result.append(line)
169
+ elif line.strip().startswith("[tool.hatch.build.targets.sdist]"):
170
+ in_sdist_section = True
171
+ result.append(line)
172
+ continue
173
+ elif line.strip().startswith("[") and in_sdist_section:
174
+ # End of sdist section
175
+ in_sdist_section = False
176
+ result.append(line)
177
+ elif in_sdist_section:
178
+ # Track if only-include already exists
179
+ if re.match(r"^\s*only-include\s*=", line):
180
+ only_include_set = True
181
+ result.append(line)
168
182
  elif in_hatch_build_section:
169
- # Track if paths-exclude already exists
170
- if re.match(r"^\s*paths-exclude\s*=", line):
171
- paths_exclude_set = True
172
183
  result.append(line)
173
184
  elif in_hatch_build:
174
185
  # Modify packages path if found
@@ -209,42 +220,21 @@ class SubfolderBuildConfig:
209
220
  packages_str = f'"{correct_packages_path}"'
210
221
  result.append(f"packages = [{packages_str}]")
211
222
 
212
- # Add file exclusion patterns to prevent including non-package files
213
- # Only add if paths-exclude wasn't already set (we merged it above)
214
- if not paths_exclude_set:
223
+ # Use only-include for source distributions to ensure only the subfolder is included
224
+ # This prevents including files from the project root
225
+ if correct_packages_path and not only_include_set:
215
226
  result.append("")
216
- result.append("[tool.hatch.build]")
217
- result.append("paths-exclude = [")
218
- result.append(' ".cursor/**",')
219
- result.append(' ".github/**",')
220
- result.append(' ".vscode/**",')
221
- result.append(' ".idea/**",')
222
- result.append(' "data/**",')
223
- result.append(' "docs/**",')
224
- result.append(' "references/**",')
225
- result.append(' "reports/**",')
226
- result.append(' "scripts/**",')
227
- result.append(' "tests/**",')
228
- result.append(' "test/**",')
229
- result.append(' "dist/**",')
230
- result.append(' "build/**",')
231
- result.append(' "*.egg-info/**",')
232
- result.append(' "__pycache__/**",')
233
- result.append(' ".pytest_cache/**",')
234
- result.append(' ".mypy_cache/**",')
235
- result.append(' ".venv/**",')
236
- result.append(' "venv/**",')
237
- result.append(' ".git/**",')
238
- result.append(' ".gitignore",')
239
- result.append(' ".gitattributes",')
240
- result.append(' "Dockerfile",')
241
- result.append(' ".dockerignore",')
242
- result.append(' ".pylintrc",')
243
- result.append(' "pyrightconfig.json",')
244
- result.append(' "git-filter-repo",')
245
- result.append(' "pyproject.toml.original",')
246
- result.append(' "README.md.backup",')
247
- result.append("]")
227
+ result.append("[tool.hatch.build.targets.sdist]")
228
+ # Include only the subfolder directory and necessary files
229
+ only_include_paths = [correct_packages_path]
230
+ # Also include pyproject.toml and README if they exist
231
+ only_include_paths.append("pyproject.toml")
232
+ only_include_paths.append("README.md")
233
+ only_include_paths.append("README.rst")
234
+ only_include_paths.append("README.txt")
235
+ only_include_paths.append("README")
236
+ only_include_str = ", ".join(f'"{p}"' for p in only_include_paths)
237
+ result.append(f"only-include = [{only_include_str}]")
248
238
 
249
239
  return "\n".join(result)
250
240
 
@@ -584,41 +574,21 @@ class SubfolderBuildConfig:
584
574
  packages_str = ", ".join(f'"{p}"' for p in package_dirs)
585
575
  result.append(f"packages = [{packages_str}]")
586
576
 
587
- # Add file exclusion patterns to prevent including non-package files
588
- # This ensures only the subfolder code is included, not project root files
589
- result.append("")
590
- result.append("[tool.hatch.build]")
591
- result.append("paths-exclude = [")
592
- result.append(' ".cursor/**",')
593
- result.append(' ".github/**",')
594
- result.append(' ".vscode/**",')
595
- result.append(' ".idea/**",')
596
- result.append(' "data/**",')
597
- result.append(' "docs/**",')
598
- result.append(' "references/**",')
599
- result.append(' "reports/**",')
600
- result.append(' "scripts/**",')
601
- result.append(' "tests/**",')
602
- result.append(' "test/**",')
603
- result.append(' "dist/**",')
604
- result.append(' "build/**",')
605
- result.append(' "*.egg-info/**",')
606
- result.append(' "__pycache__/**",')
607
- result.append(' ".pytest_cache/**",')
608
- result.append(' ".mypy_cache/**",')
609
- result.append(' ".venv/**",')
610
- result.append(' "venv/**",')
611
- result.append(' ".git/**",')
612
- result.append(' ".gitignore",')
613
- result.append(' ".gitattributes",')
614
- result.append(' "Dockerfile",')
615
- result.append(' ".dockerignore",')
616
- result.append(' ".pylintrc",')
617
- result.append(' "pyrightconfig.json",')
618
- result.append(' "git-filter-repo",')
619
- result.append(' "pyproject.toml.original",')
620
- result.append(' "README.md.backup",')
621
- result.append("]")
577
+ # Use only-include for source distributions to ensure only the subfolder is included
578
+ # This prevents including files from the project root
579
+ if package_dirs:
580
+ result.append("")
581
+ result.append("[tool.hatch.build.targets.sdist]")
582
+ # Include only the subfolder directory and necessary files
583
+ only_include_paths = [package_dirs[0]]
584
+ # Also include pyproject.toml and README if they exist
585
+ only_include_paths.append("pyproject.toml")
586
+ only_include_paths.append("README.md")
587
+ only_include_paths.append("README.rst")
588
+ only_include_paths.append("README.txt")
589
+ only_include_paths.append("README")
590
+ only_include_str = ", ".join(f'"{p}"' for p in only_include_paths)
591
+ result.append(f"only-include = [{only_include_str}]")
622
592
 
623
593
  # Add dependency group if specified
624
594
  if dependency_group:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-package-folder
3
- Version: 3.1.0
3
+ Version: 3.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>
@@ -6,12 +6,12 @@ python_package_folder/manager.py,sha256=kyULmS948uW3yWUcabc2EVK_Nic3wrWMj8qCs18j
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
9
- python_package_folder/subfolder_build.py,sha256=m9a7exvDEwtz_tuNlPF_bagXtcwNq9PHiJswVkbn2PM,39866
9
+ python_package_folder/subfolder_build.py,sha256=oH_KKLJIMByUZCl8y3AyohUO6Om0OvsIQ7Xg1fkd3jE,38782
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-3.1.0.dist-info/METADATA,sha256=qNQ9k_yP2w7Tyxo6F8btfZRCckzheWU4HN78ETtGpaY,33282
14
- python_package_folder-3.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
15
- python_package_folder-3.1.0.dist-info/entry_points.txt,sha256=ttu4wAhoYSHGhWQNercLz9IVTTpXxhVlRA9vSTvaLe0,91
16
- python_package_folder-3.1.0.dist-info/licenses/LICENSE,sha256=vNgRJh8YiecqZoZld7TtwPI5I72HIymKD9g32fiJjCE,1073
17
- python_package_folder-3.1.0.dist-info/RECORD,,
13
+ python_package_folder-3.1.1.dist-info/METADATA,sha256=ccaosiXpsDgxQyy6UYHLYj34BKnrosnLbvFBjh18kNY,33282
14
+ python_package_folder-3.1.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
15
+ python_package_folder-3.1.1.dist-info/entry_points.txt,sha256=ttu4wAhoYSHGhWQNercLz9IVTTpXxhVlRA9vSTvaLe0,91
16
+ python_package_folder-3.1.1.dist-info/licenses/LICENSE,sha256=vNgRJh8YiecqZoZld7TtwPI5I72HIymKD9g32fiJjCE,1073
17
+ python_package_folder-3.1.1.dist-info/RECORD,,