PyCQA / isort

A Python utility / library to sort imports.
https://pycqa.github.io/isort/
MIT License
6.49k stars 580 forks source link

skips are not honored since isort 5.9.x #1762

Closed pums974 closed 3 years ago

pums974 commented 3 years ago

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

OSError: [Errno 7] Argument list too long: 'git'

And with the version 5.9.1, extend_skip and skip_gitignore are not honored and isort goes into my venv folder where it shouldn't go.

Thank you for looking into this

grant-zietsman commented 3 years ago

I have noticed the same thing happening this side.

timothycrosley commented 3 years ago

@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?

pums974 commented 3 years ago

Yeah no problem

`isort . --show-config`: ```python { "_known_patterns": null, "_section_comments": null, "_skips": null, "_skip_globs": null, "_sorting_function": null, "py_version": "py3", "force_to_top": [], "skip": [ ".hg", "__pypackages__", "buck-out", ".pants.d", ".eggs", "_build", "dist", ".mypy_cache", ".venv", ".tox", ".svn", ".direnv", ".git", "venv", "node_modules", "build", ".bzr", ".nox" ], "extend_skip": [ "tmp", "ext_bin", "venv", "ext" ], "skip_glob": [], "extend_skip_glob": [], "skip_gitignore": true, "line_length": 100, "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": [ "mmap", "tarfile", "hmac", "pwd", "shelve", "audioop", "getopt", "macpath", "uuid", "runpy", "optparse", "pkgutil", "formatter", "ensurepip", "test", "dbm", "hashlib", "encodings", "wave", "winreg", "pickletools", "decimal", "imaplib", "trace", "posixpath", "heapq", "chunk", "array", "selectors", "curses", "html", "tempfile", "statistics", "modulefinder", "mailbox", "dummy_threading", "copyreg", "cmd", "sqlite3", "zipfile", "enum", "winsound", "rlcompleter", "token", "xml", "time", "nis", "pyclbr", "netrc", "aifc", "syslog", "tokenize", "imghdr", "concurrent", "platform", "lzma", "fileinput", "fpectl", "resource", "crypt", "copy", "subprocess", "dataclasses", "reprlib", "turtledemo", "site", "xmlrpc", "binascii", "keyword", "pty", "faulthandler", "wsgiref", "abc", "builtins", "pathlib", "symbol", "gc", "sre_compile", "functools", "unicodedata", "doctest", "logging", "marshal", "queue", "ctypes", "types", "urllib", "glob", "typing", "multiprocessing", "asyncore", "ipaddress", "gzip", "codecs", "secrets", "filecmp", "_thread", "json", "calendar", "quopri", "base64", "pydoc", "numbers", "errno", "locale", "fcntl", "inspect", "codeop", "itertools", "fnmatch", "getpass", "_dummy_thread", "fractions", "tty", "contextvars", "sndhdr", "plistlib", "difflib", "posix", "bdb", "math", "distutils", "http", "grp", "dis", "profile", "cmath", "pdb", "pprint", "socket", "telnetlib", "ntpath", "graphlib", "py_compile", "symtable", "timeit", "asynchat", "cgitb", "smtpd", "gettext", "nntplib", "turtle", "ftplib", "uu", "sre_constants", "signal", "readline", "struct", "poplib", "mailcap", "termios", "spwd", "sys", "compileall", "configparser", "textwrap", "io", "operator", "linecache", "smtplib", "stat", "sysconfig", "os", "sre", "select", "code", "parser", "bisect", "tracemalloc", "socketserver", "webbrowser", "binhex", "colorsys", "ssl", "sunau", "asyncio", "cProfile", "mimetypes", "ast", "threading", "zlib", "lib2to3", "contextlib", "random", "sre_parse", "zoneinfo", "bz2", "zipapp", "xdrlib", "string", "collections", "atexit", "msilib", "weakref", "stringprep", "imp", "re", "pickle", "warnings", "importlib", "tabnanny", "sched", "shlex", "tkinter", "zipimport", "cgi", "ossaudiodev", "msvcrt", "pipes", "shutil", "csv", "datetime", "email", "pstats", "venv", "unittest", "traceback", "argparse" ], "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": [ ".hg", "__pypackages__", "buck-out", ".pants.d", ".eggs", "_build", "dist", ".mypy_cache", ".venv", ".tox", ".svn", ".direnv", ".git", "venv", "node_modules", "build", ".bzr", ".nox" ], "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": [ "mmap", "tarfile", "hmac", "pwd", "shelve", "audioop", "getopt", "macpath", "uuid", "runpy", "optparse", "pkgutil", "formatter", "ensurepip", "test", "dbm", "hashlib", "encodings", "wave", "winreg", "pickletools", "decimal", "imaplib", "trace", "posixpath", "heapq", "chunk", "array", "selectors", "curses", "html", "tempfile", "statistics", "modulefinder", "mailbox", "dummy_threading", "copyreg", "cmd", "sqlite3", "zipfile", "enum", "winsound", "rlcompleter", "token", "xml", "time", "nis", "pyclbr", "netrc", "aifc", "syslog", "tokenize", "imghdr", "concurrent", "platform", "lzma", "fileinput", "fpectl", "resource", "crypt", "copy", "subprocess", "dataclasses", "reprlib", "turtledemo", "site", "xmlrpc", "binascii", "keyword", "pty", "faulthandler", "wsgiref", "abc", "builtins", "pathlib", "symbol", "gc", "sre_compile", "functools", "unicodedata", "doctest", "logging", "marshal", "queue", "ctypes", "types", "urllib", "glob", "typing", "multiprocessing", "asyncore", "ipaddress", "gzip", "codecs", "secrets", "filecmp", "_thread", "json", "calendar", "quopri", "base64", "pydoc", "numbers", "errno", "locale", "fcntl", "inspect", "codeop", "itertools", "fnmatch", "getpass", "_dummy_thread", "fractions", "tty", "contextvars", "sndhdr", "plistlib", "difflib", "posix", "bdb", "math", "distutils", "http", "grp", "dis", "profile", "cmath", "pdb", "pprint", "socket", "telnetlib", "ntpath", "graphlib", "py_compile", "symtable", "timeit", "asynchat", "cgitb", "smtpd", "gettext", "nntplib", "turtle", "ftplib", "uu", "sre_constants", "signal", "readline", "struct", "poplib", "mailcap", "termios", "spwd", "sys", "compileall", "configparser", "textwrap", "io", "operator", "linecache", "smtplib", "stat", "sysconfig", "os", "sre", "select", "code", "parser", "bisect", "tracemalloc", "socketserver", "webbrowser", "binhex", "colorsys", "ssl", "sunau", "asyncio", "cProfile", "mimetypes", "ast", "threading", "zlib", "lib2to3", "contextlib", "random", "sre_parse", "zoneinfo", "bz2", "zipapp", "xdrlib", "string", "collections", "atexit", "msilib", "weakref", "stringprep", "imp", "re", "pickle", "warnings", "importlib", "tabnanny", "sched", "shlex", "tkinter", "zipimport", "cgi", "ossaudiodev", "msvcrt", "pipes", "shutil", "csv", "datetime", "email", "pstats", "venv", "unittest", "traceback", "argparse" ], "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": [ "pxd", "pyi", "py", "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": 3, "include_trailing_comma": true, "force_grid_wrap": 0, "use_parentheses": true, "ensure_newline_before_comments": true, "line_length": 88, "source": "black profile" }, { "profile": "black", "multi_line_output": "VERTICAL_HANGING_INDENT", "line_length": 100, "extend_skip": [ "tmp", "ext_bin", "ext" ], "src_paths": [ "pymcac" ], "skip_gitignore": true, "source": "/Data/WORK/Projets/SRC/MCAC/pyproject.toml" } ], "virtual_env": "", "conda_env": "", "ensure_newline_before_comments": true, "directory": "/Data/WORK/Projets/SRC/MCAC", "profile": "black", "honor_noqa": false, "src_paths": [ "/Data/WORK/Projets/SRC/MCAC/pymcac" ], "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": [ "pxd", "pyi", "py", "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" } ```
`pyproject.toml`: ```toml [tool.isort] profile = "black" multi_line_output = 3 line_length = 100 extend_skip = [ "tmp", "ext", "ext_bin", ] skip_gitignore = true ```

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)

grant-zietsman commented 3 years ago

I ran this with the latest version (installed from git) and these are the results that I am seeing.

isort --check . ``` ERROR: /mnt/jenkins-data/workspace/branch/.local/lib/python3.6/site-packages/appdirs.py Imports are incorrectly sorted and/or formatted. ERROR: /mnt/jenkins-data/workspace/branch/.local/lib/python3.6/site-packages/dataclasses.py Imports are incorrectly sorted and/or formatted. ERROR: /mnt/jenkins-data/workspace/branch/.local/lib/python3.6/site-packages/mypy_extensions.py Imports are incorrectly sorted and/or formatted. ERROR: /mnt/jenkins-data/workspace/branch/.local/lib/python3.6/site-packages/coverage/parser.py Imports are incorrectly sorted and/or formatted. ... ```
isort . --show-config ``` { "_known_patterns": null, "_section_comments": null, "_skips": null, "_skip_globs": null, "_sorting_function": null, "py_version": "py3", "force_to_top": [], "skip": [ "dist", ".venv", ".pants.d", "build", ".hg", "node_modules", ".mypy_cache", ".nox", "_build", ".direnv", ".eggs", "__pypackages__", ".bzr", ".git", ".svn", "venv", ".tox", "buck-out" ], "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": [ "ssl", "hashlib", "cmd", "profile", "contextvars", "readline", "cmath", "runpy", "errno", "colorsys", "re", "zipfile", "time", "graphlib", "binascii", "uuid", "secrets", "datetime", "doctest", "termios", "ipaddress", "rlcompleter", "traceback", "heapq", "signal", "wsgiref", "textwrap", "posixpath", "pkgutil", "_dummy_thread", "stat", "itertools", "sre_parse", "crypt", "smtplib", "tty", "tempfile", "importlib", "bisect", "smtpd", "site", "winreg", "io", "sysconfig", "fnmatch", "ftplib", "multiprocessing", "dis", "symbol", "gzip", "ast", "array", "quopri", "getopt", "cgi", "pipes", "contextlib", "subprocess", "tabnanny", "posix", "tkinter", "netrc", "imghdr", "nntplib", "numbers", "tokenize", "pyclbr", "plistlib", "email", "mailbox", "audioop", "stringprep", "sys", "dataclasses", "os", "concurrent", "zlib", "gc", "decimal", "filecmp", "bdb", "telnetlib", "imaplib", "aifc", "encodings", "macpath", "shelve", "queue", "mmap", "csv", "typing", "optparse", "turtle", "venv", "compileall", "sched", "pprint", "shlex", "webbrowser", "ntpath", "sre_compile", "xdrlib", "imp", "socketserver", "sre", "urllib", "pydoc", "http", "socket", "tarfile", "bz2", "marshal", "resource", "asynchat", "uu", "spwd", "atexit", "collections", "pstats", "struct", "unittest", "fpectl", "sqlite3", "pickletools", "copy", "fractions", "mimetypes", "asyncio", "faulthandler", "platform", "chunk", "select", "token", "hmac", "pty", "dummy_threading", "zipapp", "cgitb", "formatter", "sunau", "html", "wave", "linecache", "fcntl", "fileinput", "string", "py_compile", "selectors", "base64", "glob", "warnings", "random", "codecs", "syslog", "configparser", "asyncore", "code", "abc", "zipimport", "copyreg", "reprlib", "timeit", "difflib", "turtledemo", "curses", "sre_constants", "msvcrt", "_thread", "sndhdr", "json", "binhex", "getpass", "logging", "test", "types", "tracemalloc", "inspect", "xmlrpc", "dbm", "calendar", "msilib", "math", "modulefinder", "ossaudiodev", "winsound", "statistics", "zoneinfo", "threading", "parser", "locale", "pdb", "symtable", "mailcap", "weakref", "lib2to3", "lzma", "functools", "unicodedata", "cProfile", "grp", "trace", "distutils", "pickle", "enum", "poplib", "pwd", "pathlib", "operator", "ensurepip", "argparse", "builtins", "nis", "keyword", "shutil", "xml", "ctypes", "gettext", "codeop" ], "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": [ "dist", ".venv", ".pants.d", "build", ".hg", "node_modules", ".mypy_cache", ".nox", "_build", ".direnv", ".eggs", "__pypackages__", ".bzr", ".git", ".svn", "venv", ".tox", "buck-out" ], "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": [ "ssl", "hashlib", "cmd", "profile", "contextvars", "readline", "cmath", "runpy", "errno", "colorsys", "re", "zipfile", "time", "graphlib", "binascii", "uuid", "secrets", "datetime", "doctest", "termios", "ipaddress", "rlcompleter", "traceback", "heapq", "signal", "wsgiref", "textwrap", "posixpath", "pkgutil", "_dummy_thread", "stat", "itertools", "sre_parse", "crypt", "smtplib", "tty", "tempfile", "importlib", "bisect", "smtpd", "site", "winreg", "io", "sysconfig", "fnmatch", "ftplib", "multiprocessing", "dis", "symbol", "gzip", "ast", "array", "quopri", "getopt", "cgi", "pipes", "contextlib", "subprocess", "tabnanny", "posix", "tkinter", "netrc", "imghdr", "nntplib", "numbers", "tokenize", "pyclbr", "plistlib", "email", "mailbox", "audioop", "stringprep", "sys", "dataclasses", "os", "concurrent", "zlib", "gc", "decimal", "filecmp", "bdb", "telnetlib", "imaplib", "aifc", "encodings", "macpath", "shelve", "queue", "mmap", "csv", "typing", "optparse", "turtle", "venv", "compileall", "sched", "pprint", "shlex", "webbrowser", "ntpath", "sre_compile", "xdrlib", "imp", "socketserver", "sre", "urllib", "pydoc", "http", "socket", "tarfile", "bz2", "marshal", "resource", "asynchat", "uu", "spwd", "atexit", "collections", "pstats", "struct", "unittest", "fpectl", "sqlite3", "pickletools", "copy", "fractions", "mimetypes", "asyncio", "faulthandler", "platform", "chunk", "select", "token", "hmac", "pty", "dummy_threading", "zipapp", "cgitb", "formatter", "sunau", "html", "wave", "linecache", "fcntl", "fileinput", "string", "py_compile", "selectors", "base64", "glob", "warnings", "random", "codecs", "syslog", "configparser", "asyncore", "code", "abc", "zipimport", "copyreg", "reprlib", "timeit", "difflib", "turtledemo", "curses", "sre_constants", "msvcrt", "_thread", "sndhdr", "json", "binhex", "getpass", "logging", "test", "types", "tracemalloc", "inspect", "xmlrpc", "dbm", "calendar", "msilib", "math", "modulefinder", "ossaudiodev", "winsound", "statistics", "zoneinfo", "threading", "parser", "locale", "pdb", "symtable", "mailcap", "weakref", "lib2to3", "lzma", "functools", "unicodedata", "cProfile", "grp", "trace", "distutils", "pickle", "enum", "poplib", "pwd", "pathlib", "operator", "ensurepip", "argparse", "builtins", "nis", "keyword", "shutil", "xml", "ctypes", "gettext", "codeop" ], "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": [ "pyi", "pyx", "pxd", "py" ], "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, "ensure_newline_before_comments": true, "line_length": 88, "skip_gitignore": true, "source": "/mnt/jenkins-data/workspace/branch/.isort.cfg" } ], "virtual_env": "", "conda_env": "", "ensure_newline_before_comments": true, "directory": "/mnt/jenkins-data/workspace/branch", "profile": "", "honor_noqa": false, "src_paths": [ "/mnt/jenkins-data/workspace/branch/src", "/mnt/jenkins-data/workspace/branch" ], "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": [ "pyi", "pyx", "pxd", "py" ], "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" } ```
cat .gitignore ``` ... .local ... ```
tahmidmehdi commented 3 years ago

I also have this issue with isort 5.9.1. I installed the latest version ( 23d708e ) from git & the issue persisted.

isort . --show-config

{
    "_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"
}

.isort.cfg

[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.

.gitignore

.venv/
.vscode/
.idea/
.pytest_cache/
__pycache__/
.env

jaidisido commented 3 years ago

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

johnthagen commented 3 years ago

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:

``` # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # Dependencies /node_modules /.pnp .pnp.js # Testing /coverage* /Backend.Tests/coverage* # Production /build # Generated Docker files for development use docker-compose.yml .env.* .env*.local nginx/scripts /backups /restore script_conf.json backup_conf.json # Misc .DS_Store .eslintcache Session.vim scripts/*.js !scripts/printVersion.js npm-debug.log* yarn-debug.log* yarn-error.log* # Visual Studio .vs/* # Backend Backend/.vs/**/* Backend/bin Backend/obj Backend/build /**/obj/**/* Backend.Tests/bin Backend.Tests/obj Backend/BackendFramework.csproj.user BackendFramework.sln.DotSettings.user Backend/.vscode/**/* Backend/SIL.Lift/**/* Backend/ql-database /**/*.xml /**/*.lift /**/*.orig Backend.Tests/bin/Audio/*.mp3 /**/*.~un /**/*.swp Backend.Tests/bin/Avatars/* mongo_database # User Guide docs/user_guide/site # Vagrant instances .vagrant/ # Python .tox .mypy_cache __pycache__ *.pyc venv # Host file to be used for ad hoc testing/development deploy/*.hosts.yml # YAML files for ad hoc testing/development _*.yml # Emacs backup files (this is Jim's fault) *~ \#*# # JetBrains Rider .idea ```
timothycrosley commented 3 years ago

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?

jaidisido commented 3 years ago

Tested pip install from current main and it seems to have fixed it for me, thanks

timothycrosley commented 3 years ago

@jaidisido thanks for testing! 5.9.2 has been pushed which should resolve this issue.

pums974 commented 3 years ago

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

`isort . --show-config`: ```python { "_known_patterns": null, "_section_comments": null, "_skips": null, "_skip_globs": null, "_sorting_function": null, "py_version": "py3", "force_to_top": [], "skip": [ "__pypackages__", ".tox", "dist", ".nox", ".venv", "build", ".mypy_cache", ".direnv", ".bzr", "venv", ".eggs", "buck-out", ".git", "node_modules", ".hg", ".svn", "_build", ".pants.d" ], "extend_skip": [ "other_project" ], "skip_glob": [], "extend_skip_glob": [], "skip_gitignore": true, "line_length": 100, "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": [ "shelve", "formatter", "struct", "pstats", "sys", "imp", "imaplib", "pkgutil", "trace", "pprint", "fcntl", "symtable", "rlcompleter", "msilib", "tempfile", "tarfile", "json", "msvcrt", "pickle", "uu", "grp", "statistics", "keyword", "cmd", "difflib", "string", "hashlib", "argparse", "site", "itertools", "pipes", "tokenize", "faulthandler", "tracemalloc", "cmath", "smtplib", "datetime", "ast", "winreg", "aifc", "netrc", "pydoc", "ntpath", "subprocess", "zipimport", "importlib", "zipapp", "curses", "_dummy_thread", "resource", "multiprocessing", "bdb", "email", "gettext", "fractions", "tkinter", "gc", "select", "unittest", "warnings", "timeit", "sqlite3", "encodings", "zoneinfo", "reprlib", "math", "chunk", "readline", "pyclbr", "binascii", "binhex", "inspect", "random", "zipfile", "imghdr", "xmlrpc", "operator", "sre", "typing", "atexit", "pty", "stat", "ctypes", "compileall", "urllib", "wsgiref", "asyncio", "html", "macpath", "sre_compile", "csv", "crypt", "copyreg", "abc", "types", "zlib", "lib2to3", "linecache", "shlex", "dataclasses", "poplib", "mimetypes", "io", "smtpd", "colorsys", "pwd", "dbm", "contextlib", "glob", "unicodedata", "concurrent", "array", "hmac", "asyncore", "graphlib", "time", "venv", "profile", "builtins", "ensurepip", "sunau", "bz2", "mmap", "sched", "http", "queue", "sre_parse", "posix", "uuid", "contextvars", "mailcap", "cgitb", "telnetlib", "mailbox", "token", "marshal", "doctest", "wave", "functools", "copy", "nntplib", "ossaudiodev", "fnmatch", "termios", "selectors", "pathlib", "tabnanny", "tty", "sndhdr", "fileinput", "posixpath", "locale", "webbrowser", "enum", "dis", "quopri", "codeop", "numbers", "threading", "secrets", "calendar", "ssl", "base64", "heapq", "collections", "turtledemo", "getpass", "stringprep", "ftplib", "xdrlib", "lzma", "_thread", "test", "xml", "sre_constants", "asynchat", "socketserver", "pdb", "nis", "symbol", "codecs", "os", "filecmp", "textwrap", "code", "getopt", "re", "logging", "plistlib", "parser", "cProfile", "dummy_threading", "bisect", "shutil", "py_compile", "socket", "configparser", "sysconfig", "distutils", "gzip", "pickletools", "optparse", "turtle", "runpy", "syslog", "fpectl", "ipaddress", "errno", "modulefinder", "winsound", "cgi", "weakref", "spwd", "audioop", "traceback", "signal", "decimal", "platform" ], "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__", ".tox", "dist", ".nox", ".venv", "build", ".mypy_cache", ".direnv", ".bzr", "venv", ".eggs", "buck-out", ".git", "node_modules", ".hg", ".svn", "_build", ".pants.d" ], "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": [ "shelve", "formatter", "struct", "pstats", "sys", "imp", "imaplib", "pkgutil", "trace", "pprint", "fcntl", "symtable", "rlcompleter", "msilib", "tempfile", "tarfile", "json", "msvcrt", "pickle", "uu", "grp", "statistics", "keyword", "cmd", "difflib", "string", "hashlib", "argparse", "site", "itertools", "pipes", "tokenize", "faulthandler", "tracemalloc", "cmath", "smtplib", "datetime", "ast", "winreg", "aifc", "netrc", "pydoc", "ntpath", "subprocess", "zipimport", "importlib", "zipapp", "curses", "_dummy_thread", "resource", "multiprocessing", "bdb", "email", "gettext", "fractions", "tkinter", "gc", "select", "unittest", "warnings", "timeit", "sqlite3", "encodings", "zoneinfo", "reprlib", "math", "chunk", "readline", "pyclbr", "binascii", "binhex", "inspect", "random", "zipfile", "imghdr", "xmlrpc", "operator", "sre", "typing", "atexit", "pty", "stat", "ctypes", "compileall", "urllib", "wsgiref", "asyncio", "html", "macpath", "sre_compile", "csv", "crypt", "copyreg", "abc", "types", "zlib", "lib2to3", "linecache", "shlex", "dataclasses", "poplib", "mimetypes", "io", "smtpd", "colorsys", "pwd", "dbm", "contextlib", "glob", "unicodedata", "concurrent", "array", "hmac", "asyncore", "graphlib", "time", "venv", "profile", "builtins", "ensurepip", "sunau", "bz2", "mmap", "sched", "http", "queue", "sre_parse", "posix", "uuid", "contextvars", "mailcap", "cgitb", "telnetlib", "mailbox", "token", "marshal", "doctest", "wave", "functools", "copy", "nntplib", "ossaudiodev", "fnmatch", "termios", "selectors", "pathlib", "tabnanny", "tty", "sndhdr", "fileinput", "posixpath", "locale", "webbrowser", "enum", "dis", "quopri", "codeop", "numbers", "threading", "secrets", "calendar", "ssl", "base64", "heapq", "collections", "turtledemo", "getpass", "stringprep", "ftplib", "xdrlib", "lzma", "_thread", "test", "xml", "sre_constants", "asynchat", "socketserver", "pdb", "nis", "symbol", "codecs", "os", "filecmp", "textwrap", "code", "getopt", "re", "logging", "plistlib", "parser", "cProfile", "dummy_threading", "bisect", "shutil", "py_compile", "socket", "configparser", "sysconfig", "distutils", "gzip", "pickletools", "optparse", "turtle", "runpy", "syslog", "fpectl", "ipaddress", "errno", "modulefinder", "winsound", "cgi", "weakref", "spwd", "audioop", "traceback", "signal", "decimal", "platform" ], "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", "pyi", "pxd", "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": 3, "include_trailing_comma": true, "force_grid_wrap": 0, "use_parentheses": true, "ensure_newline_before_comments": true, "line_length": 88, "source": "black profile" }, { "profile": "black", "multi_line_output": "VERTICAL_HANGING_INDENT", "line_length": 100, "extend_skip": [ "other_project" ], "skip_gitignore": true, "source": "/some/path/pyproject.toml" } ], "virtual_env": "", "conda_env": "", "ensure_newline_before_comments": true, "directory": "/some/path", "profile": "black", "honor_noqa": false, "src_paths": [ "/some/path/src", "/some/path" ], "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", "pyi", "pxd", "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" } ```
`pyproject.toml`: ```toml [tool.isort] profile = "black" multi_line_output = 3 line_length = 100 extend_skip = [ "other_project", ] skip_gitignore = true ```
johnthagen commented 3 years ago

@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.

timothycrosley commented 3 years ago

@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.

pums974 commented 3 years ago

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

Do you want me to open a different issue ?

johnthagen commented 3 years ago

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.