PyCQA / PyCQA/isort

Filter import additions to files by regex/glob

Open
#1,951 0 comments 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

Hi, I'm facing a common use case when I've typings for a package but not for the tests, so I would like to add from __future__ import annotations only for the package that resides under src/ but keep the tests/ without that import.

The current solution is to run isort for the package with --add-import from __future__ import annotations and run again separately for tests without that option.

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 tracing the existing --add-import command option and how it selects files under src/ and tests/. Define how a regex or glob filter should be supplied and applied, then verify that the future import is added only to matching package files while tests remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.