pyxl4
pyxl4 copied to clipboard
Cannot use pyxl encoding after installing with --editable
For the use case of a contributor who is going to code on pyxl
itself. The tests run fine when run with pytest
, but a file filename.py
with pyxl encoding run normally eg. with python3 filename.py
fails with the cryptic SyntaxError: encoding problem: pyxl
. When installing without --editable
, everything works normally.
- [ ] Improve the error message.
- [ ] Figure out why it's happening and fix.
Related to this issue: when you install without the editable flag, the coverage metrics don't work when you run: py.test --cov=pyxl tests
.
If I understand correctly, installing with --editable
ensures that it is found on the path. However, if it is found before the .pth
file that register that codec is found, then the codec is unrecognize. One possible solution might be to add a usercustomize.py
file to the repo that would explicitly register the codec; again, if I understand correctly, any such usercustomize.py
file found on the path would be imported before any user script. See https://docs.python.org/3/library/site.html