
Turning Sublime Text into a Lightweight Python IDE - wilsonfiifi
http://cewing.github.io/training.codefellows/assignments/day01/sublime_as_ide.html
======
josteink
Maybe I'm the exception, but I can't see why people, why _programmers_ ,
bother investing their editing-skills in a closed-source editor and toolkit.

Sublime is closed source. When it croaks up and dies, all the skills you've
built up will be wasted, and you'll have to rebuild them elsewhere.

Why not invest in something open instead? There's more options than ever
before, and they're all good.

For me, VS Code seems to provide pretty decent Python IDE capabilities almost
out of the box.

For those a little more deeply invested, Emacs with elpy and realgud gives me
all I need: code-completion, docs, debugging, breakpoints, etc. And it's
something I as a programmer can adapt to my needs and build on.

Sublime? None of that. So what's the appeal?

~~~
petre
Because it works and it works great. It's fast and it never crashed on me.
Give me an equivalent opensource editor that works and looks like Sublime and
I'll use it. No, Atom and VS Code don't cut it. They're slow, they choke on
big files and eat up hundreds of megabytes of RAM. I don't need or use
plugins, so I don't care if it's extensible in <insert trendy language here>.

Vim is also nice but I only use it for remote console work. It doesn't have
the nice features that Subline has (PCRE, select and Ctrl+D editing) or
they're clunky.

~~~
mixmastamyk
Geany hits most of these except fancy select, though there might be a plugin
for that.

~~~
petre
Well that's what was using on Linux before I installed Atom, although it's
hardly a replacement for Sublime (which gets used on the Mac at the office for
_real_ work). Really, I've tried just about everything.

~~~
mixmastamyk
Why hardly? I use geany everyday for "real" work.

------
therealmarv
No mentioning of Anaconda for Sublime? It has many of this features out of the
box.

But the best IDE experience (beside PyCharm) is really using VSCode + the most
popular Python extension
[https://github.com/DonJayamanne/pythonVSCode](https://github.com/DonJayamanne/pythonVSCode)

This setup is a total replacement for PyCharm for me. Code Refactoring, code
definition jump, IntelliSense suggestions and help, linting, virtualenv
support, code formatting etc. etc.

And last but not least VSCode and this extension are both free, open source...
unlike Sublime and PyCharm.

~~~
philsheard
My biggest problem with VSCode was the loss of ST's support for working across
multiple project folders. When I'm working with Django I'll break code out
into reusable apps but find it difficult to work concurrently on these
separate folders of code.

Would love to hear if there's a setting I was missing as I'd like all the
other features in VSC.

~~~
dchest
I have each project open in a different VSCode — is that what you're asking
for? You can do File > New Window and then open another project in it or just
set "window.openFoldersInNewWindow": "on" to always open directories in a new
window.

------
gitonup
> The final requirement for a reasonable IDE experience is to be able to
> follow a debugging session in the file where the code exists.

> There is no plugin for SublimeText that supports this. But there is a Python
> package you can install into the virtualenv for each of your projects that
> does it.

This drives me batty whenever I see "turn XYZ into an IDE for (foo)." The
author of this post at least lists debugger integration as part of the IDE
experience, but comparing against actual full fledged commercial / non-plugin-
composite IDEs? I haven't seen one article for turning Atom/ST/Vim/etc into an
"IDE" that comes close (edit: that is, close to a reasonable debugging
experience, in an integrated way) capability-wise.

There's nothing _wrong_ with taking that approach, but if you need to shim on
GDB and use a plugin to just _follow along_ in source (forget setting watches,
gutter-click breakpoints, conditional breakpoints, etc., from Sublime Text),
that's pretty definitively not integrated into Sublime.

~~~
braveo
That's because your definition is flawed.

When it's all said and done, all that matters is that you're able to get the
work done. Take vim, for example. You can quite often use CLI tools to get the
work done due to vim's integration into the surrounding ecosystem, and this
includes things such as debuggers.

For a language like C#, you're never going to find as integrated an experience
as you will with Visual Studio. It's just not going to happen.

But for everything else, you absolutely can be as productive in something like
vim, the workflow is just different.

~~~
gitonup
My definition of what? I literally said there's nothing wrong with taking that
approach. I quite purposely did not argue productivity.

My issue is with the acknowledgment by the author that the standard for "IDE"
includes debugging capabilities and then goes on to provide a plugin that
provides follow-along only via running GDB, which would need to be configured
(I assume, since the author does not specify) the normal ways.

If you want to argue UNIX is the IDE I can get behind that definition, but the
debugger is absolutely not integrated into Sublime (or Vim or Atom or N++ or
...) in any meaningful way.

~~~
braveo
That's why I said your definition is flawed.

The point is to get work done, not do it all in a single window. you talked
about "capability" as if because someone uses an external debugger you can't
debug effectively or very well when using something like vim.

It's a flawed definition of effective.

When you use something like vim, the entire ecosystem is your IDE.

~~~
gitonup
I've edited my OP and hopefully what I'm saying is more clear.

If the entire ecosystem is your IDE, you're not "Turning Sublime Text into a
Lightweight Python IDE".

I don't know how else to phrase this to make it clear that I'm not attacking,
denigrating, claiming inferior, etc., composite workflows like vim + GDB. But
if you get to an article that says XYZ is now your IDE, and it offers a piss-
poor debugging experience unless you leave XYZ, then that article is not
turning XYZ into an IDE.

~~~
braveo
It doesn't matter if you're attacking, denigrating, claiming inferior, etc.
The point you made is flawed or inaccurate, and that doesn't change because
your motivations are clean.

------
gshulegaard
My path with Python IDEs has been:

\- Visual Studio (when I was a student)

\- Emacs (when I ceased to be a student)

\- PyCharm (when my job paid for a license)

\- Sublime Text (when I wanted something comparable to Emacs with some
niceties thrown in and a single license cost)

All in all I think PyCharm is the most productive I have used. Minimal setup,
the best code inspection I have used, nice integrations with things like git
out of the box.

But Sublime Text has my heart at the moment because with the Emacs Pro package
it has a very Emacs-y feel with almost identical key bindings (slight
differences here and there). The package manager may be a bit "odd" and feel
like a sidecar, but coming from Emacs...it feels pretty straightforward.

Sublime Text is also language agnostic so that's a plus.

At the moment I use PyCharm Professional for work and Sublime Text for
personal stuff...and I think it strikes a good balance. Productivity where my
requirements are strict and cost not a factor and flexibility where I like to
try new things and recurring fees don't appeal.

~~~
cjauvin
I have had a similar path, except for VS. I have been happy (and still am)
with Emacs for a very long time (in particular, I really like how easy it is
to have some code in the left window, which I can easily send to an IPython
REPL in the right window), but recently, for a new job, I picked up PyCharm
Pro, and I must say that it's been pretty transformative. Three aspects stand
out IMO:

\- It's a fantastic tool to explore and understand big, industrial codebases

\- The testing and debugging support is _stellar_

\- The Emacs binding emulation is great (so it's easy to feel relatively at
"home")

~~~
wonderfool
> I really like how easy it is to have some code in the left window, which I
> can easily send to an IPython REPL in the right window

This sounds pretty great. Would you mind explaining how that works? Is it
specific to Emacs?

~~~
cjauvin
It's actually quite easy, as it comes pretty much out of the box with recent
versions of Emacs (24+) and python.el (not to be confused with the older
python-mode.el). I could not find a nice web source for python.el's
documentation, but it turns out that directly reading its code is not so bad
in this case:

[https://github.com/emacs-
mirror/emacs/blob/master/lisp/progm...](https://github.com/emacs-
mirror/emacs/blob/master/lisp/progmodes/python.el)

In particular, you need to set the `python-shell-interpreter` variable to
"ipython" (which must be in your path preferably). You can then invoke `run-
python` to start a REPL, and C-c C-c to send a buffer to it.

There are a couple more interesting commands with this mode, see:

[https://github.com/emacs-
mirror/emacs/blob/master/lisp/progm...](https://github.com/emacs-
mirror/emacs/blob/master/lisp/progmodes/python.el#L323-L329)

------
mylons
i'd just rather use pycharm.
[https://www.jetbrains.com/pycharm/](https://www.jetbrains.com/pycharm/)

~~~
solomatov
Completely agree. I can't use even the best editor if it doesn't provide basic
navigation, and debugging functions. 20 years ago, people claimed that IDEs
were bad, but now the situation have changed. PyCharm has almost everything
that Sublime has, and even more, there's vim mode, which moved editing to a
new level.

~~~
speedplane
I totally agree PyCharm's navigation and debugging functionality are
fantastic. That said, when I last tried it (about 2-3 years ago), my Python
code ran incredibly slow. I have a relatively large but not huge Django based
python project (~2M LOC with libraries), but with debugging enabled my Python
code practically ground to a halt. It's possible I misconfigured the debugger,
and I can't remember how long I spent trying to get it to work, but it was
discouraging enough that I dropped it.

My debugging now is just logging.info and some fancier log aggregation tools,
but still feels like the early 1990s.

~~~
BozeWolf
Pycharms 2017 debugger (pydev), is much faster now. You meed to use python 3.6
though. The debugger window suggests to install some bindings. If you do that
the debugger runs much much faster.

~~~
speedplane
I hate the 2.x / 3.x python split so much ... don't get me started.

------
pvg
_Sublime Text comes with a great system for Package Control. [...] To install
a plugin using Package Control, open the command palette with shift-super-P
(ctrl-shift-P on Windows /Linux). The super key is command or ⌘ on OS X. When
the palette opens, typing install will bring up the Package Control: Install
Package command._

Sublime doesn't actually come with Package Control and Package Control itself
is a confusing usability nightmare. It's a fine and snappy cross-platform
editor but the whole extensibility thing has unfortunately turned out ugly and
unpleasant.

~~~
newsat13
True.. I have never bothered to find out how the ST community grew so much.
It's a paid product and somehow people have built plugins for a package
manager that is not even part of the core IDE. Does anyone know the history
here?

~~~
gnaritas
When Textmate stalled between versions for years on end, Sublime came in with
Textmate compatibility and simply scooped up a huge userbase who wanted
something like Textmate on other platforms or were tired of waiting on
Textmate to release a new version. Sublime is a Textmate clone that outdid the
thing it was cloning but worked with all the existing Textmate bundles. That's
how.

~~~
danpalmer
Yep, I think this hits the nail on the head. I'd add that on Windows there
wasn't a good, native, option past Notepad++ (which is fairly limited in
comparison).

------
ya3r
I have used similar setups in Sublime Text for Python development, the main
issue is instability and inefficiency. Installing these set of packages in
sublime makes things slower and more unstable.

Multiple times while editing large files my editor would slow down or crash.

------
ianamartin
I have mixed feelings about this.

I love Sublime Text. But it's also a real pain to get set up correctly. I want
to like PyCharm . . . but it's also a real pain to get set up correctly, and
it's slow as junk.

Then again there's straight up Visual Studio with Python tools, which is also
a real pain in the ass to get set up and ready for use. And slower than I want
it to be.

And vim, which is great when you get it going, but is also a huge pain in the
ass to get set up.

Are we seeing a trend here?

I am. And the trend is that comprehensive IDEs really just take a lot more
work with dynamically typed languages than they do with statically typed ones.
Code introspection and completion is just a lot harder when you're guessing
about stuff.

I don't know. I haven't found the sweet spot, and I prefer to spend my time
getting things done instead of configuring tools.

My instinct is to choose the tools that are fast. Vim, Sublime Text. But fast
has limitations. I have a pro license for PyCharm on my own dime, but I've
always just given up when it comes to configuring it to something that makes
sense.

Blargh.

This situation is a thing that makes me just a tiny little bit envious of the
C# crowd. Visual Studio + Resharper is basically the best in class of coding
tools. Yeah, you're going to spend some time with setup, and you are not going
to edit shit on the fly on a server.

That tooling really works and works well. And SSMS is the gold standard for
SQL IDEs. The open source Python part of me is incredibly jealous of the
Microsoft tooling stack.

Some of the limitations with Python are by nature of the language, and some
are because we just seem to be willing to settle for good enough.

But damn, I really miss Visual Studio environment when working with Python and
Postgres instead of C# and SQL Server. I'm actually playing with C# and SQL
Server for toy projects sometimes just because the tools are so good. If you
happen to have a Windows box laying around. Which, you do, if you play any
games.

PyCharm is the closest thing to that experience, but it's so gross, I just
kind of can't stand it. Every time I sit down and decide, "Okay, I'm going to
make this work for me. Today." I just give up. Fuck it. I'll just go back to
vim and Sublime Text. They are good enough.

------
spapas82
I am using Notepad++ (I'm a windows user) for more than 5 years for
python/django development. Never regreted it - never found something better. I
stuck to Notepad++ even when I was using a Mac for some months (through Wine)
- I couldn't find something better or faster.

Everything else is way too slow (Atom, VS Code, pycharm) or way too
inefficient (Vim / Emacs - inefficient for me they may be great for you) to
replace Notepad++. An IDE is not really needed with python - it's not java -
If you want to debug something just add a breakpoint to drop directly to your
program (I have actually written a tutorial for that
[https://spapas.github.io/2016/06/07/django-werkzeug-
debugger...](https://spapas.github.io/2016/06/07/django-werkzeug-debugger/)) -
you'll then have a full repl to do whatever you wish!

I really think that notepad++ is a great editor (at least for windows users)
and should get more traction.

I had tried sublime text a bit and the only feature I found usefull that
notepad++ lacks is the quick switch to file - but I can live without it,
especially since Notepad++ is Open Source!

~~~
mundanevoice
Only if you haven't worked on Pycharm, you can say this. Try the latest
Pycharm on a medium/big size project and you will understand. It is the best
Python IDE out there, right now.

Nothing even comes close.

~~~
spapas82
Pycharm is good - I've used it. However there are various disadvantatges to
it:

a. It is not open source b. It is slow on my (Celeron based) PC c. I don't
really need the capabilities of a full-flexed IDE (auto-completion, debug etc)
for Python

~~~
mundanevoice
Well, I think you are mistaken here. There is an Open Source Community Edition
of all versions of Pycharm if you are so inclined to the Open Source. That is
quite good enough. Celeron is quite old and slow and it is not fair to expect
an IDE to work fast on that old PC. Though you can still disable some advanced
features( inspections) and make it reasonably fast.

Again, it totally depends on the project you are working. For a reasonable
sized project, you can do away with an editor. But with large codebases, IDE
support is a great difference. And this is coming from someone who has been
writing all his code on Vim for last 6 years or so. Basically, all you require
is a productive environment that doesn't hold you back and enables you to
write faster and correct code. For me and a lot of other people, Pycharm is
quite that tool.

------
pfarnsworth
PyCharm is better for pure Python development, but I still use Sublime because
of inertia. It does most of what I need it to without changing much regardless
of which language I'm currently programming in so I'm pretty happy with it.
Plus I spent $80 or whatever the cost was to pay for it myself so I have more
incentive to use it.

------
roystonvassey
I'm confused. I've been using Jupyter as my go-to Python IDE. It has auto-code
completion, nice charting abilities and even nice tools to convert my
notebooks into presentations for execs.

What am I missing by not having PyCharm or the other IDEs mentioned here?
Thanks

~~~
danpalmer
Jupyter is probably much better if you're doing what it's suited for. I work
on web application development in Python and Jupyter is not suited to that at
all, however my colleagues who work on business intelligence/analytics/data-
science/etc love it.

~~~
roystonvassey
Makes sense. I use it for analytics and data-science projects.

Will check PyCharm out though; this thread's got me curious about what it can
do.

------
cantcopy
A lot of unjustified negative comments.

Sublime Text is a nice fast IDE for python.

So is PyCharm.

CWWFY (Choose what works for you)

~~~
duiker101
Indeed. I use both. If I have to do something quick, I just open it in
Sublime(chances are I have it already open because it's also my notepad) but
if I need the full env I just fire up IntelliJ.

------
jrimbault
Just my two cents, I prefer to use syntax specific settings instead of global
user settings in Sublime Text.

I think it is more flexible.

------
sunstone
Just try Geany. If it doesn't meet your needs then go looking.

------
wyqydsyq
Wait — People are actually still using ST in 2017?

And here I was thinking Atom and VSCode had dominated the IDE/Editor
environment

~~~
tps5
I don't understand this attitude. Atom's look/feel/functionality/default
keybinds are based on sublime text. Sublime text is a lot faster/more
reliable. Atom has a large community building addons for it.

Take your pick. I used atom until I got annoyed by how it choked on large
files and crashed semi-frequently.

~~~
jsmeaton
There's nothing wrong with using multiple editors for different tasks. I'm
currently using vscode after a stint with atom for the majority of my editing.
But I use sublime text for scratch space or quickly opening large files or one
off text files.

