If isort is run against a file, it will change the owner of the file to the uid/gid of the user running the command rather than the original owner of the file. It would be useful to attempt to retain original permissions. This is of particular concern when running dockerized dev containers with formatting tools installed that may run as a user other that of the host machine.
For comparison, the tool black does not appear to have this issue when run in the same contexts.
Example:
# stat -c %u:%g ./foo.py
1000:1000
# isort ./foo.py
Fixing /src/foo.py
# stat -c %u:%g ./foo.py
0:0
The expected result is the final stat returns 1000:1000.
If
isortis run against a file, it will change the owner of the file to the uid/gid of the user running the command rather than the original owner of the file. It would be useful to attempt to retain original permissions. This is of particular concern when running dockerized dev containers with formatting tools installed that may run as a user other that of the host machine.For comparison, the tool
blackdoes not appear to have this issue when run in the same contexts.Example:
The expected result is the final
statreturns1000:1000.