Anaconda vs Sublimelinter with Jedi for SublimeText

SublimeText is undoubtedly one of the most popular editor right now over million of software / web developers. The developer is using SublimeText as IDE usually, rather than using as plain text editor,  by making  IDE like features with the help from some great packages  available in free of cost.  For python development environment, Anaconda is all-in-one package for transforming to be IDE, in the other hand Sublimtelinter with Jedi combination one of the best method for enabling sublimetext to provide IDE like features. Both two have pros and cons, i will discuss bellows about my experiences for both.

Anaconda

Pros

  1. Most importantly, this all-in-one kind package and with no dependency, that means you don’t have headache to install multiple packages and separate configurations.
  2. Easy configuration and well documented.
  3. Numbers of active contributors and continuous development, see details
  4. Very faster linting process after introducing json server.
  5. McCabe code complexity checker

Cons

  1. Some time I discovered old problem come again with latest version, that is hanging on my sublimetext (may be one of the cause could be for big file (more than ten thousands of line)).
  2. There is no support for flake8, see discussion here. Although  anaconda linting is working with pyflake and pep8 combinely means likely to be same as flake8, but more just pyflake and pep8, flake8 has lots of cool plugins, you will miss those.
  3. Working with json server might easy, depends on Operating System you are using.

Sublimelinter and Sublime-Jedi

Pros

  1. This combination approach is like that you gather all good packages and using it. Sublimelinter is the best linting framework for SublimeText, in the other hand Jedi is one the best autocomplete library that is welly ported to Sublime, thanks author of SublimeJedi
  2. Jedi provides nice (CTRL+SHIFT+G) explorer (Go Defination) feature, you could go to the reference import very quickly, beside you could easily add extra python package paths those will be auto included to Jedi’s sys path.
  3. Sublimelinter is framework for linting, there are lots of plugins available, for python I would like to use flake8 but you may keen to use pylint, that is also available.
  4. Sublimelinter is working very fast and also has lots of configuration options, so that you could customize as your wish.

Cors

  1. I don’t find so much negative side to using this combination. But I find there is not much development activity on Github.
  2. Some rare case, jedi might not working (not sure if it is caused by Sublimetext or jedi itself)

 

We saw the simple comparison between two approach. In my opinion for novice user, they could go with Anaconda as this is very easy to adapted and configure. But in contrast of beginner user of sublimetext, I would suggest, professional developer should definitely with go with Sublimelinter specially if he/she is a full stack developer as it (Sublimelinter) has variety of plugins for different language/markup i.e css, javascript, html, json, yml and more.

Make Anaconda powered SublimeText as powerful Python IDE for full stack development

Like so many SublimeText lovers, Me as a python developer, it is also one of the favorite editor, I am using but I would like to use  it as full featured IDE. You will find many articles, blogs about how SublimeText can be transformed as pure IDE, but here i will discussed about the most easy way to turn your sublimetext as IDE for full stack python development.

Anaconda  is the single package that is capable to make your editor (SublimeText) as IDE for python development. It has almost all IDE like features, i.e linting, autocomplete, etc. You could say this is all-in-one package, with no third party dependency like SublimeLinter . One of the positive things that it is in continuous development by involvement of many contributors, so you can report any bug/error and the highest possibility, we will get the solution. They have very good documentation as well.

Install and Configuration is easy enough, I would suggest you follow instruction  from their official site, for advanced configuration you could follow here. It is good practice that you make user specific settings those are common for all your projects. Follows are example user settings.

{
    "auto_formatting": true,
    "auto_python_builder_enabled": false,
    "anaconda_linting": true,
    "anaconda_linter_phantoms": false,
    "validate_imports": true,
    "enable_signatures_tooltip": false,
    "merge_signatures_and_doc": false,
    "pep8_max_line_length": 120
}

If you saw the example configuration above, I intentionally set the value of  `pep8_max_line_length` is 120 (default is 80), in the other hand you will see that i don’t mention the path of python interpreter because it should goes on project specific settings (*.sublime-project) if you use individual interpreter(i.e virtualenv) for each project.

{
	"build_systems":
	[
		{
			"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
			"name": "PRS:: Anaconda Python Builder",
			"selector": "source.python",
			"shell_cmd": "{virtualenv path}/bin/python -u \"$file\""
		}
	],
	"folders":
	[
		{
			"path": "."
		}
	],
	"settings":
	{
		"python_interpreter": "{virtualenv path}/bin/python"
        }
}  

If you are using buildout for your project development, we have good news for you! There is a recipe plone.recipe.sublimetext for anaconda settings, this recipe will do for you to generate project specific settings. Followings are possible buildout settings for you (but you could do add  more custom option)

[buildout]
parts += 
     sublimetext
[sublimetext]
recipe = plone.recipe.sublimetext
eggs = ${instance:eggs}
anaconda-enabled = True
anaconda-linting-enabled = True
anaconda-completion-enabled = True
anaconda-validate-imports = True

 

Make Sublime Text as the best IDE for full stack python development

Preface

Nothing says from me about Sublime Text 3, I assume you already  know about this nice editor. I can quote from realpython.com blog a very nice article about transforming editor to IDE, published there, I would recommend you look first at there.

Sublime Text 3 (ST3) is lightweight, cross-platform code editor known for its speed, ease of use, and strong community support. It’s an incredible editor right out of the box, but the real power comes from the ability to enhance its functionality using Package Control and creating custom settings.

Unlike above article (from realpython), this article is more specific tutorial like discussion, where you don’t need to more analysis about listed plugins, configurations (of course after starting you will do experiment with all, may find out something I did wrong or need improvement). The main target here, keep ST3 fast as it’s original but with sexy looking and featured with python based development tools and utilities. Bellows demonstration,  I got inspiration from that blog of course and also some of my real life experiences. In this writing, all settings, configurations are based on  Sublime Text 3  build 3126.

Install Sublime Text 3 (ST3)

Actually here nothing much to say about installation of ST3, because they have very good documentation and easy to install binary for all platform. If your OS is not Ubuntu, please ignore following step, because here discussion about install ST3 at Ubuntu in better way.

Good news that we have Ubuntu PPA for ST3, thanks to [@webupd8team] . I would recommend you to install ST3 from ppa, it will gives you lots of flexibility.  Steps are following:

  1. Open your terminal
  2. Add ppa : `~$ sudo add-apt-repository ppa:webupd8team/sublime-text-3`
  3. Install ST3: `~$ sudo apt-get update && sudo apt-get install sublime-text-installer`

Install Required ST3 Packages (Plugins)

First of all you have to install Package Control, please follow corresponding instruction and make sure it is installed. Followings are list of packages (some are required, some are optional and some are recommended)

  1. AdvancedNewFile
  2. AutoPEP8
  3. Git
  4. GitGutter
  5. Gitignore [optional]
  6. Solarized Color Scheme [optional but recommended for good looking]
  7. SideBarEnhancements
  8. SublimeJedi
  9. SublimeLinter
  10. SublimeLinter-annotations
  11. SublimeLinter-csslint
  12. SublimeLinter-flake8 [swipeable with pylint and should one of two]
  13. SublimeLinter-pylint [like no.10 should be choose one of two]
  14. SublimeLinter-html-tidy
  15. SublimeLinter-jshint [nice to have for web application, please follow it’s own documentation before active it]
  16. SublimeLinter-json
  17. SublimeLinter-pyyaml
  18. ProjectManager [optional]
  19. PackageResourceViewer [optional]
  20. Pandoc [optional]
  21. MarkdownEditing [optional]
  22. Markdown Preview [optional]
  23. Restructured​Text Improved [optional]

It is recommended that you install all packages using `Package Control` but you could also install manually, in that case please follow corresponding documentation.

Instruction for installing packages using Package Control

  1. Install Package Control if you haven’t yet.
  2. Use cmd+shift+P then Package Control: Install Package
  3. Search for  certain package, should be appeared in list and install it.
  4. You might need close ST3, to see all changes

Packages selection for `Sublime Text 3` has no restriction, I suggest you explore more packages as much as possible, but always keep in mind that many packages install at a time might enriched your Sublime Text‘s features but in the meantime will keep it busy too! as a result performance decreasing. Plugin/Package you should install and use, only if you know that why need it(package), how it is working, other than any unnecessary package you should avoid and also make sure different packages are not overlapping same feature.  Above listed packages are safe and necessary, but here also depends on development environment, you could add/remove packages from that list.

Note: some of packages need executable path is available at `PATH` variable to work, i.e flake8,  pylint, csslint, etc. Please follow each package documentation. 

Sublime Text 3 Settings

User Setting:

To find user settings, might vary from earlier version to new version. Example from `Sublime Text 3  build 3126` user settings is not directly available in menu, instead you will open default settings (`Preferences > Settings `),  two columns will be opened and one of this is user settings; beside earlier version you will find User Settings directly (`Preferences > Settings User`)

{
    "auto_complete_triggers": [{
        "characters": ".",
        "selector": "source.python"
    }],
    "color_scheme": "Packages/Solarized Color Scheme/Solarized (light).tmTheme",
    "font_size": 12,
    "ignored_packages": [
        "Markdown",
        "RestructuredText",
        "Vintage"
    ],
    "show_line_endings": true,
    "tab_size": 4,
    "translate_tabs_to_spaces": true,
    "trim_automatic_white_space": true,
    "trim_trailing_white_space_on_save": true
}

Above is the basic user settings, you could add more settings, documentation here

Sublime Jedi Settings

  1. Go to Preferences -> Package Settings -> Package Setting -> Jedi -> Settings User 
{
     "auto_complete_function_params": "required",
     "sublime_goto_layout": "single-panel"
}

More settings options could be found here

SublimeLinter Settings

  1. Go to Preferences -> Package Settings -> Package Setting -> SublimeLinter -> Settings User
{
    "user": {
        "debug": false,
        "delay": 0.25,
        "error_color": "D02000",
        "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
        "gutter_theme_excludes": [],
        "lint_mode": "background",
        "linters": {
              "annotations": {
                   "@disable": false,
              },
              "csslint": {
                "@disable": false
              },
              "flake8": {
                   "@disable": false,
                   "max-complexity": 15,
                   "max-line-length": 120
              },
              "htmltidy": {
                "@disable": false
              },
              "jsl": {
                "@disable": false
              },
              "json": {
                  "@disable": false
              },
              "pyyaml": {
                 "@disable": false
              }
         }
    }
}

More about settings, you could find it’s own documentation.

AutoPep8 Settings

  1. Go to Preferences -> Package Settings -> Package Setting -> AutoPep8 -> Settings User 
{
    "max-line-length": 120
}

Known Issues

  1. Sublimelinter-flake8
  2. //platform.twitter.com/widgets.js

Per project settings (sublime-project file)

One of the great feature of Sublime Text is that you could make project specific editor settings (may you already know about it.),  more details here . If you are developing buildout based python project, `plone.recipe.sublimetext` for you!  this is good tool that will manage your project file more effectively.