thijsdezoete/sublime-text-isort-plugin — pull request #14 by jpvanhal (2014-09-07 16:45:51+00:00)
Title: Use external Python interpreter to execute isort

This PR changes `sublime-text-isort-plugin` to use external Python interpreter instead of Sublime Text's integrated interpreter to execute `isort`. It is possible to configure the Python interpreter the plugin uses globally and by project with `python_bin` setting. This affects how `isort` groups the imports.

For example, if Sublime Text's integrated or system's default Python interpreter is used to sort the import, the result might look like this:

```python
from functools import wraps

from flask import redirect, render_template, request, url_for
from flask.ext.login import current_user
from flask.views import View
from myproject.extensions import db
from werkzeug.urls import url_decode
```

But if I change `python_bin` in the project settings to point to the Python interpreter of project's
virtualenv, `isort` correctly puts imports from `myproject` to a separate group:

```python
from functools import wraps

from flask import redirect, render_template, request, url_for
from flask.ext.login import current_user
from flask.views import View
from werkzeug.urls import url_decode

from myproject.extensions import db
```

### Other improvements

- Moved all dependencies under `vendor/` directory so that the project root would not be so cluttered.

- Upgraded dependencies to latest versions:

- `isort` to 3.9.0
- `pies` to 2.6.1
- `natsort` to 3.5.0

- Began to use Git subtrees to manage dependencies:

- I first added the dependencies as remotes:

```
$ git remote add -f natsort https://github.com/SethMMorton/natsort.git
$ git remote add -f pies https://github.com/timothycrosley/pies.git
$ git remote add -f isort https://github.com/timothycrosley/isort.git
```

- Then I added each dependency as subtree:

```
$ git subtree add --prefix vendor/natsort natsort 3.5.0 --squash
$ git subtree add --prefix vendor/pies pies 2.6.1 --squash
$ git subtree add --prefix vendor/isort isort 3.9.0 --squash
```

- To update the dependencies at a later time:

```
$ git fetch isort master
$ git subtree pull --prefix vendor/isort isort --squash
```

where `` is the Git tag of the newer version of the dependency.

- For more information, see [Alternatives To Git Submodule: Git Subtree](https://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/)

- Added menu items and commands to open plugin's default and user settings.

### Drawbacks

- It is no longer possible to configure parameter's passed to `isort` using Sublime Text's settings. Previously `"isort"` object from Sublime Text's active view's settings was passed to `SortImports` as `**kwargs`. However, the plugin now sets `--settings-path` to the directory where the isorted file is located in. That means you can now use the standard mechanisms of `isort` to configure its behaviour (`.isort.cfg`, `.editorconfig`, `setup.cfg`, etc.).