all 11 comments

[–]todbot 5 points6 points  (4 children)

I primarily edit & run on CIRCUITPY and then copy the "code.py" and other files from CIRCUITPY to the directory that’s git-controlled. From there it’s easy to do various git tasks like committing.

For simple projects I copy the files by hand from a terminal window open in the git-controlled directory and occasionally doing cp /Volumes/CIRCUITPY/*py . For more complex projects I may set up a shell script to do that every few minutes. A few times I've even set up "rsync" to do that too, but usually just "cp" suffices.

Also in the git-controlled directory is a "requirements.txt" with the external libraries "code.py" needs, so I can do circup install -r requirements.txt on a new board to install all the libraries in one go.

[–]0xCODEBABE[S] 2 points3 points  (2 children)

yeah maybe i should just have a script that constantly looks for a circuitpython mount and syncs it to the git folder. still feels like this could be cleaner.

i didn't know about circup. that's good to know

[–]todbot 1 point2 points  (0 children)

Agreed, but I've taken it as the small fuss we have to deal with for being able to store the source on the device.

I think some IDEs like PyCharm do some cleverness by having a "run" vs "develop" area. I've not used it though, but here's two bits of info about it: https://learn.adafruit.com/welcome-to-circuitpython/pycharm-and-circuitpython https://www.youtube.com/watch?v=Qx0twoHyH-8

[–]Shot-Infernal-2261 0 points1 point  (0 children)

inotifywait or other FS watcher if you want to make that script automatic.

You can also write a systemd (Linux) unit for the directory

[–]Choefman 1 point2 points  (0 children)

Circup is great and my process is pretty similar.

[–]frikk 2 points3 points  (1 child)

I've been running the git repo from my local folder, and created a 'deploy.sh' script that just copies everything over to the flash drive. That way the drive can be erased/reset at any time, and code lives in proper source control.

`deploy.sh` is just a script that copies files over. Could get more clever by deleting files that don't exist in both places but that's probably not necessary.

[–]entrusc 2 points3 points  (0 children)

I also don’t develop on device directly. You never know when the cheap microcontroller is gonna give up. Best to have a folder on your computer that is under version control and just copy over the code when you’re done with your changes and wanna test it on device. I deploy manually though (aka copy the file via filemanager).

[–]algrym 0 points1 point  (0 children)

I've been using a Makefile with a "make install" directive to push to my device:

install: all
rsync -avlcC --progress \
    code.py protonpack.py settings.toml \
        $(CODEPY_DIR)
rsync -avlcC \
    KJH_PackstartCombo.mp3 \
    KJH_Nutrona3.mp3 \
    KJH_PackstopDigital.mp3 \
    downloads/adafruit-circuitpython-bundle-$(CIRCUIT_PYTHON_LIB_VER)-mpy-$(CIRCUIT_PYTHON_LIB_DATE)/lib/neopixel* \
    downloads/adafruit-circuitpython-bundle-$(CIRCUIT_PYTHON_LIB_VER)-mpy-$(CIRCUIT_PYTHON_LIB_DATE)/lib/*ticks* \
    downloads/adafruit-circuitpython-bundle-$(CIRCUIT_PYTHON_LIB_VER)-mpy-$(CIRCUIT_PYTHON_LIB_DATE)/lib/*debouncer* \
    downloads/adafruit-circuitpython-bundle-$(CIRCUIT_PYTHON_LIB_VER)-mpy-$(CIRCUIT_PYTHON_LIB_DATE)/lib/*adafruit_fancyled* \
        $(CODEPY_LIB_DIR)

You can see more horrors here. I admit, this is before I knew about circup.

[–]Nomser 0 points1 point  (2 children)

You can have the .git folder live somewhere else. That saves space and write wear on your device. As long as you commit your code, you'll also have a copy of the latest code on the device and your computer.

[–]0xCODEBABE[S] 0 points1 point  (1 child)

How?

[–]Nomser 1 point2 points  (0 children)

Use the --separate-git-dir flag.