Turning Sublime Text into a Lightweight Python IDE
cewing.github.io
cewing.github.io
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?
I guess people prefer Sublime over Atom / VS Code because of its performance. To them (including me) that matters more than what might happen in 20yrs.
Sublime is not Vim or Emacs, you just move on to the next CUA text editor or IDE. It's not like you need more than 20 or so extra commands to be effective in a CUA IDE:
* go to class/function/file/symbol
* build/run/debug/run tests
* debug commands (step over, step into)
And you pick those up in 15 minutes. Good editors and IDE have remapable keys or can even emulate ones from other editors and IDE.
And this is on top of the default: save is Ctrl-S, copy is Ctrl-C, cut is Ctrl-X, paste is Ctrl-V, close tab is Ctrl-W, etc., etc.
... what?
That's so far removed from the truth that I really question whether or not you even use Sublime well. I mean, notepad fits those requirements
One wonders what leads someone to become such a snob and how to prevent it.
And before someone accuses me of being a human-snob, well, we don't really have a choice, do we?
Sublime is not really an IDE imho. It's a very good text editor though, which has a lot of feature overlap with IDEs, but I wouldn't prefer to develop within Sublime.
There are diminishing returns for learning really obscure text manipulation features. It's always cool to see someone make it look easy with emacs on an i3-gaps desktop with anime wallpaper, but most of us can get by with learning some basic regex/replace, navigation commands, and editing commands. I'd rather be learning a different language than a text editor.
VSCode is Microsoft's product, and they are doing solid job with it now, but who knows what they will do with it in 5 years' time. I won't be surprised if they try to integrated it with Azure more closely and do some things which are not relevant to me. Plus it's Electron app which I won't use.
And it's not like open source solution can't fail and be abandoned.
Only two editors that I think will last forever (at least it seems so now) are emacs and vim. Everything else has similar chances of surviving test of time.
That doesn't make all electron-based applications slow.
https://github.com/jhallen/joes-sandbox/tree/master/editor-p...
I would be interested in seeing how that 3GB looked like though.
For instance Emacs has no issues with huge files (logs with many lines), but can completely choke when the lines are really long (like a minified JS-file without lineshifts).
I guess similar constraints may exist in other editors too.
Without knowing how those 3GBs looks, it's hard to make a decent judgement of what the "load" test actually tests.
> huge 3 GB file (3M 1K lines)
So, somewhat long lines, but not unreasonably huge.
For me, working on a nasty legacy codebase with 10-15k LOC classes - VS Code is slow enough with syntax highlighting that I pretty much need to use something else.
The Spotify desktop app also feels millisecond-fast to me, but that might be Chromium Embedded Framework and not "full" Electron? I'm not sure.
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.
Astoundingly few text editors run on ARM CPUs.
Open source means you can compile them yourself if necessary (if they're written in a proper platform-independent fashion). That I couldn't use it on every device I own was the reason I left Sublime for good, although I quite liked it so far.
9 hours of browser usage + wifi isn't anything to sneeze at for most laptops, not even considering Atom usage!
However, I agree! I think open source has helped the industry to move forward quicker, since a lot of people get to see what the code for things that work look like.
But the best IDE experience (beside PyCharm) is really using VSCode + the most popular Python extension 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.
Would love to hear if there's a setting I was missing as I'd like all the other features in VSC.
For those interested:
* expose the right port (if remote debugging)
* install ptvsd into the virtualenv
* ptvsd.enable_attach(..) # in manage.py
* ptvsd.wait_for_attach() # in manage.py
* run the debug server in single threaded mode
* run the debug server with noreload
PyCharm debugging is really top notch, but I don't like the editing experience nearly as much as in sublime or vscode. The keybindings and shortcuts feel so much better in vscode that I'd rather use ipdb in a terminal when I need to debug.> 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.
Having a cursor follow along in the file is just one part of a visual debugger. Seeing the call stack and being able to move up/down, the ability to see scope variables, the ability to enter console commands are all essential. Lack of these is why I stopped using SublimePdb, instead switching to pudb: https://pypi.python.org/pypi/pudb
I highly recommend it as the lightest weight interactive debugger out there for Python.
It wouldn't do step debugging or breakpoints, but at least for scripting and even simple c programs it would work well.
http://sublimetext.info/docs/en/reference/build_systems.html
Well, then again, I've never seen an IDE that comes close to ST/Vim/etc in their lightness, speed of opening, editing, switching files, and pleasantness of the core editing experience, much less one without a heavy beast of a UI. Or one that you can setup exactly as you want, as heavy or as light as you like, plugin by plugin, without all kinds of crap builtin.
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.
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.
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.
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.
- 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.
- 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")
This sounds pretty great. Would you mind explaining how that works? Is it specific to Emacs?
https://github.com/emacs-mirror/emacs/blob/master/lisp/progm...
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...
My debugging now is just logging.info and some fancier log aggregation tools, but still feels like the early 1990s.
Whether "PyCharm has almost everything that Sublime has" is not really relevant to whether people claimed IDEs were bad -- seeing that people didn't claim IDEs were bad for lack of features.
It's the slugginess and especially the "take it or leave it" bundle of stuff that comes built-in into an IDE that annoy(ed)s people.
Also, I'd argue PyCharm has much more than sublime.
The rest of the list is pretty short: Plex and 1Password (less so these days).
That being said I think PyCharm is good enough that I'm willing to put up with that.
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.
No doubt some Rails devs use Sublime but it's nowhere near as popular as Vim.
I also vaguely remember that most of these demos were on Macs and they were showing off editing of Ruby code.
But as I was saying, it's been a while :)
Also a really really solid editor.
VS Code seems to strike a good middle ground on this - it's all still a pile of JSON config files but the UI for managing it doesn't make you want to run away from home and become an itinerant chartered accountant.
http://i.imgur.com/xMiyCN4.png
But what you probably wanted was this:
https://news.ycombinator.com/item?id=12553484
wbond is the guy behind Package Control and he also develops Sublime Text.
Multiple times while editing large files my editor would slow down or crash.
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.
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...) - 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!
Nothing even comes close.
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
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.
Pycharm also have scratch file/buffer support and that is quite awesome for one off scripts.
Probably you are right though, if I was using OSX as my main OS I'd definitely consider buying a sublime license since there were some problems with the Notepad++ (mainly with its filesystem integration).
Depends on usage maybe? Haven't used NPP in a while anymore, but IIRC it lacked built-in functionality or plugins for go to definition/got to anything/PEP8/Flake8/GitGutter/... which work as good as Sublime's?
What am I missing by not having PyCharm or the other IDEs mentioned here? Thanks
Will check PyCharm out though; this thread's got me curious about what it can do.
Sublime Text is a nice fast IDE for python.
So is PyCharm.
CWWFY (Choose what works for you)
I think it is more flexible.
And here I was thinking Atom and VSCode had dominated the IDE/Editor environment
Before Sublime, textmate was okay but I always liked BBEdit/TextWrangler for OSX best. Crimson Editor was the best thing I could find for Windows in the early 2000's, before I moved away from Windows environment.
Take your pick. I used atom until I got annoyed by how it choked on large files and crashed semi-frequently.
ST just works, is blazing fast and I love its jump to and multiediting shortcuts
I know those of you who love VS Code are not working with large projects. You could argue that you can load up your project in a more modular way, or search just parts of your projects, not all files, but then you've lost a lot of functionality, and you might as well use another piece of software which actually handles a large code base.
>Zero-latency typing is now on by default: typing latencies for PyCharm 2017.1 are lower than those for Sublime Text and Emacs