Question: how to force a sub-package to be separated to another group?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7k
- Forks
- 687
- Avg merge
- 4h 56m
- Merged PRs (30d)
- 2
Description
Hello, first of all I would like to thank the author and maintainers for the excellent tool!
I have been using isort for years in a row now, but recently I came up with an interesting situation that I have never found before:
In one project I am vendoring an external dependency (because I need to apply some patches to it before using), so I have a project layout similar to the following:
.
└── src
└── <mypkg>
├── __init__.py
├── ...
└── _vendor
├── __init__.py
├── <deppkg>
│ ├── LICENSE
│ ├── ...
│ └── __init__.py
└── vendoring_instructions.rst
I would like to have my from ._vendor import ... import statements separated from the imports of the local package (from . import ...).
Is there any way of achieving that by changing isort's configuration?
I tried the following:
# .isort.cfg
[settings]
profile = black
known_first_party = <mypkg>
known_third_party = ._vendor
# ALSO TRIED: known_third_party = <mypkg>._vendor
# ALSO TRIED: known_third_party = _vendor
But that does not seem to pull of the trick (or maybe I am doing something wrong here).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the .isort.cfg settings shown and read how known_first_party and known_third_party classify relative imports. Reproduce the example with the local package and its _vendor sub-package, then determine whether configuration can create the requested separation and clarify the supported behavior or documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100