Closed srittau closed 5 months ago
Btw I found why py.typed
files are missing from namespace packages. The path added to package_data
is just wrong. Something like this outta do it:
top_level, *sub_packages = package.split(".")
entry_path = self.package_path(package)
entry_path.mkdir(exist_ok=True)
(entry_path / filename).write_text(file_contents)
self.package_data[top_level].append(os.path.join(*sub_packages, filename))
This issue is about refactoring that part of the code anyway. So I'll leave this here.
Currently, when building a distribution, if a py.typed file needs to be created, this happens during the
generate_setup_file()
step. The file is added to the typeshed directory and will get copied to the tmp dir during thecopy_stubs()
step. This is problematic for a few reasons:generate_setup_file()
makes no modifications. It just returns the setup.py file as a string. The exception being creating thepy.typed
file if necessary.The solution is to create a new step between
copy_stubs()
andcopy_changelog()
that creates thepy.typed
marker directly in the tmpdir. I'll send a PR after the current batch of PRs was processed.