Skip to content

Commit

Permalink
Implemented PyCQA#970: Support for custom sharable isort profiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycrosley committed Jul 25, 2020
1 parent 5f3c166 commit 2d76984
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ NOTE: isort follows the [semver](https://semver.org/) versioning standard.
- Implemented #1261: By popular demand, `filter_files` can now be set in the config option.
- Implemented #960: Support for respecting git ignore via "--gitignore" or "skip_gitignore=True".
- Implemented #727: Ability to only add imports if existing imports exist.
- Implemented #970: Support for custom sharable isort profiles.
- `# isort: split` can now be used at the end of an import line.
- Fixed #1339: Extra indent is not preserved when isort:skip is used in nested imports.

Expand Down
6 changes: 6 additions & 0 deletions isort/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ def __init__(
profile_name = config_overrides.get("profile", config_settings.get("profile", ""))
profile: Dict[str, Any] = {}
if profile_name:
if profile_name not in profiles:
import pkg_resources

for plugin in pkg_resources.iter_entry_points("isort.profiles"):
profiles.setdefault(plugin.name, plugin.load().PROFILE) # pragma: no cover

if profile_name not in profiles:
raise ProfileDoesNotExist(profile_name)

Expand Down

0 comments on commit 2d76984

Please sign in to comment.