For a project I’m working on, I develop Python code on a Linux server. I use Smultron, which is a nice text editor on the Mac and access the Linux server by mounting it as a Samba share.
I’ve been thinking about using an IDE like Eclipse with pydev on the Mac, but it looks like it would have to work with the development environment on the Mac OS. That’s not what I want, I want to be able to run the IDE on the Mac to access the Python code files on the Linux server and have it executed in the Linux environment.
Of course, I could use a second Linux workstation do the IDE there, but I don’t really have the desk space for a second workstation next to the Mac.
I’m thinking of running a VNC to the Linux Server and run the IDE there, so it’s running on the actual platform the Python code is intended.
Is there a better way to do this? Am I overlooking something, if so, what is it?
I don’t use PyCharm because I don’t Python, but if it’s worth anything, I’ve used PHPStorm in the past, and currently use AppCode and RubyMine extensively, and they rock. JetBrains make good products.
In fact, there is a very fully-featured free version of PyCharm, called the “Community Edition”. But, this specific feature is something they would like you to pay for, it’s only in the Professional Edition.
I agree that JetBrains products are awesome! I’ve been using them since 2002 or so, back when it was just IntelliJ IDEA.
Another option is to run a linux docker container locally for testing on the mac and share out your source directory.
While “containers everywhere” could be called a bit of a fad, this use case gives you a repeatable development environment that will also allow you to iterate through update to the system or even other distros.
You’ve given me another idea, I could run VirtualBox on the Mac OS, and bring up an instance of Ubuntu or CentOS and run the IDE in that. I’ll have to compare the VirtualBox experience vs. VNC on the Mac to the Linux server. I’m going over the LAN, so VNC should be fast enough with its refresh rates for the screen.
PyCharm seems like it would be a great option. It’s just awesome anyway, so why not?
If you must use another IDE or text editor and are considering the remote option, I don’t think you need the graphic or virtualization overhead…? If the files are on the Linux server, can’t you just ssh in to run the script? It’s a LOT faster than VNC. You can probably also set up some remote debugging if you need to. There’s no sense sending graphics over the network if you can just execute commands via a terminal… this is exactly why ssh exists.
To edit the files on the server, you can use your choice of samba/sftp, or better yet, you could add version control (git?) while you’re at it. Develop and test locally, commit and push, and run it again on the server. It solves the deployment process neatly and gives you, well, version control as a bonus.
In general, since you’re staying in *nix, it should be very easy to remotely access and execute files. What you’re doing is basically what any web developer does multiple times daily, and OSX + Linux is the preferred combo for most.
(just to be a bit clearer) you’re asking for two separate things, both of which are common and easy between OSX and Linux:
1, how to edit remote files locally: You can mount samba or sftp over the network, use sftp the normal way (edit local, upload when done), use rsync for easy mirroring from local to the server, or use git-based deployment (faster than sftp, provides versioning so you can easily roll back). PyCharm and many other IDEs and text editors have these features built in.
2, how to execute files on the server and see its output: SSH. You don’t need anything more. Many IDEs will also have SSH clients built in, but if not, you can run it straight from the OSX terminal.
It doesn’t really matter which editor you want to use, since those above two things will work with any. Having an integrated environment like PyCharm just makes everything easier.
That’s what I’m looking for, just to make it easier. The VNC is going over a LAN, and a lightweight GUI so I don’t think that’s noticeable overhead. At least it has not been so far when I use VNC to run a few things, but I’ve not tried it with an IDE yet.
I’m not sure how using GIT would help with this, or am I missing something?
I think that perhaps the problem here is that, particularly with Python, the “integrated” in Integrated Design Environment means that you have I/O and debugging (single stepping, interpretation, watch lists etc) in your IDE. A command line process, even if operated in a window in your IDE, simply isn’t the same thing.
Git doesn’t directly affect the issue you asked about, but it automatically saves and catalogues the changes you make to your project, giving you a level of safety and organization that’s difficult to duplicate “by hand”.
I guess a better question might be, how are the cool kid Python programmers doing this? They aren’t working on a Mac doing development for a Linux server? What are they using for a development workstation for Python development? Is there keyboard, mouse and computer monitor on the Linux Sever and they are using the IDE running on the Linux GUI?
I guess the counter question might be - what is it about the Linux server that the Mac can’t do? A Mac is a Unix box. If you are doing something like web services development an IDE like PyCharm (especially the pro version) contains smarts enough to provide the entire web backend support for development. Using Django for instance? PyCharm understands it, and has the ability to spin up a web server you can connect to and let you debug your code whilst accessing the web page from a browser. You can’t back end it with a full bore Apache server, but you shouldn’t need to do that in development anyway.
Once the system is working you should be able to deploy a Mac developed Python system on a Linux box with changes no different from moving from one Linux box to another. Indeed, done right the developed package should work with no change at all.
Do you mean, does the IDE understand Git? Typically yes, any modern IDE understands Git - again, Pycharm works extremely well with it - and things like code merges are handled inside the IDE. Where you can get into trouble is if you start to add custom hooks to the Git commands, and the IDE doesn’t play well with those hooks. This is a rare thing. I work in an environment where you do need to be very careful, as there are hooks that sometimes require you to work with the command line tool for Git. (We don’t use PyCharm here however. It may play better.)
Git is very much the current flavour for code development. The downside is the daunting level of complexity you can get into if you want, the upside is the ability to work collaboratively in a safe manner. There is a free download of a Git book written by a couple of guys from Github which is pretty good. Otherwise XKCD has a slightly less useful quick quide.
It’s just that all the data files and the environment on the Linux server is already in place, and it looked like more work to duplicate it on the Mac and have to maintain it. Trying to avoid having to install things like Brew to maybe get some additional functionality which is already there on the Linux server.
Bring this back to my “cool kids” comments, is that what the cool kids are doing? They do Python development on their Mac OS with an IDE, and when they feel the code is ready they send it on over to the Linux server via GIT?
I see. When I think of GIT like other version control systems, I usually don’t think about that when first developing the code. I’ve only been concerned with version control after it is ready to be moved into production. Does using GIT from the start with respect to developing/prototyping something have a benefit? Or is it more of a philosophy of best practice to start the first line of code in development to be in GIT?
Versioning in development is a significantly different beat to version control in deployed product. They are related, often intimately, but nobody in a modern development cycle should be delaying control until release. You are buying into a world of hurt if (when) things go awry. This buys you into an entire discussion of code development models and paradigms, bu even if you are a sole coder with a simple waterfall development cycle, There wil be days when you are thankful you put your first ever line of code under version control.
I agree needing to use brew or fink to build up the environment can get a little tiresome, but once done it isn’t a big overhead.
Access to the data files could be presented over NFS. I do assume this isn’t a live system you are developing against.
No idea about the cool kids, but I have certainly worked this way. Using Git is a big help as I could develop on any machine, and I spent time developing on my home Mac, and just pushed the work up to the repo, and deployed as needed from there. You can build a Python application installer that lives on a Git repo - even GitHub, and install the application anywhere with a single command line, not much different to using apt-get. This gets powerful and valuable quickly. You can link this to testing via services like Jenkins, and build a powerful continuous development environment. Once you try it you will never go back.
Git during development is awesome, even from the first line of code. It’s like having a history of everything you do, and gives you great spots to revert to if needed. Creating a new branch to experiment with means you can just code and forget trying to track your changes. If it doesn’t work out, kill that branch, and you’re back at your last commit point. Git is like have super powers.