20 ATOM Plug-ins For Python Development

20 ATOM Plug-ins For Python Development

Image for post

1. IDE-python package

Feature Providers

  • Jedi for Completions, Definitions, Hover, References, Signature Help, and Symbols
  • Rope for Completions and renaming
  • Pyflakes linter to detect various errors
  • McCabe linter for complexity checking
  • pycodestyle linter for style checking
  • pydocstyle linter for docstring style checking
  • autopep8 for code formatting (preferred over YAPF)
  • YAPF for code formatting

Installation Language Server Install the language server (0.19.0 or newer) with.

python -m pip install ‘python-language-server[all]’

This command will install the language server and all supported feature providers, which can be enabled or disabled in the settings.

You can verify that everything is correctly installed by running python -m pyls –help from the command line. It should return

usage: pyls [-h] [–tcp] [–host HOST] [–port PORT][–log-config LOG_CONFIG | –log-file LOG_FILE] [-v]Python Language Server…

If you have installed pyls using a non default installation of Python, you can add modify the Python Executableconfig in the ide-python settings.

Atom Package Install ide-python and atom-ide-ui from Install in Atom?s settings or run.

apm install atom-ide-uiapm install ide-python

Configuration

  • pycodestyle: discovered in ~/.config/pycodestyle, setup.cfg, tox.ini and pycodestyle.cfg
  • flake8: discovered in ~/.config/flake8, setup.cfg, tox.ini and flake8.cfg

The configuration is computed first from user configuration (in home directory), overridden by configuration in the ide-python settings, and then overridden by configuration discovered in the current project.

2. atom-python-run package

Run your python (.py) source file using F5 or F6!

Prerequisite

  • Atom Text Editor (nightly or latest stable release)
  • Python 2 and/or 3
  • Add Python (and any other interpreters) to the PATH environment variable. Features
  • Using python
  • Almost the same console with python IDLE, which provides syntax error and runtime error messages.
  • It is a rough time based on real time rather than CPU kernel / user time

Compatibility

  • Cross Platform Compatible
  • Runs on Windows, Mac OS X, and Linux
  • True Arbitrary Execution
  • Global python is the default interpreter
  • Execute using any interpreter
  • Pass options to the given interpreter
  • Pass arguments to the program to be executed
  • Python 2 and 3

Note: If you have problems executing, you can install a global version of latest python2.7.x (even if you have python3.x.x installed). Please report any python3 issues if you want to avoid installing a global python2 version.

3. Python Black for Atom editor

Uses Black for formatting Python code.

Requirements Make sure you have black installed and the correct path to binary was set in the package config.

pip install black

Keymap ?ctrl-alt-c?: ?python-black:format? Configuration

python-black:binPath: “black”fmtOnSave: truelineLength: 88skipStringNormalization: false

4. Python Tools

Details This package uses Jedi in addition to other custom code to provide numerous pieces of functionality to make you more productive: Show Usages Default shortcut: ctrl+alt+u

Image for post

Select the usages of a specific symbol in your file. This is for handy for quickly refactoring/renaming variables and other symbols within your code. Currently only supports detection of symbols within the same file. This will be extended to support usages outside the current file in the future. Goto Definition Default shortcut: ctrl+alt+g

Image for post

Go to to the original definition of the symbol under the cursor. This will open the corresponding file if it is not already open. Files which form part of the standard library / are installed as third party modules are still opened, which is a really nice way of analysing and understanding behavior of code. Select String Contents Default shortcut: ctrl+alt+e

Image for post

Select the entire contents of the string currently being selected. Works with single line as well as block strings.

5. atom-python-yapf

Atom.io plugin to format Python files using Google?s YAPF

Install apm install python-yapf Or Settings/Preferences ? Packages ? Search for python-yapf Make sure you have YAPF installed and the correct path to binary was set in the package config. Settings

Image for post

Keymap Currently, there are two commands: python-yapf:formatCode ? for formatting python code python-yapf:checkCode ? for checking format of python code

6. build-python

Installation apm Install build-python from Atom?s Package Manager or the command-line equivalent:

$ apm install build-python

Using Git Change to your Atom packages directory:

# Windows $ cd %USERPROFILE%.atompackages# Linux & macOS $ cd ~/.atom/packages/

Clone repository as build-python:

$ git clone https://github.com/idleberg/atom-build-python build-python

Inside the cloned directory, install Node dependencies:

$ yarn || npm install

Build Before you can build, select an active target with your preferred build option. Available targets:

  • Python ? compile script
  • Python (compileall) ? compile script with -m compileall
  • Python (compileall, optimized) ? compile script with -O -m compileall
  • Python (user) ? compile script with custom settings (interpreter and/or arguments)Shortcuts Here?s a reminder of the default shortcuts you can use with this package:
  • Select active target Cmd+Alt+T or F7
  • Build script Cmd+Alt+B or F9
  • Jump to error Cmd+Alt+G or F4
  • Toggle build panel Cmd+Alt+V or F8

7. Atom-Python-test

Requirements

  • You need py.test installed to use this package:

pip install pytest

  • When using virtualenv, the recommended workflow is:
  • Activate your virtualenv on terminal.
  • Run atom editor, so this plug-in will get py.test from virtualenv (or use atom-python-virtualenv plug-in). Usage 1) Running all tests (Ctrl + Alt + T) 2) Run test under cursor (Ctrl + Alt + C) 3) Hide the execution panel (Ctrl + Alt + H)

The plug-in supports to color the output: tests passed in green and failed in red and also supports to add more execution parameters in the settings.

Image for post

8. run-python-simply package

Run a python file in cmd or Powershell or other Linux terminals.

Usage

  1. Open a .py file.
  2. Press F5 to run.

Features

  • cmd or Powershell
  • Two options for you, cmd and powershell. Choose one you like!
  • CodeBlocks debug console style
  • Show return value and execution time

Config The commands use {file} as a placeholder for the file to run. I redesign the commands format to support linux systems in the future. Now Windows cmd and powershell are available.

Image for post

9. python-indent

Python Indent is the indentation behavior you?ve been waiting for in Atom! You should no longer have to worry about mashing your tab/space/backspace key every time you press enter in the middle of coding. Also, compared to other editors, there is no need to change an app configuration if you want to have a mixture of different types of indents (namely hanging and opening-delimiter-aligned).

The main obstacle with Atom?s native indentation behavior is that it doesn?t yet have the necessary API?s to do what Python?s PEP8 style guide suggests. Enhancement requests and issues have been opened in Atom Core on a few occasions, but none have been resolved yet.

  • language-python ? Auto indent on line continuation with list/tuple
  • atom ? Autoindent not working properly

This package was made to give you expected indentation behavior; python-indent listens for editor:newlineevents in Python source files, and when triggered, adjusts the indentation to be lined up relative to the opening delimiter of the statement or ?hanging? (for parameters, tuples, or lists).

Indent Types Both indent types for continuing lines as described in PEP 0008 ? Style Guide for Python Code are auto-detected and applied by this package.

  • Aligned with Opening Delimiter
  • def function_with_lots_of_params(param_1, param_2, param_3, param_4, very_long_parameter_name, param_6) def function_with_lots_of_params( param_1, param_2, param_3, param_4, very_long_parameter_name, param_6)
  • Setting
  • Hanging Indent Tabs: Number of tabs used for hanging indents

Examples

def current_language_python_package(first_parameter, second_parameter,#<newline>third_parameter):#<—default Atom language-pythonpassdef with_python_indent_package_added(first_parameter, second_parameter,third_parameter):#<–properly dedents to herepassdef with_hanging_indent(first_parameter, second_parameter, third_parameter):passalso_works_with_lists = [“apples”, “oranges”, “pears”, “peaches”, “mangoes”,”clementines”, “etc.”]#<–PEP8 continued indentationor_like_this = [“apples”, “oranges”, “pears”,”peaches”, “mangoes”, “clementines”,”etc.”]

10. python-mrigor package

Integration of mr.igor in atom!

mr.igor is an extension to pyflakes that will learn where you import things from, and then automatically fill in missing imports from the place they are most often imported.

This package integrates mr.igor in your atom editor. Just install mr.igor in your system (pip install mr.igor), and then install this package in atom.

Whenever you save a python file, mr.igor will save all imports, so that you can remember them in any other python file just pushing ctrl-alt-i

11. Python-Debugger package

Keyboard Shortcuts

  • alt-r/option-r: hide/show the debugger view
  • alt-shift-r/option-shift-r: toggle breakpoint at the current line

How to use

  1. Install using APM $ apm install python-debugger language-python The language-pythonpackage provides syntax highlighting
  2. Open the Python file to debug and insert breakpoints
  3. Press alt-r to show the debugger view
  4. Insert input arguments in the input arguments field if applicable
  5. Hit the Run button. Focus moves to the first breakpoint.
  6. Use the buttons provided to navigate through your source. You can enter debugger commands directly in the command field.

The current version should support Python 2.5 and higher, including Python 3. The Python executable to be used while debugging can be changed in the settings.

Image for post

12. python-docstring

Add a simple docstring to your Python code.

Docstring Example

def my_function():”””Do nothing, but document it.No, really, it doesn’t do anything.”””pass

13. aligner-python

Aligner add-on to support Python. Supported operators ::

colors = {“red”: “ff0000″,”blue”: “0000ff”,”yellow”: “ffff00”}

=: assignment

someArray = [0, 1]zero = 0

14. Python Snippets for Atom

Install : apm install python-snippets Features

  • Some important python 3.0 snippets of regular usage.
  • Also includes tkinter snippets for gui-programming in python. Snippets list The tkinter snippets assume that you have imported tkinter as tk import tkinter as tk
  • Normal missing Functionality

15. Python DocBlock Package

Image for post

DocBlock is the package for Atom which helps you to document your python code.

InstalationFrom the command line run apm install docblock-python?

16. Python Nosetests

Image for post

Installation

sudo pip install nose nosetests-json-extended**Usage**When running nosetests for the first time on a project, go to the project root and run the tests from the command line:

(python2) nosetests ? with-json-extended (python3) python3 -m nose ? with-json-extended

This will generate a file nosetests.json which contains, besides the test results, also the required information to re-run the tests.In the Atom editor, open a file that belongs to the project and go to:`Menu -> Packages -> Python Nosetests -> Run (Or press F5)`The Python Nosetests package will now locate the nosetests.json file, run the tests again and show the results.

17. Python line profiler for Atom

Image for post

Requirements

  • Mac OS, or Linux machine (this is not on windows machine)
  • A line_profiler fork is needed to run this extension.

pip install https://github.com/iddl/line_profiler/zipball/master

How to run1) Make sure you?re using the right environment.

This is done by modifying the ?Shell command? option in the settings.

Shell command Default: /usr/bin/python

The default, /usr/bin/python, works for small tests. However it might be the case you’re using virtualenvs and/or running code from a virtual machine.Example setting of running profiler from a virtual environment in a VM.`ssh, [email protected], -t, /home/user/project/venv/bin/python`2) ALT+SHIFT+P to activateThis will show an editor with a Run button.3) Import the function to profile first. The profiler is executed from the parent directory of the profiled code (this doesn’t matter if you choose a custom shell command).Use the profile function to run a profile on your code.The end product should look something like

from test import myfunction profile(myfunction, myargs) `

18. Flag as spam or malicious

python-suite package This package aims to makes atom an even more Python friendly place. Features:

  • Outliner/Navigator More coming soon! Dependencies:
  • python3
  • jedi

19. Python Isort for Atom editor

Install Make sure you have Isort installed and the correct path to binary was set in the package config.

Keymap Currently, there are two following commands:

  • python-isort:sortImports ? for sorting imports

20. python-jedi package

Python Jedi based autocompletion plugin. Features

  • Autocomplete.
  • Goto Definition. Installation
  • Either use Atoms package manager or apm install python-jedi. Install autocomplete-plus before installing this package. Usage
  • python-jedi uses python3 interpreter in your path by default.(i.e., by default Pathtopython field holds value python3).
  • Enter the path to python executable in the settings(Pathtopython field) (eg:/home/user/py3pyenv/bin/python3 or /home/user/py2virtualenv/bin/python). To Use Goto Definition
  • Use the keyboard shortcut ctrl-alt-j.

This post is curated by IssueHunt that a issue-based bounty platform for open-source projects.

IssueHunt offers a service that pays freelance developers for contributing to the open-source code. We do it through what is called bounties: financial rewards granted to whoever solves a given problem. The funding for these bounties comes from anyone who is willing to donate to have any given bug fixed or feature added.

IssueHunt – Boost your issue and boost your happiness

IssueHunt ? = OSS Development ? + Bounty Program ?. IssueHunt is an issue-based bounty platform for open source?

issuehunt.io

14

No Responses

Write a response