PyCQA / PyCQA/isort

Firstparty + `from ... import ...` corner case

Open
#2,167 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

👋

I come from pantsbuild land! I'm looking at trying to help world-model in this issue

One attempt was to specify each "known" module that we're going to supply (with -p=...) but ran into an interesting corner case.

Given

import requests

from subdirA import fileA

Running isort -p=subdir.fileA file.py (where subdir.fileA isn't in the sandbox we're running isort in) puts both imports together.
Whereas:

import requests

import subdirA.fileA

doesn't.

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

Reproduce the two import examples with file.py and the -p option, first checking how isort classifies the from-import versus the plain import when the supplied module is absent. Trace the classification path for this corner case and define the expected grouping before adding a focused regression test; done means both equivalent forms receive consistent, documented treatment.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.