Closed pums974 closed 3 years ago
I have noticed the same thing happening this side.
@pums974 and @grant-zietsman I'm so sorry this broke for both of you! Can you try the latest version from github and see if it is still an issue? pip install git+https://github.com/PyCQA/isort.git
. Additionally, are either of you willing to share more information about how your settings are set providing the output of isort . --show-config
?
Yeah no problem
I just realize that with skip_gitignore = false
, everything seems to be working OK
And I have the same results the current git version (15234f8)
I ran this with the latest version (installed from git) and these are the results that I am seeing.
I also have this issue with isort 5.9.1. I installed the latest version ( 23d708e ) from git & the issue persisted.
{
"_known_patterns": null,
"_section_comments": null,
"_skips": null,
"_skip_globs": null,
"_sorting_function": null,
"py_version": "py3",
"force_to_top": [],
"skip": [
"environment.py"
],
"extend_skip": [],
"skip_glob": [],
"extend_skip_glob": [],
"skip_gitignore": true,
"line_length": 88,
"wrap_length": 0,
"line_ending": "",
"sections": [
"FUTURE",
"STDLIB",
"THIRDPARTY",
"FIRSTPARTY",
"LOCALFOLDER"
],
"no_sections": false,
"known_future_library": [
"__future__"
],
"known_third_party": [],
"known_first_party": [],
"known_local_folder": [],
"known_standard_library": [
"zoneinfo",
"syslog",
"lib2to3",
"getpass",
"xml",
"imghdr",
"turtle",
"graphlib",
"time",
"tkinter",
"binhex",
"rlcompleter",
"xdrlib",
"datetime",
"socketserver",
"mimetypes",
"keyword",
"array",
"lzma",
"select",
"sunau",
"chunk",
"functools",
"imaplib",
"venv",
"bz2",
"types",
"sched",
"getopt",
"stringprep",
"gzip",
"codeop",
"gettext",
"traceback",
"webbrowser",
"io",
"ensurepip",
"bisect",
"curses",
"sre_compile",
"os",
"copyreg",
"ast",
"poplib",
"py_compile",
"bdb",
"hashlib",
"base64",
"struct",
"linecache",
"pkgutil",
"queue",
"hmac",
"asyncio",
"xmlrpc",
"cmd",
"dataclasses",
"cmath",
"string",
"code",
"math",
"spwd",
"pyclbr",
"grp",
"inspect",
"sre",
"encodings",
"itertools",
"wave",
"termios",
"shutil",
"codecs",
"ssl",
"plistlib",
"mailcap",
"reprlib",
"fpectl",
"multiprocessing",
"subprocess",
"pstats",
"shelve",
"asynchat",
"configparser",
"pipes",
"aifc",
"doctest",
"msilib",
"fnmatch",
"tempfile",
"fractions",
"logging",
"contextvars",
"tty",
"builtins",
"random",
"contextlib",
"decimal",
"distutils",
"ftplib",
"trace",
"winsound",
"dis",
"symbol",
"smtplib",
"signal",
"optparse",
"html",
"readline",
"zipapp",
"netrc",
"ossaudiodev",
"posix",
"numbers",
"sndhdr",
"concurrent",
"http",
"typing",
"marshal",
"sre_parse",
"uu",
"fcntl",
"pickle",
"token",
"argparse",
"smtpd",
"stat",
"tabnanny",
"dbm",
"gc",
"pty",
"formatter",
"json",
"filecmp",
"importlib",
"fileinput",
"macpath",
"quopri",
"nntplib",
"sysconfig",
"compileall",
"urllib",
"dummy_threading",
"difflib",
"email",
"site",
"symtable",
"uuid",
"csv",
"sys",
"cProfile",
"zlib",
"statistics",
"colorsys",
"glob",
"copy",
"faulthandler",
"resource",
"wsgiref",
"nis",
"locale",
"crypt",
"pathlib",
"tracemalloc",
"audioop",
"cgi",
"enum",
"tokenize",
"sre_constants",
"asyncore",
"winreg",
"mailbox",
"secrets",
"ctypes",
"atexit",
"calendar",
"ipaddress",
"warnings",
"abc",
"tarfile",
"cgitb",
"pdb",
"msvcrt",
"pwd",
"runpy",
"zipimport",
"modulefinder",
"sqlite3",
"pydoc",
"textwrap",
"_thread",
"heapq",
"test",
"timeit",
"unicodedata",
"turtledemo",
"ntpath",
"telnetlib",
"unittest",
"errno",
"zipfile",
"operator",
"posixpath",
"pprint",
"re",
"profile",
"selectors",
"_dummy_thread",
"platform",
"pickletools",
"parser",
"socket",
"collections",
"binascii",
"mmap",
"shlex",
"threading",
"weakref",
"imp"
],
"extra_standard_library": [],
"known_other": {},
"multi_line_output": "VERTICAL_HANGING_INDENT",
"forced_separate": [],
"indent": " ",
"comment_prefix": " #",
"length_sort": false,
"length_sort_straight": false,
"length_sort_sections": [],
"add_imports": [],
"remove_imports": [],
"append_only": false,
"reverse_relative": false,
"force_single_line": false,
"single_line_exclusions": [],
"default_section": "THIRDPARTY",
"import_headings": {},
"balanced_wrapping": false,
"use_parentheses": true,
"order_by_type": true,
"atomic": false,
"lines_after_imports": -1,
"lines_between_sections": 1,
"lines_between_types": 0,
"combine_as_imports": false,
"combine_star": false,
"include_trailing_comma": true,
"from_first": false,
"verbose": false,
"quiet": false,
"force_adds": false,
"force_alphabetical_sort_within_sections": false,
"force_alphabetical_sort": false,
"force_grid_wrap": 0,
"force_sort_within_sections": false,
"lexicographical": false,
"group_by_package": false,
"ignore_whitespace": false,
"no_lines_before": [],
"no_inline_sort": false,
"ignore_comments": false,
"case_sensitive": false,
"sources": [
{
"py_version": "py3",
"force_to_top": [],
"skip": [
"__pypackages__",
"venv",
".venv",
".pants.d",
".direnv",
".git",
".svn",
"dist",
"node_modules",
"build",
".bzr",
".eggs",
".mypy_cache",
"buck-out",
".hg",
"_build",
".nox",
".tox"
],
"extend_skip": [],
"skip_glob": [],
"extend_skip_glob": [],
"skip_gitignore": false,
"line_length": 79,
"wrap_length": 0,
"line_ending": "",
"sections": [
"FUTURE",
"STDLIB",
"THIRDPARTY",
"FIRSTPARTY",
"LOCALFOLDER"
],
"no_sections": false,
"known_future_library": [
"__future__"
],
"known_third_party": [],
"known_first_party": [],
"known_local_folder": [],
"known_standard_library": [
"zoneinfo",
"syslog",
"lib2to3",
"getpass",
"xml",
"imghdr",
"turtle",
"graphlib",
"time",
"tkinter",
"binhex",
"rlcompleter",
"xdrlib",
"datetime",
"socketserver",
"mimetypes",
"keyword",
"array",
"lzma",
"select",
"sunau",
"chunk",
"functools",
"imaplib",
"venv",
"bz2",
"types",
"sched",
"getopt",
"stringprep",
"gzip",
"codeop",
"gettext",
"traceback",
"webbrowser",
"io",
"ensurepip",
"bisect",
"curses",
"sre_compile",
"os",
"copyreg",
"ast",
"poplib",
"py_compile",
"bdb",
"hashlib",
"base64",
"struct",
"linecache",
"pkgutil",
"queue",
"hmac",
"asyncio",
"xmlrpc",
"cmd",
"dataclasses",
"cmath",
"string",
"code",
"math",
"spwd",
"pyclbr",
"grp",
"inspect",
"sre",
"encodings",
"itertools",
"wave",
"termios",
"shutil",
"codecs",
"ssl",
"plistlib",
"mailcap",
"reprlib",
"fpectl",
"multiprocessing",
"subprocess",
"pstats",
"shelve",
"asynchat",
"configparser",
"pipes",
"aifc",
"doctest",
"msilib",
"fnmatch",
"tempfile",
"fractions",
"logging",
"contextvars",
"tty",
"builtins",
"random",
"contextlib",
"decimal",
"distutils",
"ftplib",
"trace",
"winsound",
"dis",
"symbol",
"smtplib",
"signal",
"optparse",
"html",
"readline",
"zipapp",
"netrc",
"ossaudiodev",
"posix",
"numbers",
"sndhdr",
"concurrent",
"http",
"typing",
"marshal",
"sre_parse",
"uu",
"fcntl",
"pickle",
"token",
"argparse",
"smtpd",
"stat",
"tabnanny",
"dbm",
"gc",
"pty",
"formatter",
"json",
"filecmp",
"importlib",
"fileinput",
"macpath",
"quopri",
"nntplib",
"sysconfig",
"compileall",
"urllib",
"dummy_threading",
"difflib",
"email",
"site",
"symtable",
"uuid",
"csv",
"sys",
"cProfile",
"zlib",
"statistics",
"colorsys",
"glob",
"copy",
"faulthandler",
"resource",
"wsgiref",
"nis",
"locale",
"crypt",
"pathlib",
"tracemalloc",
"audioop",
"cgi",
"enum",
"tokenize",
"sre_constants",
"asyncore",
"winreg",
"mailbox",
"secrets",
"ctypes",
"atexit",
"calendar",
"ipaddress",
"warnings",
"abc",
"tarfile",
"cgitb",
"pdb",
"msvcrt",
"pwd",
"runpy",
"zipimport",
"modulefinder",
"sqlite3",
"pydoc",
"textwrap",
"_thread",
"heapq",
"test",
"timeit",
"unicodedata",
"turtledemo",
"ntpath",
"telnetlib",
"unittest",
"errno",
"zipfile",
"operator",
"posixpath",
"pprint",
"re",
"profile",
"selectors",
"_dummy_thread",
"platform",
"pickletools",
"parser",
"socket",
"collections",
"binascii",
"mmap",
"shlex",
"threading",
"weakref",
"imp"
],
"extra_standard_library": [],
"known_other": {},
"multi_line_output": "GRID",
"forced_separate": [],
"indent": " ",
"comment_prefix": " #",
"length_sort": false,
"length_sort_straight": false,
"length_sort_sections": [],
"add_imports": [],
"remove_imports": [],
"append_only": false,
"reverse_relative": false,
"force_single_line": false,
"single_line_exclusions": [],
"default_section": "THIRDPARTY",
"import_headings": {},
"balanced_wrapping": false,
"use_parentheses": false,
"order_by_type": true,
"atomic": false,
"lines_after_imports": -1,
"lines_between_sections": 1,
"lines_between_types": 0,
"combine_as_imports": false,
"combine_star": false,
"include_trailing_comma": false,
"from_first": false,
"verbose": false,
"quiet": false,
"force_adds": false,
"force_alphabetical_sort_within_sections": false,
"force_alphabetical_sort": false,
"force_grid_wrap": 0,
"force_sort_within_sections": false,
"lexicographical": false,
"group_by_package": false,
"ignore_whitespace": false,
"no_lines_before": [],
"no_inline_sort": false,
"ignore_comments": false,
"case_sensitive": false,
"sources": [],
"virtual_env": "",
"conda_env": "",
"ensure_newline_before_comments": false,
"directory": "",
"profile": "",
"honor_noqa": false,
"src_paths": [],
"old_finders": false,
"remove_redundant_aliases": false,
"float_to_top": false,
"filter_files": false,
"formatter": "",
"formatting_function": null,
"color_output": false,
"treat_comments_as_code": [],
"treat_all_comments_as_code": false,
"supported_extensions": [
"py",
"pxd",
"pyi",
"pyx"
],
"blocked_extensions": [
"pex"
],
"constants": [],
"classes": [],
"variables": [],
"dedup_headings": false,
"only_sections": false,
"only_modified": false,
"combine_straight_imports": false,
"auto_identify_namespace_packages": true,
"namespace_packages": [],
"follow_links": true,
"indented_import_headings": true,
"honor_case_in_force_sorted_sections": false,
"sort_relative_in_force_sorted_sections": false,
"overwrite_in_place": false,
"reverse_sort": false,
"star_first": false,
"git_ignore": {},
"format_error": "{error}: {message}",
"format_success": "{success}: {message}",
"sort_order": "natural",
"source": "defaults"
},
{
"multi_line_output": "VERTICAL_HANGING_INDENT",
"include_trailing_comma": true,
"force_grid_wrap": 0,
"use_parentheses": true,
"line_length": 88,
"skip": [
"environment.py"
],
"skip_gitignore": true,
"source": "C:\\Users\\tfmehdi\\PycharmProjects\\api\\.isort.cfg"
}
],
"virtual_env": "",
"conda_env": "",
"ensure_newline_before_comments": false,
"directory": "C:\\Users\\tfmehdi\\PycharmProjects\\api",
"profile": "",
"honor_noqa": false,
"src_paths": [
"C:\\Users\\tfmehdi\\PycharmProjects\\api\\src",
"C:\\Users\\tfmehdi\\PycharmProjects\\api"
],
"old_finders": false,
"remove_redundant_aliases": false,
"float_to_top": false,
"filter_files": false,
"formatter": "",
"formatting_function": null,
"color_output": false,
"treat_comments_as_code": [],
"treat_all_comments_as_code": false,
"supported_extensions": [
"py",
"pxd",
"pyi",
"pyx"
],
"blocked_extensions": [
"pex"
],
"constants": [],
"classes": [],
"variables": [],
"dedup_headings": false,
"only_sections": false,
"only_modified": false,
"combine_straight_imports": false,
"auto_identify_namespace_packages": true,
"namespace_packages": [],
"follow_links": true,
"indented_import_headings": true,
"honor_case_in_force_sorted_sections": false,
"sort_relative_in_force_sorted_sections": false,
"overwrite_in_place": false,
"reverse_sort": false,
"star_first": false,
"git_ignore": {},
"format_error": "{error}: {message}",
"format_success": "{success}: {message}",
"sort_order": "natural"
}
[settings]
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=88
skip=environment.py
skip_gitignore=True
The file specified with skip= is skipped as expected but the files & folders in .gitignore aren't skipped.
.venv/
.vscode/
.idea/
.pytest_cache/
__pycache__/
.env
Same issue here when using 5.9.0
or 5.9.1
with a pyproject.toml:
[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
line_length = 120
src_paths = ["setup.py", "awswrangler"]
py_version = 37
skip_gitignore = true
my entire .env
Python environment is scanned by isort when it was previously ignore. Worked fine with 5.8.0
I also experienced this as well with 5.9.1
, and as a user it was very difficult to pin down what was going on because isort
simply took a very long time to complete, but I couldn't figure out why. Specifically, I think isort
was processing the .tox
and venv
folders that are ignored in Git which have thousands of .py
files in them.
I observed this behavior on Windows and macOS. Reverting to 5.8.0
fixed this issue.
pyproject.toml
:
[tool.isort]
profile = "black"
line_length = 99
force_sort_within_sections = true
skip_gitignore = true
.gitignore
:
I'm sorry everyone is continuing to experience this! There have been 2 major fixes against the git ignore behavior in the main branch since this was last experienced (I myself have not been able to get this to happen). Can someone who is experiencing this issue try against latest main and see if it is resolved?
Tested pip install from current main and it seems to have fixed it for me, thanks
@jaidisido thanks for testing! 5.9.2 has been pushed which should resolve this issue.
Hi,
I still have the issue with the version 5.9.2, although it is a bit different.
fatal: Pathspec '/some/path/other_project/setup.py' is in submodule 'other_project
where other_project
is a git submodule, not in .gitignore
but in extend_skip
If I put my venv
in extend_skip and turn off skip_gitignore, everything seems to be working fine
@timothycrosley 5.9.2 seemed to fix the issue for me. Though when I ran with -v
I was surprised to see no mention of skip_gitignore
. Each of the skipped folders below is actually skipped because they are listed in .gitignore
.
.tox was skipped as it's listed in 'skip' setting or matches a glob in 'skip_glob' setting
dist was skipped as it's listed in 'skip' setting or matches a glob in 'skip_glob' setting
.mypy_cache was skipped as it's listed in 'skip' setting or matches a glob in 'skip_glob' setting
venv was skipped as it's listed in 'skip' setting or matches a glob in 'skip_glob' setting
_build was skipped as it's listed in 'skip' setting or matches a glob in 'skip_glob' setting
Skipped 5 files
My config:
[tool.isort]
profile = "black"
line_length = 99
force_sort_within_sections = true
src_paths = ["config", "api"]
skip_gitignore = true
Let me know if you think I should open a separate issue about this.
@johnthagen, good call out! Currently, that message isn't aware of why a skip happened. I've done the minimal thing of updating it to mention the gitignore possibility: https://github.com/PyCQA/isort/commit/6c1ec9ad4578db0a022e4c821eca215a2b5678f1 but making it know why a file was skipped would require a bit more of a refactoring if it is needed.
Hi, I still have the issue with the version 5.9.2, although it is a bit different.
fatal: Pathspec '/some/path/other_project/setup.py' is in submodule 'other_project
where
other_project
is a git submodule, not in.gitignore
but in extend_skipIf I put my
venv
in extend_skip and turn off skip_gitignore, everything seems to be working fine
Do you want me to open a different issue ?
I've done the minimal thing of updating it to mention the gitignore possibility: 6c1ec9a
To me that makes it clear enough (just knowing that it could be possibility). I don't think there is huge value is trying to track why each item was skipped. Thanks for the quick response and fix. isort
is awesome.
I'm using
isort
with my project for some time now, thank you for this project !Everything was working well with 5.8.0 but with 5.9.0 I have the error
And with the version 5.9.1,
extend_skip
andskip_gitignore
are not honored andisort
goes into myvenv
folder where it shouldn't go.Thank you for looking into this