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.

2 thoughts on “Make Sublime Text as the best IDE for full stack python development

  1. Pingback: Make Anaconda powered SublimeText as powerful Python IDE for full stack development | Nazrul's Blog

  2. Pingback: Anaconda vs Sublimelinter with Jedi for SublimeText | Nazrul's Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s