hey why is the python dependency inferrence script...
# development
hey why is the python dependency inferrence script called
and not
? And is it the same reason it doesn't have a shebang?
My memory is a bit fuzzy but I think it had to do with the PyOxy work @ancient-vegetable-10556 was doing
That’s exactly it. importlib.resources won’t return a
file if it’s a resource (i.e. to be read as a file, and not as a module), so I needed to rename it to make it accessible as both a
(for linting by pants) and as a file resource (for loading into a sandbox)
Exceptionally obtuse, but what can you do 🤷
As for the lack of shebang, it didn’t need one when we first wrote it, and I didn’t have cause to add one when I renamed the file
ah ok, that makes sense. I think a shebang would help some IDEs infer it as python, I know Pycharm will look at the shebang and infer it as a Python file
We invoke it directly via
/path/to/python my_file.py
, so I think having a shebang would be semanticaly wrong. The idea with a shebang is you can do
I do not believe adding a shebang would impact its behaviour when Pants runs it, so feel free to add a shebang
As long as you don’t mark the file as executable 🙂
👍 1
@hundreds-father-404 I think practicality beats purity here, being able to get the IDE to realise it’s a Python file would be good, and it’s not the first egregious weirdness with how that script is set up now
@careful-address-89803 If it would help you, feel free to raise a PR and I’ll get to it later