Skip to content

BUG: Deleting a file from an editable install #282

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

Closed

Conversation

lithomas1
Copy link
Member

@lithomas1 lithomas1 commented Jan 29, 2023

I meant to block #87 on this, but forgot.

This PR should block release of meson-python with editable wheels.

@lithomas1 lithomas1 added the bug Something isn't working label Jan 29, 2023
@lithomas1 lithomas1 requested a review from a team January 29, 2023 16:07
@lithomas1
Copy link
Member Author

Anyone up for a review?

@dnicolodi
Copy link
Member

I don't think piling hacks on top of this solution will bring a polished solution. I think the approach in #279 is much more robust. It currently handles python modules (including modules appearing and disappearing during rebuild, except at the top level). I'm working on resource file support, but piecing together what is needed from the documentation of the importlib standard lib module takes a while. I would appreciate if you could test it for your use case.

@lithomas1
Copy link
Member Author

lithomas1 commented Jan 29, 2023

I don't think piling hacks on top of this solution will bring a polished solution. I think the approach in #279 is much more robust. It currently handles python modules (including modules appearing and disappearing during rebuild, except at the top level). I'm working on resource file support, but piecing together what is needed from the documentation of the importlib standard lib module takes a while. I would appreciate if you could test it for your use case.

I would rather prefer merging this first, since I don't know when how far #279 is yet, and fixing this will allow for a release with editable wheels support (so pandas can finally adopt meson).

I also left a few comments on #279. importlib internals are not something I'm familiar with at all, so if you could clarify a couple things for me there, that'd be great.

Hopefully, this PR shouldn't mess up too much of what you're working on, since its a small ~10 LOC patch.

@@ -882,7 +884,6 @@ def build_commands(self, install_dir: Optional[pathlib.Path] = None) -> Sequence
(
'meson',
'install',
'--only-changed',
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we keep this? It's quite important, at least verbose mode is completely unusable without it.

Copy link
Member Author

@lithomas1 lithomas1 Jan 29, 2023

Choose a reason for hiding this comment

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

It doesn't do anything anymore as of this PR.

This is because we nuke the install dir before hand ( to get rid of files that shouldn't exist anymore, since they were deleted), so the destination file will never exist.

For reference, see #87 (comment).

Copy link
Member Author

Choose a reason for hiding this comment

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

It's unfortunate that we have to do this, but the only other way, I think, is to patch meson, and I don't think we should leave editable installs broken in the meantime.

Copy link
Contributor

Choose a reason for hiding this comment

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

To me, making the verbose mode effectively unusable seems worse than not cleaning up some now-unused old file (the chance of actual breakage is quite small here). So I'm ambivalent about this change.

That said, I don't use editable installs and there's further improvements in the pipeline, so I'll just register as neutral on this one; fine if others want to merge this.

Copy link
Member Author

Choose a reason for hiding this comment

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

To clarify, this old file is still importable if the directory had an init.py, which can be confusing at the very least, and maybe cause problems(I'm thinking maybe if someone did a star import?).

Comment on lines +123 to +125
if self.uninstall_old:
if os.path.exists(self.install_dir):
shutil.rmtree(self.install_dir)
Copy link
Member

Choose a reason for hiding this comment

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

I don't like this approach. IMO saving the list of previous installed files and manually deleting the ones that are not installed by Meson anymore would be a better way to deal with this.

@lithomas1 lithomas1 closed this Feb 13, 2023
@lithomas1 lithomas1 deleted the bug-editable-delete-file branch February 13, 2023 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants