PyCQA / PyCQA/isort

isort: skip not respected with add_imports config option

Open
#1,962 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7k
Forks
687
Avg merge
4h 56m
Merged PRs (30d)
2

Description

When imports are added through isort's add_imports, existing imports with the isort: skip comment are moved around.

For example with the following config

[settings]
add_imports=import a

these imports

import stay_on_top  # isort: skip
import b

are sorted into (and the skip goes into its own section for some reason)

import a
import b

import stay_on_top  # isort: skip

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the example with an isort configuration using add_imports=import a and an import marked with isort: skip. Trace the handling of added imports and skipped imports, then verify that the skipped import remains in its original position and is not moved into a separate section.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.