Atom как установить python

Обновлено: 03.07.2024

This project has been documented in a fair amount of detail over time. This documentation can be found in the Wiki.

Everyone should take the time to reveiw the Wiki README at the bare minimum. It details an overview on how to handle issues, use different versions, and includes links to primary sections of the Wiki.

Everyone should also take the time to review the Wiki section How do I use atom-python-run?. It covers everything from installation, to configuration, logging, and much more. You just might be surprised by what you can do with atom-python-run.

You should have the basics after having covered both the README and How Do I use atom-python-run? sections. Most FAQ's can be resolved by simply reading them. The guides provided should allow us to help you with what ever issue you're facing.

NOTE: Be sure to read the Wiki and the Wiki README before reporting an issue or making a pull request. A lot of time has been put in to it to help you the user (or dev) get started and on your way.

  • Before newing an issue, check to see if someone else is experiencing any related issues.
  • Check to see if any issues that were closed resemble your issue and re-open it addressing that you're experiencing a similar issue.
  • Provide details about your issue, such as errors and/or logs.
  • Provide reproduction steps (we can't help you if we don't know how to reproduce the error!).

If you're a developer and are interested in this project you can find this repos API's in the Wiki. More specifically, you'll want to take a look at How does the cp module work? and How does the terminal.js module work? sections of the Wiki.

You can also just read the key source files

  • cp (cp is written in python)
  • New an issue if you have any idea of new features.

This is a package for Atom

Steps:

1. Download Atom

Alternatively to bring up the Settings View, you can click on the Install tab, and type the package name you want to install into the Search packages search box.

For the rest of us who actually like to use the terminal window, I provide shell commands below.

2. Download a Linter Package (Source Code Checker)

“Linter is a base linter provider for the hackable Atom Editor. Additionally, you need to install a specific linter for your language. You will find a full list on atomlinter.github.io.

It provides a top-level API to its consumer so that they can visualize errors and other types of messages with ease.”

or, on the command line:

Now we also need to download a language specific linter plugin (I like flake8, but there are choices listed on the atomlinter.github.io page as above:

or, on the command line:

To use this plugin flake8 will need to be installed on your system. If it is not already installed, you can install flake8 by typing the following in a terminal:

3. Download a Python AutoComplete Package and AutoFormatter

“Python completions for packages, variables, methods, functions, with their arguments. Powered by your choice of Jedi or Kite.” Jedi is a locally based library, and thus I myself prefer that one over Kite, which requires an online library.

or, on the command line:

“Uses autopep8 installed to format python code according to pep8 guidelines”

or, on the command line:

4. Download a Script Package

“Run scripts based on file name, a selection of code, or by line number.” This is super useful for testing your code from within Atom instead of going to a different terminal window, and it is powerful because it is selection-based, which means you can run snippets versus whole files.

or, on the command line:

5. Download a File-Icons Package

As I tend to use both Visual Studio Code and Atom, this helps me maintain consistency, and I like them better than the Atom defaults.

or, from the command line:

6. Download a Syntax Highlighting Theme

or, from the command line:

7. Download and Install Minimap

The Minimap package displays a Minimap preview of your file on the right hand side of your editor. The minimap-git-diff and minimap-highlight-selected plugins are also useful.

or, from the command line:

8. Download and install a Jupyter Notebook Plugin

or, from the command line:

Alternatively, you can look at the Hydrogen package:

Hydrogen runs code interactively, allows you to inspect data, and plot. All the power of Jupyter kernels, inside your favorite text editor. It supports Python, R, JavaScript and other Jupyter kernels.

Checkout the Documentation and Medium blog post to see what you can do with Hydrogen.

9. Improve version control support for Atom

  • git-control
  • git-plus
  • git-blame
  • git-time-machine
  • gitlab
  • open-on-bitbucket

10. Using version control (or cloud drives) for configuration portability

Use to version control your Atom config file, and any other config files that you may have.

You can then host and clone your Git repository on Github, gitlab, Bitbucket, etc., and retrieve it on other computers simply by running:

As with any other source-control repository, you can then keep it up to date (to upload changes) and (to download changes).

As mentioned in the note at the beginning of the article, in order to track a common list of installed packages, at the terminal shell execute:

And then add that file to you source-controlled Git repository also.

To install the packages automatically back into a fresh installation of Atom:

An example of my file is as below:

Conclusion

As a developer who wants to reduce the amount of window/application switching as much as possible and create repeatable workflows, I hope that you find this equally useful. I look forward to your comments and suggestions for improvements!

Agree or disagree with some of the ideas presented in this article? Let
us know your thoughts on Digg.

Looking for more coding articles? Subscribe to our newsletter in the footer below!

In this article, I demonstrate how you can setup and maintain a python friendly development environment from within Atom. Ideally, a developer wants to reduce the amount of window/application switching as much as possible and create repeatable workflows.

Contrary to the above parody cartoon, Atom is a respectable editor and keybinding plugins are available for those of us that grew up with Emacs and Vim so that we can have a mouse-free coding experience.

Atom was developed initially from with Github, but by it’s open-source and extensible nature, a strong community that provides support and additional plugin functionality, it has become a very powerful – but free – tool for development.

I use Atom primarily for Python, Julia, shell script and web-development. In a separate article I (will) show how to setup Microsoft Visual Studio Code in a similar manner. Code is also open-source, free, and supported by a large community, and it has advantages if you also code for various compilers and proprietary databases.

Note: Towards the end of this article I discuss how you can automate the saving of a list of all of your plugins so that you can reinstall them as a group later, keep in a code repository, or migrate to a new development machine. Myself, I keep my configuration in the cloud, so I can continue to work at a client location with a predictable setup.

These instructions are tested and valid for and and up. (It may work for earlier versions of Atom, but untested.)

Requirements

ide-python requires Atom 1.21+ , Python language server 0.29+ and the atom-ide-base package to expose the functionality within Atom.

Important

Please note that atom-ide-ui is now deprecated, therefore, you must use the packages supplied from atom-ide-community as mentioned above. Links are also provided for more information.

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
  • Pylint linter to detect various errors
  • Flake8 linter to detect various errors
  • pydocstyle linter for docstring style checking
  • autopep8 for code formatting (preferred over YAPF)
  • YAPF for code formatting

I think this package is bad news.

Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.


Изначально считаем что у Вас установлена поддерживаемая операционная система, Node.JS и Atom. В примерах мы работаем в OpenSUSE (13.1) в нём (и вообще в дистрибутивах *nix) уже «из коробки» обычно есть не только Python но PHP и другие языки программирования. Так же исправно работает на Ubuntu (>12.04). Если у Вас Windows 7 или 8, а раньше Вы с ними (языками) не работали то их предварительно необходимо скачать и установить.
Примечание: перед началом работы желательно запускать Atom под root.
опыт показывает — работает стабильнее

Linter

Идеология Atom к подсветке в том, что основным пакетом для работы с синтаксисом и его анализа будет Linter, который является верхним уровнем в API для других линтеров кода. Это сделано для прекращения «войны между плагинами» (The idea is to stop the linter plugins war, by providing a top level API for linters to parse and display errors in the Atom editor). Тем не менее, не все сторонние разработчики придерживаются этой идеологии и пишут свои плагины.

  • linter-php , для PHP `php -l`
  • linter-phpcs , для PHP, `phpc`
  • linter-phpmd , для PHP, `phpmd`
  • linter-pylint , для Python, `pylint`
  • linter-pyflakes , для python, `pyflakes`
  • linter-pep8, для python, `pep8`
  • linter-flake8, для python, `flake8`
  • linter-javac , для Java, `javac`
  • linter-jshint , для JavaScript and JSON, `jshint`
  • linter-jscs , для JavaScript, `jscs`
  • linter-scss-lint , для SASS/SCSS, `scss-lint`
  • linter-coffeelint , для CoffeeScript, `coffeelint`
  • linter-csslint , для CSS, `csslint`
  • linter-rubocop , для Ruby and Ruby on Rails, `rubocop`
  • linter-tslint , для Typescript, `tslint`
  • linter-xmllint , для XML, `xmllint`
  • linter-shellcheck , для Bash, `shellcheck`
  • linter-scalac , для Scala, `scalac`
  • linter-clang , для C / C++, `clang`
  • linter-ruby , для ruby, `ruby -wc`
  • linter-lua , для Lua, `luac -p`

Пакет Script: запуск программ из Atom

Script — пакет для запуска кода в atom.

Установка пакета Script, возможна из командной строки:


или меню
Packages->Settings View->Install->Packages

В результате должны поддерживаться следующие языки (26):

Каждый язык работает, при наличии предварительно установленного компилятора / интерпритатора.
Пакет Script обновляется довольно часто. Например поддержка Swift появилась менее двух недель назад. Так что скорее всего в ближайшее время появится поддержка новых языков.

Для запуска программы необходимо выбрать
Packages-->Script-->Run


Дополнительные опции можно найти в документации либо на страницах Atom`а или проекта.

Для функционирования должен быть создан рабочий каталог.
Путь к нему нужно прописать здесь:
Packages-->Script-->Configure Script-->Current Working Directory
Заявку разработчикам на поддержку нового языка можно оставить здесь (отвечают быстро)


И немного юмора от разработчиков пакета Script,
у которых, судя по всему, спрашивают всё на свете:

первод: Атом не может найти Нод | Руби | Питон | Мои носки

Python

Поддержка подсветки этого языка идёт изначально. Пакеты для работы с синтаксисом и отладки:
Linter + Language Python + Linter Python Pep8 + Script


Script запускает код на Python, а Linter и Linter Python Pep8 покажут синтаксические ошибки.
Возможно Вам, для работы с Python также поможет Atom Python Debugger.
Подсветка ошибок и запуск после установки будут выглядеть так:

Atom показывает ошибки синтаксиса и запускает php скрипт:




Swift

Подcветка синтаксиса swift работает на любом дистрибутиве после установки пакета Language Swift:



Терминал

Для запуска исполняемого кода С, C++, Java иногда проще использовать сторонний пакет (не пакет Atom, а пакет вашего дистрибутива), который запускается через терминал, поскольку сам Atom поддерживает большое количество языков. Если Atom выступает в качестве редактора кода, a терминал рядом запускает его — это очень удобно для нас, поскольку терминал не имеет такое преимущество редактирования, как Atom.
Для запуска терминала в окне Atom установите пакет Term. Для запуска терминала в окне Atom выбрать
Packages-->Command Palette-->Toggle и Term
с нужными параметрами.


В заключении ещё один интересный кликабельный анимационный gif от разработчиков script, ссылки.

  • Open with Desktop
  • View raw
  • Copy raw contents Copy raw contents

Copy raw contents

Copy raw contents

atom icon

Почему Atom? Для меня выбор был прост. Если говорить о редакторах, то он просто проще, чем vim или emacs. Может быть когда-нибудь я осилю какой нибудь из этих редакторов, но, пока я ещё не научился достаточно хорошо программировать, хочется больше уделять времени именно программированию. Можно использовать PyCharm - он реально удобен и прост в освоении, но тут стоит учитывать, что в бесплатной версии нет множества крутых фишек, таких, как поддержка веб-фреймворков, работы с б.д., крутой поддержки js и т.д. А так как я программист начинающий, хочется использовать минимум денежных вложений. (Тут, конечно есть обходные пути: Студенческая лицензия(Для обучения), Лицензия для свободных продуктов(У меня продуктов пока вообще нет. Поэтому тоже отпадает), Использование ключей с трекеров и т.д.(Кому как совесть позволяет)). Поэтому Atom. Он легок в использовании, бесплатен, гибок и т.д. Нужно только его чуть настроить.

Вступление получилось больше чем хотел, поэтому перейдём сразу к делу.

Настройка atom, в общем, заключается просто в установке и настройке нужных пакетов. Процесс установки очень прост - заходим в настройки(В Linux и OS X "Edit"-"Preferences"-"Install", в WINDOWS - "File"-"Settings"-"Install". Можно просто использовать сочетание клавиш "Ctrl + ,", когда запомнишь получается быстрее.), вбиваем в строку поиска нужный пакет, находим его в результат и жмём "Install".

И так, плагины для Python:

https://atom.io/packages/autocomplete-python Пакет справляется с подстановкой не только связанной с данным файлом, но также и с подстановкой объектов импортированных из других файлов. Так же может сразу подставлять имена аргументов функций. Всё довольно интуитивно и просто. Если Вы используете виртуальное окружение(Если ещё не используйте, начните - это очень удобно!) в настройках пакета нужно указать (Я, обычно все проекты организую по одинаковой схеме, так удобнее при создании новых проектов - не нужно менять настройки. Папку с виртуальным окружением я ложу в корень проекта и называю "env". Пакет autocomplite-python использует переменную $PYTHON для указания корня проекта.):

  • Python Executable Paths - путь к бинарнику python. В моем случае: "$PROJECT/env/bin/python3".
  • Extra Path For Packages - путь к импортируемым пакетам. Тут тоже всё просто - указываем site-packages виртуального окружения и папку проекта(на тот случай если папка проекта у нас будет добавляться в PYTHONPATH, например как при использовании Django, чтобы импортировать от корня проекта). В моём случае: "$PROJECT/env/lib/python3.5/site-packages;$PROJECT".

В общем-то всё. По мимо этих настроек пакет содержит множество других, о которых можно прочитать на странице пакета.

Поиск ошибок и анализ качества кода

  • Executable - путь к файлу pylint. Например, он может быть таким: "%p/env/bin/pylint".

Также в настройках нужно указать путь к импортируемым модулям.

  • Python path - путь к импортируемым модулям. В моём случае: "%p/env/lib/python3.5/site-packages".

Также linter-pylint использует пакеты atom: lint и linter, поэтому они тоже должны быть установлены.

Python language support for Atom-IDE, powered by the Python language server.

I think this package is bad news.

Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.





Installation

Language Server

Install the language server (0.29.0 or newer) with:

This command will install the language server and all supported feature providers, which can be enabled or disabled in the settings. Checkout the official installation instructions on how to install only the providers you need.

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

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

Atom Package

Install ide-python and atom-ide-base from Install in Atom's settings or run:

To use the debugger you need to install atom-ide-debugger and atom-ide-console as well:

Debugger (experimental)

After installation of the above packages:

  • Open the file you need to debug
  • Use CTRL+SHIFT+P and run "Show Debugger" to show the debugger pane
  • Click add target button and fill the information
  • Debug your application like the gif

Contributing

Always feel free to help out! Whether it's filing bugs and feature requests or working on some of the open issues, Atom's guide for contributing to packages will help get you started.

Configuration

Configuration is loaded from zero or more configuration sources.

    pycodestyle : discovered in

Overall 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.

License

MIT License. See the license for more details.

Читайте также: