# Sublime for running Python

**URL:** <https://forum.compas-framework.org/t/sublime-for-running-python/41>\
**Category:** compas\
**Created:** [February 6, 2018, 1:34pm UTC](https://forum.compas-framework.org/t/sublime-for-running-python/41 "2018-02-06T13:34:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrewliew](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.compas-framework.org/andrewliew/32/88_2.png) [@andrewliew](https://forum.compas-framework.org/u/andrewliew)\
**Post date:** [February 6, 2018, 1:34pm UTC](https://forum.compas-framework.org/t/sublime-for-running-python/41/1 "2018-02-06T13:34:43Z")

</div>

User question:

“_I downloaded the Sublime Text but I didn’t understand what it would be used to. It doesn’t run applications I guess, so It would be used only for editing the code (compas) itself?_”"

---

<div class="post-metadata">

**Author:** ![andrewliew](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.compas-framework.org/andrewliew/32/88_2.png) [@andrewliew](https://forum.compas-framework.org/u/andrewliew)\
**Post date:** [February 6, 2018, 1:38pm UTC](https://forum.compas-framework.org/t/sublime-for-running-python/41/2 "2018-02-06T13:38:10Z")

</div>

Sublime Text, (latest version 3 can be found [here](https://www.sublimetext.com/)), is a great program for editing **and** running Python scripts. By default you can run (build) a Python `.py` file by pushing **CTRL+B**. A small console will appear at the bottom with the feedback and completion time.

You can also install the add-on package SublimeREPL, which will allow you to interact and debug with the Python terminal after it runs the code, this is not the case for the building method as above. You can find it [here](https://packagecontrol.io/packages/SublimeREPL). I recommend the following shortcuts to easily run a file or line of code in SublimeREPL:

```auto
[
    {"keys": ["f5"], "command": "repl_transfer_current", "args": {"scope": "file"}},
    {"keys": ["f9"], "command": "repl_transfer_current", "args": {"scope": "selection"}},
]

```

The methods will use your base system Python installation, which may not for example be Anaconda (if installed). Both the standard build and REPL methods can be set-up for different Python environments/versions.

---

<div class="post-metadata">

**Author:** ![gonzalocasas](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.compas-framework.org/gonzalocasas/32/127_2.png) [@gonzalocasas](https://forum.compas-framework.org/u/gonzalocasas)\
**Post date:** [February 7, 2018, 8:23am UTC](https://forum.compas-framework.org/t/sublime-for-running-python/41/3 "2018-02-07T08:23:56Z")

</div>

As an alternative, [VS Code](https://code.visualstudio.com/) supports Anaconda and virtualenv environments out of the box, and an interactive debugger as well.

---

<div class="post-metadata">

**Author:** ![andrewliew](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.compas-framework.org/andrewliew/32/88_2.png) [@andrewliew](https://forum.compas-framework.org/u/andrewliew)\
**Post date:** [February 13, 2018, 7:50pm UTC](https://forum.compas-framework.org/t/sublime-for-running-python/41/4 "2018-02-13T19:50:33Z")

</div>

To disable autocomplete when using the REPL console, set the following in the SublimeREPL settings:

```bash
{
    "repl_view_settings": {"auto_complete": false, "tab_completion": false}
}

```

---

<div class="post-metadata">

**Author:** ![andrewliew](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.compas-framework.org/andrewliew/32/88_2.png) [@andrewliew](https://forum.compas-framework.org/u/andrewliew)\
**Post date:** [February 13, 2018, 7:53pm UTC](https://forum.compas-framework.org/t/sublime-for-running-python/41/5 "2018-02-13T19:53:33Z")

</div>

I also recommend the **WordHighlight** package, which shows you word matches in the current file for what is currently under the cursor. Remember you can also use the **CTRL+D** shortcut to select consecutive matches of this word. I use these settings to further enhance the highlighting.

```bash
{
    "draw_outlined": false,
    "highlight_when_selection_is_empty": true,
    "mark_occurrences_on_gutter" : true,
    "highlight_delay" : 0,
    "show_word_highlight_status_bar_message" : true
}

```

---

<div class="post-metadata">

**Author:** ![andrewliew](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.compas-framework.org/andrewliew/32/88_2.png) [@andrewliew](https://forum.compas-framework.org/u/andrewliew)\
**Post date:** [February 13, 2018, 7:56pm UTC](https://forum.compas-framework.org/t/sublime-for-running-python/41/6 "2018-02-13T19:56:30Z")

</div>

Most of us also use the **Anaconda** package (this is separate from the Anaconda Python distribution), which among many very useful things, has a PEP8 linter. To disable specific PEP8 warnings, you can use the following for a list of the PEP8 codes you want to ignore:

```bash
{
    "pep8_ignore": ["E501", "E221", "E741", "E241", "E722", "E402", "E222"]
} 

```
