Skip to main content

SublimeText configuration for buildout-based Python projects

Project description

Egg Status Travis Build Status Test Coverage Python Versions Latest Version License

Introduction

plone.recipe.sublimetext is for ST3 lover who wants python IDE like features while developing python Buildout based project. This tool will help you to create per project basis sublimetext settings with appropriate paths location assignment. Currently plone.recipe.sublimetext comes with supporting settings for Jedi, Sublimelinter, Sublimelinter-Flake8, Sublimelinter-Pylint. A general question may arise that why we will use this tool, weather we can create ST3 project settings easily (we have better knowledge over ST3 configuration)? Well i completely agree with you, but if you want to get benefited from Jedi’s python autocompletion feature (basically I am lover of autocompletion), you have to add all eggs links for Jedi’s paths settings and it is hard to manage eggs links manually if the size of project is big (think about any Plone powered project), beside Sublimelinter-Pylint also need list of paths to be added to sys.path to find modules.

Installation

Install plone.recipe.sublimetext is simple enough, just a section for sublimetext to your buildout. Before using plone.recipe.sublimetext make sure Jedi, Sublimelinter, Sublimelinter-Flake8 and/or Sublimelinter-Pylint plugins are already installed at your ST3. You could follow full [instruction here] if not your ST3 setup yet.

Example Buildout::

[buildout] parts += sublimetext

[sublimetext] recipe = plone.recipe.sublimetext eggs = ${buildout:eggs} jedi-enabled = True sublimelinter-enabled = True sublimelinter-pylint-enabled = True

Available Options

eggs

Required: Yes

Default: None

Your project’s list of eggs, that going to be added in path location for Jedi and Sublimelinter-Pylint.

overwrite

Required: No

Default: False

This option indicates wheather existing settings should be cleaned first or just updating changes. This situation may happen, you did create settings file manually with other configuration (those are not managed by plone.recipe.sublimetext) and you want keep those settings.

python-executable

Required: No

Default: plone.recipe.sublimetext will find current python executable path.

The python executable path for current project, if you are using virtual environment then should be that python path. FYI: ${home} and ${project} variable should work.

project-name

Required: No

Default: if you have a existing ST3 project file(settings file) in project/buildout root directory, plone.recipe.sublimetext will choose it as project-name, other than project/buildout directory name will become as project-name

The settings file name (no need to add suffix .sublime-project)

jedi-enabled

Required: No

Default: False

This option related to enable/disable Sublime Jedi

sublimelinter-enabled

Required: No

Default: False

Weather Sublimelinter you want to use this feature or not.

sublimelinter-pylint-enabled

Required: No

Default: False

Sublimelinter-Pylint if you want to use or not; sublimelinter-enabled option will be respected, means if parent option is set as disabled but you enable this option will not work.

sublimelinter-flake8-enabled

Required: No

Default: False

wheather you want to use Sublimelinter-Flake8 or not. Like sublimelinter-pylint-enabled parent option will be respected.

sublimelinter-flake8-executable

Required: No

Default: False

Project specific Flake8 executable path, this will gives you lots flexibility over using global Flake8 executable, because each project might have separate Python version.

anaconda-enabled

Required: No

Default: False

This option is related to weather you want to enable Anaconda the python IDE package!

anaconda-linting-enabled

Required: No

Default: True

If want to other library for liniting (i.e sublimelinter), keep it disabled, other than should be enabled. Like other parent options, it will respect parent (anaconda-enabled) option.

anaconda-completion-enabled

Required: No

Default: True

Anaconda is using Jedi for autocompletion, so if you want to use (completion library) other than provided by Anaconda, make it disabled.

anaconda-pylint-enabled

Required: No

Default: False

By default Anaconda liniting doing validation for PyFlakes, PEP8, PEP257. But you can use Pylint instead of PyFlakes by enabling this option.

anaconda-validate-imports

Required: No

Default: True

It is always good that you want to see any invalid imports (for example: from fake.foo import bar), but if you don’t want this just disabled this option.

anaconda-pep8-ignores

Required: No

Default: ‘’

If you want ignore some pep8 checklist (i.e N802), for case of muiltiple codes have to be separated by space or newline.

ignore-develop

Required: No

Default: False

If you don’t want development eggs, should go for autocompletion.

ignores

Required: No

Default: “”

If you want specific eggs should not go for autocompletion.

packages

Required: No

Default: “”

Location of some python scripts or non standard modules (don’t have setup file), you want to be in system path.

Known Issues

  • Sublimelinter-Flake8 might stop working if flake8-plone-api is installed as until 1.2 version, flake8-plone-api don’t support SublimeText (linting), see pull request here . That means upcoming version will support hopefully. It could happen, either you are using global or virtualenv flake8. You can see error in ST3 console:

    flake8_plone_api-1.2-py2.7.egg/flake8_plone_api.py", line 16, in run
    with open(self.filename) as f:
    IOError: [Errno 2] No such file or directory: 'stdin'

Example Usage

Minimal buildout::
>>> write('buildout.cfg',
... """
... [buildout]
... develop = .
... eggs =
...     zc.buildout
... parts = sublimetext
...
... [sublimetext]
... recipe = plone.recipe.sublimetext
... project-name = plone-recipe-sublime
... eggs = ${buildout:eggs}
... jedi-enabled = True
... """)
>>> system(buildout + ' -c buildout.cfg')
>>> import os
>>> os.path.exists('plone-recipe-sublime.sublime-project')
True

Standard buildout:

>>> write('buildout.cfg',
... """
... [buildout]
... develop = .
... eggs =
...     zc.buildout
... parts = sublimetext
...
... [sublimetext]
... recipe = plone.recipe.sublimetext
... project-name = plone-recipe-sublime
... eggs = ${buildout:eggs}
... jedi-enabled = True
... sublimelinter-enabled = True
... sublimelinter-flake8-enabled = True
... sublimelinter-flake8-executable = ${buildout:directory}/bin/flake8
... """)
>>> system(buildout + ' -c buildout.cfg')
>>> import json
>>> settings = json.loads(read('plone-recipe-sublime.sublime-project'))
>>> 'flake8' in settings['Sublimelinter']['linters']
True

Muilti Linters and without project name:

>>> write('buildout.cfg',
... """
... [buildout]
... develop = .
... eggs =
...     zc.buildout
... parts = sublimetext
...
... [sublimetext]
... recipe = plone.recipe.sublimetext
... eggs = ${buildout:eggs}
... jedi-enabled = True
... sublimelinter-enabled = True
... sublimelinter-flake8-enabled = True
... sublimelinter-flake8-executable = ${buildout:directory}/bin/flake8
... sublimelinter-pylint-enabled = True
... """)
>>> system(buildout + ' -c buildout.cfg')

(project filename shoul be plone-recipe-sublime.sublime-project as previously generated):

>>> settings = json.loads(read('plone-recipe-sublime.sublime-project'))
>>> 'pylint' in settings['Sublimelinter']['linters']
True

Usages Anaconda for all purpose (linting, autocompletion) and rest of all are not used:

>>> write('buildout.cfg',
... """
... [buildout]
... develop = .
... eggs =
...     zc.buildout
... parts = sublimetext
...
... [sublimetext]
... recipe = plone.recipe.sublimetext
... project-name = plone-recipe-sublime
... eggs = ${buildout:eggs}
... anaconda-enabled = True
... anaconda-pep8-ignores =
...     N802
... """)
>>> system(buildout + ' -c buildout.cfg')
>>> import json
>>> settings = json.loads(read('plone-recipe-sublime.sublime-project'))
>>> 'build_systems' in settings.keys()
True
>>> 'extra_paths' in settings['settings'].keys()
True
>>> settings['settings']['anaconda_linting']
True
>>> settings['settings']['use_pylint']
False

Contributors

Changelog

1.1.0 (2017-06-07)

New features:

1.0.1 (2017-05-16)

Bugfixes:

1.0.0 (2017-05-15)

  • Initial release. [nazrulworld]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plone.recipe.sublimetext-1.1.0.tar.gz (29.1 kB view details)

Uploaded Source

Built Distribution

plone.recipe.sublimetext-1.1.0-py2-none-any.whl (25.3 kB view details)

Uploaded Python 2

File details

Details for the file plone.recipe.sublimetext-1.1.0.tar.gz.

File metadata

File hashes

Hashes for plone.recipe.sublimetext-1.1.0.tar.gz
Algorithm Hash digest
SHA256 456831be501caff3bcc22e0c189a4f73babe16cc0f766da67adf261689668204
MD5 45e73bd05eba6fc6b5aab88acbdece89
BLAKE2b-256 0f109827c570b103298fba9e612c9658fe0a5ab985ffa068309eebf134d15724

See more details on using hashes here.

File details

Details for the file plone.recipe.sublimetext-1.1.0-py2-none-any.whl.

File metadata

File hashes

Hashes for plone.recipe.sublimetext-1.1.0-py2-none-any.whl
Algorithm Hash digest
SHA256 66edcfd3db23b7a77ed0819a0a10bd329ba0ae4c341c80f0b340c9329a1e0a5c
MD5 c0ba54b9222d475d8f286e5f09830387
BLAKE2b-256 46284e5526423425b75980a0f0900542cfba40e0a461c32386f7c44ccae030b4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page