Zarch
Posts: 1
Joined: Sun Nov 29, 2015 7:42 pm

Pi Python development on Windows

Sun Sep 16, 2018 7:22 am

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 Pimoroni Gfx Hat project is that I can’t get the gfx hat Python pip module to install on the Windows box.(complains about visual studio problems despite installing stuff) , so the IDE 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

pootle
Posts: 261
Joined: Wed Sep 04, 2013 10:20 am
Location: Staffordshire
Contact: Website

Re: Pi Python development on Windows

Sun Sep 16, 2018 11:36 am

I always develop the code on the pi itself, and use a file share so I can edit the code on my laptop, and run it through ssh on the pi. This is using a linux laptop though.

To do this on windows you can use putty if you want to run in shell or rdp if you want a full windows gui on the pi. There are several rdp programs you can run on the pi so you can drive the pi from a windows machine.

https://www.youtube.com/watch?v=IDqQIDL3LKg

B.Goode
Posts: 6345
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Pi Python development on Windows

Sun Sep 16, 2018 12:40 pm

Do you develop directly on the Pi? This options seems a bit old skool.


Well, count me as being unapologetically 'old skool'.

The idea that I can have a 35$ computer with more power than the full-featured (and full-price) desktop PC I was using 15 years ago, with the ability to run a complete Linux Operating System, and thus have the choice of developing directly on the target hardware, seems pretty revolutionary to me. It is 'develop it here, test it over there' that is an Old School paradigm in my book.

Development in-situ means there are no incompatible libraries, no awkward interfaces, no interruptions to workflow (and thought processes) while code is transferred... and so on.
Last edited by B.Goode on Sun Sep 16, 2018 1:18 pm, edited 1 time in total.

PhatFil
Posts: 390
Joined: Thu Apr 13, 2017 3:55 pm

Re: Pi Python development on Windows

Sun Sep 16, 2018 1:07 pm

You could host VM s/w on your lappy and develop within an instance of the Pi os, Probably only worthwhile though if you have no access to the pi for long periods of time tho.

and perhaps the only real difference between local development on a fast modern hi spec puter and remote development on the pi itself will be a faster build/compile, but since your probably better off building etc within the run environment as doing otherwise could introduce a whole new set of problems. So imho Keep it on the pi and just keep backups on your lappy

hippy
Posts: 3586
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Pi Python development on Windows

Sun Sep 16, 2018 6:14 pm

I have my Pi SD Card shared with read-write access to my Windows PC's. I use Notepad and save to the PC then copy and paste over using Explorer, though I sometimes save directly to the Pi.

To run the code one can Telnet or SSH in to run the program. When using "python filename.py" to run the program it doesn't care about the end-of-line characters being Windows-style.

jahboater
Posts: 2855
Joined: Wed Feb 04, 2015 6:38 pm

Re: Pi Python development on Windows

Sun Sep 16, 2018 7:10 pm

PhatFil wrote:
Sun Sep 16, 2018 1:07 pm
and perhaps the only real difference between local development on a fast modern hi spec puter and remote development on the pi itself will be a faster build/compile, but since your probably better off building etc within the run environment as doing otherwise could introduce a whole new set of problems. So imho Keep it on the pi and just keep backups on your lappy
Yes
and of course Python is interpreted, so there is no build/compile stage.

Develop on the Pi, it is so much easier and quicker.

BTW, at the time of writing, the 3B+ is the best model for software development.

Heater
Posts: 9700
Joined: Tue Jul 17, 2012 3:02 pm

Re: Pi Python development on Windows

Sun Sep 16, 2018 8:54 pm

Do you develop directly on the Pi? This options seems a bit old skool.
"Old skool"? What school did you go to?

I'm from the old school, we would have loved to have such small and powerful machines to host development on.

Anyway, I often develop code on a Windows or Linux PC which will eventually be running on a Pi or some such system. I do this because of the comfort of all that speed and space that a PC has.

Of course a PC does not have the Pi hardware so the code being developed gets "fake" or "mock" interface code written to satisfy those hardware dependencies. This is useful because you can arrange for the mock interfaces your create to supply known test data to the application you are developing and also check the output that the application is driving to the hardware.

Ultimately the code ends up on the Pi. Usually I just pull it from it's git repository. There it gets tested and tweaked as required. Any old editor is good for that.

I'm old skool, I use vim on the Pi :)

On the other hand... for smaller projects, just work on the Pi. Easy peasy.
Last edited by Heater on Mon Sep 17, 2018 6:02 am, edited 1 time in total.

pfletch101
Posts: 160
Joined: Sat Feb 24, 2018 4:09 am

Re: Pi Python development on Windows

Sun Sep 16, 2018 9:37 pm

All of the above! :) For some things, (particularly if I am developing apps which will communicate with each other across the network), I do initial development on my Windows machine and final tweaking on the Pi, transferring files to and fro (usually only to) by SFTP. On Windows, I generally use Visual Studio's Python IDE, which I like very much - I use Visual Studio a fair bit for VB.Net projects as well, so I am used to its 'features' and quirks. On the Pi , I generally just use Nano for minor edits. You do need to have both set up to use the same number of spaces when the tab key is pressed. I don't generally need to access the Pi's hardware or GPIO pins, but I have written a couple of packages to simulate things (like shared memory) that aren't easily available under Windows.

PhatFil
Posts: 390
Joined: Thu Apr 13, 2017 3:55 pm

Re: Pi Python development on Windows

Mon Sep 17, 2018 2:13 am

jahboater wrote:
Sun Sep 16, 2018 7:10 pm
PhatFil wrote:
Sun Sep 16, 2018 1:07 pm
and perhaps the only real difference between local development on a fast modern hi spec puter and remote development on the pi itself will be a faster build/compile, but since your probably better off building etc within the run environment as doing otherwise could introduce a whole new set of problems. So imho Keep it on the pi and just keep backups on your lappy
Yes
and of course Python is interpreted, so there is no build/compile stage.

Develop on the Pi, it is so much easier and quicker.

BTW, at the time of writing, the 3B+ is the best model for software development.
DOH! faceplam, as always I'm grateful when corrected.. cheers.. too long sat waiting for compilations this end blunted my not so sharp wit further

Return to “Python”

Who is online

Users browsing this forum: No registered users and 15 guests