You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you very much for this cool tool! This seems to be a regression from isort 4. I use isort integrated with my text editor, which means I send the file contents via stdin. In the past, isort was able to use the .isort.cfg in the current directory, but that doesn't seem to be the case anymore.
% isort --version
/#######################################################################\
`sMMy`
.yyyy- `
##soos## ./o.
` ``..-..` ``...`.`` ` ```` ``-ssso```
.s:-y- .+osssssso/. ./ossss+:so+:` :+o-`/osso:+sssssssso/
.s::y- osss+.``.`` -ssss+-.`-ossso` ssssso/::..::+ssss:::.
.s::y- /ssss+//:-.` `ssss+ `ssss+ sssso` :ssss`
.s::y- `-/+oossssso/ `ssss/ sssso ssss/ :ssss`
.y-/y- ````:ssss` ossso. :ssss: ssss/ :ssss.
`/so:` `-//::/osss+ `+ssss+-/ossso: /sso- `osssso/.
\/ `-/oooo++/- .:/++:/++/-` .. `://++/.
isort your Python imports for you so you don't have to
VERSION 4.3.21
\########################################################################/
% cat file.py | isort -
from os.path import abspath
from os.path import dirname
from os.path import join
print(join(abspath(dirname(__file__)), "some", "thing"))
With isort 5.0.4:
% isort --version
_ _
(_) ___ ___ _ __| |_
| |/ _/ / _ \/ '__ _/
| |\__ \/\_\/| | | |_
|_|\___/\___/\_/ \_/
isort your imports, so you don't have to.
VERSION 5.0.4
% cat file.py | isort -
from os.path import abspath, dirname, join
print(join(abspath(dirname(__file__)), "some", "thing"))
It works if I pass the file as parameter though:
% isort -d file.py
from os.path import abspath
from os.path import dirname
from os.path import join
print(join(abspath(dirname(__file__)), "some", "thing"))
Is there a way to either (1) start the search from the current directory (like isort 4 did) or (2) allow users to pass the file path when formatting stdin (similar to prettier's --stdin-filepath)
The text was updated successfully, but these errors were encountered:
fsouza
added a commit
to fsouza/dotfiles
that referenced
this issue
Jul 7, 2020
Thanks for reporting! I've fixed this in isort 5.0.5 so that when - is used, settings are found from the current working directory. Note that isort also allows a --settings-path to be explicitly provided (and that can just be the path that the file is in, it will look up to 25 directories up from that point for a support settings file).
I just experienced this on 5.1.0 using vim's ALE. I was able to get things working again by adding let g:ale_python_isort_options = '--settings-path .', which suggests that somehow the fix hasn't taken or maybe there was a regression.
There's also an ALE issue about this, which is where I learned about the workaround, but it seems like the desired behavior is for isort to have --settings-path . when called as isort - < /tmp/foo.py. (So that issue should probably be closed. I might follow-up there if this is sorted out here.)
I'm using pyproject.toml config, if that's relevant.
I'm happy to provide more detailed info if it's useful (e.g. platform, python version).
Hi there!
Thank you very much for this cool tool! This seems to be a regression from isort 4. I use isort integrated with my text editor, which means I send the file contents via stdin. In the past, isort was able to use the .isort.cfg in the current directory, but that doesn't seem to be the case anymore.
Here's how to reproduce:
With isort 4.3.21:
With isort 5.0.4:
It works if I pass the file as parameter though:
Is there a way to either (1) start the search from the current directory (like isort 4 did) or (2) allow users to pass the file path when formatting stdin (similar to prettier's
--stdin-filepath
)The text was updated successfully, but these errors were encountered: