Pi Python development on Windows


#1

Any pointers or best practice for developing Pi Python scripts from my Windows laptop?

Do you develop directly on the Pi? This options seems a bit old skool. :)
Use an IDE on the windows machine and ssh across? If so, what IDE?
Use a IDE and use git to clone/push/pull ?

The problem i’m finding for my little Gfx Hat project is that I can’t get the Python pip module to install on the Windows box.(complains about visual studio problems despite installing stuff) , so it errors on the first import line.

I’m playing with PyCharm IDE on Windows, but that seems restricted on the free version where I can’t ssh to the Pi. So I can’t work that way. Any other IDE to consider?

Any thoughts or pointers would be very much appreciated.

Thanks


#2

Primarily I use VNC remote desktop and develop directly on the Pi but from the comfort of my desktop PC. I tend to end up doing any Python development on the Pi just to avoid any Windows funniness. (As a caveat, my PC & Pis are all on a wired-Ethernet connection to reduce latency.)

Thonny that comes as part of Raspbian is a pretty decent Python IDE, which I’ve started using more recently, rather than using IDLE/Textpad/Terminal.

Everything I write gets pushed to Git/Bitbucket so that in the event I need to pull and format an SD card for another project, nothing gets lost.

If I recall the paid-for version of PyCharm has remote deployment which is pretty handy.


#3

I do some coding on my PC. I don’t try to run the files on my PC though. I’ll do a check module in idle to flag the obvious errors.
All my real testing of my Pi related python files I do on the real hardware. I usually have other stuff attached like a sense hat, and other sensors like a BME680 etc. I have very few plain jain setups.
I did the VNC thing for a while but lately I just hook up a monitor keyboard and mouse. Its just a personal choice thing though, its the way I like to do it. I have some headless Pi’s (A+'s) with no WIFI or ethernet connection.


#4

I use a mix of:

  • Writing code in vim on the Pi via an SSH session from my Windows laptop - for initial code, testing, debugging
  • Writing code in vim directly on the Pi - for faster test/debug cycle, or low distraction coding
  • Writing code in Visual Studio Code on my Windows laptop - for setting up tests, mocking (where it’s useful to not be on a Pi since my continuous-integration and tests don’t run on a Pi), writing/building documentation and other maintenance tasks

And variations therein. I’m probably a terrible person to ask since I don’t rely much on one IDE or pattern, and just use whatever gets the job done at a particular moment. For this reason I haven’t really looked into code deployment and the couple of methods I’ve tried to deploy/run code on the Pi haven’t turned out well. In particular using apps to map and mount my Pi’s home folder onto Windows failed spectacularly since the filesystem would never stay in sync.

I’m really keen on Visual Studio Code at the moment as my primary editor, since it can serve all my text editing needs pretty well alongside various different programming languages. It’s even possible to run VSCode on the Pi- albeit slowly! (see: https://code.headmelted.com/)

I pretty much use Git to sync my changes between platforms at the moment.


#5

Windows 10 IOT for the Pi seems to be geared towards Visual Studio. I just don’t have those skills to code with it. And at 60+ I’m likely not going to ever get there. ;)


#6

I have an FTP program on the mac that allows me to access SFTP servers as if they were a hard drive on my machine. I save the file in my text editor (Sublime) and it automatically syncs to the remote server. It’s sweet. There are probably similar solutions for windows.