Due to high demand expect some shipping delays at this time, orders may not ship for 3-4 business days.
0

Workflow best practices?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Workflow best practices?

by steve220 on Mon Dec 06, 2021 9:45 pm

Coming from the Arduino IDE to play with CircuitPython, I'm curious about tips for working within the constraint of needing a specific filename for the running code. I'm used to being able to save code under different filenames as a project evolves. For example, I'm currently playing with the LED glasses from Adabox 20 and have 3 projects, each with several version iterations. Through my own inexperience I've lost code via my current practice of renaming or copying certain file revisions to "code.py" on the circuitpython device. My current workflow involves copying code.py off the circuitpython device to a separate drive with a name indicating the project and current revision number. When I want to work on that project, I copy the appropriate project/version code to the device with code.py. Rinse...Repeat. The need to edit code on the device with a specific filename is tough for this old dog to get used to. I'm happy to hear how others are working or any tips you may have.

steve220
 
Posts: 36
Joined: Sat Sep 16, 2017 10:52 pm

Re: Workflow best practices?

by mikeysklar on Mon Dec 06, 2021 9:54 pm

What OS are you developing on?

I use MacOS and find that install RCS via brew works well for me. I can check-in each revision of code.py when I get things going and add some notes. There are many options for revision control systems including github or CVS so just pick one that works for you.

mikeysklar
 
Posts: 6558
Joined: Mon Aug 01, 2016 8:10 pm

Re: Workflow best practices?

by danhalbert on Tue Dec 07, 2021 11:48 am

I often don't use code.py, but just save the program as another whatever.py file, and then do `import whatever` from the REPL to run it. If I need to re-run, then I type ctrl-D and do the import again. (Reimporting without restarting will do nothing, as the second import is ignored.)

danhalbert
 
Posts: 2978
Joined: Tue Aug 08, 2017 12:37 pm

Re: Workflow best practices?

by steve220 on Wed Dec 08, 2021 2:06 am

Nice tip with the import command. Thanks!

steve220
 
Posts: 36
Joined: Sat Sep 16, 2017 10:52 pm

Re: Workflow best practices?

by steve220 on Wed Dec 08, 2021 2:07 am

mikeysklar wrote:What OS are you developing on?

I use MacOS and find that install RCS via brew works well for me. I can check-in each revision of code.py when I get things going and add some notes. There are many options for revision control systems including github or CVS so just pick one that works for you.


I'm on a windows 10 system, but will look for RCS sw.

steve220
 
Posts: 36
Joined: Sat Sep 16, 2017 10:52 pm

Re: Workflow best practices?

by pdp8 on Thu Dec 09, 2021 5:51 pm

I have started using a Makefile. The "gold" source is somewhere on my machine and running make copies it the /Volumes/CIRCUITPYTHON (I am on a Mac, your path may be different). Nice because various intermediate actions doesn't cause the board to reboot, and makes the whole process more reproducible (I also have rules to install libs, etc.) Been thinking about naming my mains something beside code.py and having make rename them as part of the copy (so I don't have 30 buffers named code.py in my editor).

pdp8
 
Posts: 35
Joined: Mon Feb 28, 2011 12:01 am

Re: Workflow best practices?

by mikeysklar on Thu Dec 09, 2021 6:05 pm

I'm a fan of Makefile's and they make a lot of sense when doing CLI based CircuitPython development. I would still recommend RCS on top of what you have going. It is so nice to have a revision history and to be able to go back to older versions when the code gets wacky. I find it makes me much more brave about trying new libraries or making radical code changes knowing I can go back.

https://www.gnu.org/software/rcs/

mikeysklar
 
Posts: 6558
Joined: Mon Aug 01, 2016 8:10 pm

Please be positive and constructive with your questions and comments.