Skip to content
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

bug: Custom plugin path can't be a symlink #1476

Open
johnpyp opened this issue May 9, 2024 · 2 comments
Open

bug: Custom plugin path can't be a symlink #1476

johnpyp opened this issue May 9, 2024 · 2 comments

Comments

@johnpyp
Copy link

johnpyp commented May 9, 2024

Currently, the custom plugins that allow for easy local plugin usage check to make sure that the plugin file is a real file, excluding symlinks, e.g here: https://github.com/pypa/hatch/blob/master/src/hatch/env/collectors/custom.py#L31

Seems like an easy fix, though I don't know if there would be any other negative effects from allowing symlinks here without other handling.


To replicate, symlink some plugin (e.g an environment collector plugin) to some other path (e.g my_plugin.py), and set the path:

[tool.hatch.env.collectors.custom]
path = "./my_plugin.py"

This will fail with "Plugin script does not exist", as expected given the file-checking logic currently.

@ofek
Copy link
Sponsor Collaborator

ofek commented May 9, 2024

Thanks! We wouldn't be able to do this for custom build plugins because those get packaged into the source distribution and then when building from that weird stuff might happen but this seems relatively innocuous.

Should that be changed to just exists? My intention is to also make sure that it is not a directory if it exists.

@johnpyp
Copy link
Author

johnpyp commented May 10, 2024

Yep! Sounds reasonable to me. Makes sense on the build plugin side.

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

No branches or pull requests

2 participants