Skip to content

bug: isort >=5.13 no longer has --filename #710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
SamuelLarkin opened this issue May 16, 2025 · 1 comment
Closed
2 tasks done

bug: isort >=5.13 no longer has --filename #710

SamuelLarkin opened this issue May 16, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@SamuelLarkin
Copy link

Neovim version (nvim -v)

NVIM v0.11.0 Build type: Release LuaJIT 2.1.1741730670 Run "nvim -V1 -v" for more info

Operating system/version

Linux XXX 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Read debugging tips

Add the debug logs

  • I have set log_level = vim.log.levels.DEBUG and pasted the log contents below.

Log file

Log file: $HOME/.local/state/nvim/conform.log │
│ [--sg SKIP_GLOB] [--gitignore] [--sl] │
│ [--nsl SINGLE_LINE_EXCLUSIONS] [--sp SETTINGS_PATH] │
│ [-t FORCE_TO_TOP] [--tc] [--up] [-V] [-v] │
│ [--virtual-env VIRTUAL_ENV] [--conda-env CONDA_ENV] [--vn] │
│ [-l LINE_LENGTH] [--wl WRAP_LENGTH] [--ws] [--case-sensitive] │
│ [--filter-files] [--py {all,2,27,3,35,36,37,38,39,auto}] │
│ [--profile PROFILE] [--interactive] [--old-finders] │
│ [--show-config] [--show-files] [--honor-noqa] │
│ [--remove-redundant-aliases] [--color] [--float-to-top] │
│ [--treat-comment-as-code TREAT_COMMENTS_AS_CODE] │
 │ [--treat-all-comment-as-code] [--formatter FORMATTER] │
 │ [--ext SUPPORTED_EXTENSIONS] │
│ [--blocked-extension BLOCKED_EXTENSIONS] [--dedup-headings] │
│ [--only-sections] [--only-modified] │
 │ [files [files ...]] │
 │ isort: error: unrecognized arguments: --filename │
│ │
│Formatters for this buffer: │
│LSP: ruff │
│isort ready (python) $HOME/.conda/envs/common-voice-bundler/bin/isort │
│black ready (python) $HOME/.conda/envs/common-voice-bundler/bin/black │
│ruff ready (python) $HOME/.local/share/nvim/mason/bin/ruff

Describe the bug

I'm using conform on python scripts using isort. After some updates, aka getting isort>=5.13, conform fails because --filename is no longer an option to isort.

Reverting to isort<5.13 fixes the error.

What is the severity of this bug?

breaking (some functionality is broken)

Steps To Reproduce

Have conform.nvim setup in your nvim.
Have conform use isort for python files.
install isort<=5.13
try to run conform on a python script
then do :ConformIno to see the error

Expected Behavior

I'm expecting to auto format my python scripts using conform and isort.

Minimal example file

No response

Minimal init.lua

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {
    "stevearc/conform.nvim",
    config = function()
      require("conform").setup({
        log_level = vim.log.levels.DEBUG,
        -- add your config here
      })
    end,
 opts = {
 -- Define your formatters
 formatters_by_ft = {
python = { "isort", "black", "ruff" },

-- Use the "_" filetype to run formatters on filetypes that don't
 -- have other formatters configured.
 ["_"] = { "trim_whitespace" },
 },

  },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Additional context

No response

@SamuelLarkin SamuelLarkin added the bug Something isn't working label May 16, 2025
@stevearc
Copy link
Owner

Version 5.13 is from 2023. --filename is included in the official documentation. I'm not sure why it was working before version 5.13, but perhaps it was less strict about args checking? In any case, it would appear that the latest version does accept this argument. If you want to support older versions, you'll need to manually adjust the formatter args.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants