bug: Custom plugin `path` can't be a symlink
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.
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.
Yep! Sounds reasonable to me. Makes sense on the build plugin side.