Fork or Overwrite?

#1

I need to make some changes to the way OctoPrint sends the G-Code for SD card operations. This would include disabling the ability to upload and download files (to and from the SD card of the printer).

Should I fork the project in GitHub or make the modifications directly to the python files in the venv folder (the install folder) of OctoPrint?

What is the best practice?

#2

You might want to see if this works for you, first.

51%20AM

#3

I want SD support. I want to be able to print from SD, but I don't want the user to accidentally try to upload a file to SD (or download), because I won't support that feature.

In essence, my parser is looking that the files that OctoPrint has stored for itself in it's upload folder. Then when the user views the files, what they will actually see are the .gcode files that are stored in OctoPrint. Then, they can initiate a "Print from SD" which is actually just picking up the file from OctoPrint's filesystem.

#4

Like a shadow copy, I guess.

I couldn't tell you what the best practice would be, then. It's possible that you could fork and then maintain a branch with this behavior (which never gets merged back into OctoPrint's master).

#5

Yea, actually that was something else I was wondering about. Does comm.py have most of the g-code that OctoPrint uses to communicate with the printer? If I wanted to do something totally in terms of g-code support, would replacing that file be the place to do it?

Yea like a shadow copy, I suppose. I see no point in copying the file to a different part of the file system just to print from it, when I can already see the file in OctoPrint.

#6

I'm guessing @foosel would prefer you to use the serial factory for stuff like that.

#7

Couple of options...

Either of those and then hide the sd upload stuff in the frontend via JS.

I'd advise against local modifications/forking because it's most certianly going to lead to a diverging codebase that you'll never get current again (speaking from experience with other forks who have since switched to using plugins to achieve the same).

There's no command to download, your only worry needs to be upload.

#8

Oh, I need more than the ability to block. I need to change the format of one of the Mcodes so that the filename is in the comment and not the g-code command.