Live data from Hacker News

Using Vim as a Python IDE

liuchengxu.org

121–130 of 158 posts

Re: Using Vim as a Python IDE

#121

Earlier quoted context omitted.

Debugging directly on the production system? Yeah, nobody does that. Well, nobody who has any kind of serious operation going on. If you can't replicate a bug outside a production environment you have a serious deficit in the devops department. You should be able to stage a machine with a copy of the production DB/data and the same reproducible package(code) that currently runs on your production systems. Everything…

> Debugging directly on the production system? Yeah, nobody does that. Uh, what bubble are you living in? Almost everyone does that to some extent. We can all pretend we're code ninjas with super clean deployment pipelines and strict policies, but all of us get lazy occasionally.

Not to mention that, in any successful project, there are going to be systems that need to be looked at by someone else. It's great for the original developer(s) that they can use their IDE to access files directly in containers, but if I'm called to investigate a running system then I'm going to end up in a shell on those hosts.

The only place I can see this never happening is in large enterprises that have huge departments with slow enough turnover that "the accepted workflow" is easily passed on to new hires. Referring to everyone else as "mom & pop shops" makes it sound like the speaker is living in a Silicon Valley enterprise bubble.

I find it amusing to see that term used as an insult on a site largely populated by startups.

Re: Using Vim as a Python IDE

#122

Earlier quoted context omitted.

>> in those rare cases when you can't replicate bug locally > directly on the production system? Why does 'non-local' have to equate to production? Are you able to use an IDE in your container/VM/cloud server?

Yes, PyCharm supports Vagrant, Docker etc. My host system is Fedora but since our production code is deployed on Ubuntu, I have a Vagrant Ubuntu image. PyCharm reads the Vagrantfile and it has access to the virtualenv(python in our case) of the Vagrant's image. UPDATE: I am not sure if that's what you were asking. Maybe this response( https://news.ycombinator.com/item?id=13543158 ) I gave is more relevant ?

That VM/container is still essentially a remote system. Do you never ever log in to it? What types of instrumentation are you using to characterize the performance and operation of your app in the dev instance?

Re: Using Vim as a Python IDE

#123
post #68

Earlier quoted context omitted.

VSCode/Atom are great, but for most folks on UNIX they are worthless, since you have to use something else when ssh-d into another machine. So folks build these elaborate Vim and EMACS set-ups so that they could use the same editor and the same config on all of their machines, whether they're local or remote. Vim is an acquired taste, but once acquired, it's pretty awesome.

Why not just run PyCharm on your local box and tunnel-via-SSH-and-pydevd to remote-debug your programs on the target system? You get (a) a full IDE running on your local system (no need to install anything on target system); (b) full debugging and breakpoints; (c) your choice of any "real" or "virtualenv" Python deployment on the target machine. Downsides are that your own source code on the local and remote systems…

You could mount the remote machines filesystem over ssh with sshfs.

https://wiki.archlinux.org/index.php/SSHFS

Re: Using Vim as a Python IDE

#124

Earlier quoted context omitted.

Yes, PyCharm supports Vagrant, Docker etc. My host system is Fedora but since our production code is deployed on Ubuntu, I have a Vagrant Ubuntu image. PyCharm reads the Vagrantfile and it has access to the virtualenv(python in our case) of the Vagrant's image. UPDATE: I am not sure if that's what you were asking. Maybe this response( https://news.ycombinator.com/item?id=13543158 ) I gave is more relevant ?

That VM/container is still essentially a remote system. Do you never ever log in to it? What types of instrumentation are you using to characterize the performance and operation of your app in the dev instance?

I can't characterize the performance of my app on a dev instance. I don't even think it's possible. You could characterize in the sense you do it for algorithms(with regards to time complexity).

But in general this is my(our) process.

- First I write the code.

- Then I test the code locally.

- Then I test the code on an instance with a copy of prod data. If I want to debug at this point, I run the web process locally while my DB configuration points at that specific server with the prod data.

- If it's code that spans across more than one subsystem(e.g. it also involves async celery task/queue servers) I test on a staging environment, that duplicates(as much as possible) the prod infrastructure.

- Then I deploy.

Obviously there are other various details, plus rollback plans in case something still goes wrong, but that's the gist of it.

Re: Using Vim as a Python IDE

#125

Yesterday I've downloaded VSCode and https://github.com/DonJayamanne/pythonVSCode (seriously, look at the GIFs in this repo!) for first time and I had autocompletion (with IntelliSense and documentation lookup), refactoring and code define jumping for Python code out of the box working within 10 minutes in a VirtualEnv. VSCode + one plugin (all opensource) and I had something similar to PyCharm and fast. (nothing aga…

FWIW the "vim" vim-plugin for vscode isn't terrible either, if one wants all that with modal editing. I actually think that vscode with vim plugin is somewhat better on windows than vim is. Depends on how one usually configures vim, of course.

Re: Using Vim as a Python IDE

#126
100010000000100001010100101000001001001010100101000010010100001010101010010101010010011100010101110010101010101010101010010101010101010101010101010101001001010019010101010010100101010101101000101010101010101000001110+

Re: Using Vim as a Python IDE

#128

Earlier quoted context omitted.

Debugging directly on the production system? Yeah, nobody does that. Well, nobody who has any kind of serious operation going on. If you can't replicate a bug outside a production environment you have a serious deficit in the devops department. You should be able to stage a machine with a copy of the production DB/data and the same reproducible package(code) that currently runs on your production systems. Everything…

> Debugging directly on the production system? Yeah, nobody does that. Uh, what bubble are you living in? Almost everyone does that to some extent. We can all pretend we're code ninjas with super clean deployment pipelines and strict policies, but all of us get lazy occasionally.

dont no

Re: Using Vim as a Python IDE

#129

Earlier quoted context omitted.

> Debugging directly on the production system? Yeah, nobody does that. Uh, what bubble are you living in? Almost everyone does that to some extent. We can all pretend we're code ninjas with super clean deployment pipelines and strict policies, but all of us get lazy occasionally.

Not to mention that, in any successful project, there are going to be systems that need to be looked at by someone else. It's great for the original developer(s) that they can use their IDE to access files directly in containers, but if I'm called to investigate a running system then I'm going to end up in a shell on those hosts. The only place I can see this never happening is in large enterprises that have huge dep…

Sounds pretty self-serving to say that I "referred to everyone else", just because you want to justify sloppy processes. I only referred to those who do that, and I'm sorry if I'm bursting anyone's bubble here, but nope; not everyone does that!

Also a startup doesn't necessarily have requirements for serious ops, but it may, some day. Well if they want to be an enterprise at least. You do know what the goal of a startup is, don't you?

And btw, no I don't live or work for company in SV. Europe mostly, with a dash of Dallas, Texas in the mix.

In any case, I was hoping for engineering arguments, not personal attacks. :(

Re: Using Vim as a Python IDE

#130
post #118

I want to give a shout out to spacemacs.org which let's you do so many of these things and really does feel like the best of Emacs and Vim together. I will say I am a new convert so I can't comment so much in the plugin infrastructure but raw coding is really good and it's very configurable like emacs but without all of emacs overhead

did you have experience beforehand in using emacs? I've been using spacemacs for a couple of weeks, but I'm having trouble getting past the most basic usage, and partially it's because I feel like I don't have much experience with emacs.

I did not in any real sense. I did the tutorial and chose the sane defaults recommended (so called Evil Mode) which gives you some great controls and a nice tutorial you can walk through if you type :tutor at the main screen.

I admit I have never used Vim or Emacs but the tutorial was enough to do movement and I also read this wonderful documentation as well: First this here which gives a wonderful overview of the whole philosophy behind SpaceMacs:

http://spacemacs.org/doc/DOCUMENTATION

Then I took a look at this just to get some better idea of how to do certain things with the layers since it's very dependent on a layering system:

http://spacemacs.org/doc/LAYERS.html

And for good measure since Evil mode emulates Vim I thought it might be nice to see what this had to say:

http://spacemacs.org/doc/VIMUSERS.html

It took me like a week to be efficient but now I'm flying so much faster than I was with VS Code or Atom. I still use Sublimr Text for some things because I like it but this is a great editor and has a lot of potential and is extremely extensible with Emacs lisp and I believe they already have a way to bridge in Vim plugins too

Post reply on HN