hey why is the python dependency inferrence script...
# development
c
hey why is the python dependency inferrence script called
dependency_parser_py
and not
dependency_parser.py
? And is it the same reason it doesn't have a shebang?
b
My memory is a bit fuzzy but I think it had to do with the PyOxy work @ancient-vegetable-10556 was doing
a
That’s exactly it. importlib.resources won’t return a
.py
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
python_source
(for linting by pants) and as a file resource (for loading into a sandbox)
1
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
c
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
h
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
./my_file.py
instead
a
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