Skip to content

fix: resolve editable installation issue for python package #1989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025

Conversation

senyai
Copy link
Contributor

@senyai senyai commented May 20, 2025

Before this pip install -e . produced error: [Errno 2] No such file or directory: '/tmp/tmpi02jtn4q.build-lib/google_benchmark/_benchmark.pyi'

Second try of #1987. I hope code makes more sense now. Yes, _benchmark.pyi, _benchmark.so and py.typed go to the source tree, but this is how it is supposed to work.

@dmah42
Copy link
Member

dmah42 commented May 21, 2025

looks like a linter issue that needs resolving @senyai

Before this `pip install -e .` produced ` error: [Errno 2] No such file or directory: '/tmp/tmpi02jtn4q.build-lib/google_benchmark/_benchmark.pyi'`
@senyai senyai force-pushed the senyai-pip-install branch from 79b4cf3 to 00af678 Compare May 21, 2025 11:17
@dmah42 dmah42 merged commit d24860f into google:main May 21, 2025
84 checks passed
libdir = Path(self.build_lib) / pkgname
else:
build_py = self.get_finalized_command("build_py")
libdir = build_py.get_package_dir(pkgname)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested with self.inplace? This looks wrong, since get_package_dir returns a str, which would make the path concatenation in shutil.copyfile below fail, see https://github.com/pypa/setuptools/blob/main/setuptools/command/build_py.py#L275.

At minimum, I think this should be a Path(build_py.get_package_dir(pkgname)).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I tested it and it works fp in libdir / fp is Path, and 'str / Path' results in Path

@senyai senyai deleted the senyai-pip-install branch May 21, 2025 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants