PyCQA / PyCQA/isort

Documentation for what conditions are needed to detect each module type

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

Firstly thanks for isort, I've incorporated it into my projects recently and it's great!

I've noticed some subtleties in how imports are classified, particularly for imports that should be treated as first-party but may be picked up as third-party depending on the working directory and configuration (e.g. #1497).

I'd find it really helpful if the documentation had a "cheat sheet" on the rules/conditions that lead to an import being classified as FUTURE / STDLIB / THIRDPARTY / FIRSTPARTY / LOCALFOLDER (especially first party as mentioned), and if relevant how these can be configured (e.g. with known first-party or similar). Apologies if this already exists but I've struggled to find it.

The specific case that's left me scratching my head is running isort --verbose --check-only broken.py from this directory in this repo detects mypackage as third-party rather than first-party. However, if I set up a simple example elsewhere then it seems to get correctly identified as first-party as long as isort is run in the same directory. So I think there's something about the config/file structure of that linked repo which causes a different result.

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

Run isort --verbose --check-only broken.py from the linked examples/isort directory and compare it with the simple example that classifies mypackage as first-party. Document the conditions for FUTURE, STDLIB, THIRDPARTY, FIRSTPARTY, and LOCALFOLDER, including relevant configuration such as known first-party, and explain the differing result.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 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.