Modifying Add-Ons

There is a page in the online help about writing a new Add-On but nothing about what to do when modifying one. I cannot believe that you have to jump through the same hoops.
Do you really have to create an account on Git Hub and download all the code ?

No & sorta yes.

No because…
For a 3rd party add-on, you can simply start editing in its gramps51/plugins folder of the User Directory.

That’s because you can easily revert a bad experiment by deleting & redownloading.

However, “yes” because without the GitHub repository, you are doing development without ANY revision control. You cannot easily undo a misstep. And, if you accidentally flush it with the Plugin Manager, then all your work & experiments are GONE. The nicety of a recycle bin recovery is NOT supported.

Modifying a “built-in” multiplies the danger. It is vastly better to use GitHub when tweaking those.

I agree with your comments about Built-in code, but my question was about Add-ons.
The Add-ons code is not included in the Gramps Source Code, so why download it ?
I understand the need for revision control of Add-ons just like the Built-in code, so what is the minimum requirement for modifying Add-on code ?

The absolute minimal is:

  • install the original add-on, and
  • begin editing the .py code in the associated subfolder in the gramps51/plugins of the User Directory.

You probably need to delete the cache subfolder in that folder and restart Gramps between code changes. The compiled code is regenerated & cached during the add-ons registration as Gramps starts.

That’s the absolute minimum.

The advantages to download OUTSIDE the Plugin Manager are:

  • working with beta or old code that is not available through the Plugin Manager
  • Maintaining a separate source set that are outside the ability of the Plugin Manager to delete.

The reasons to post the code to your personal GitHub Repository:

  • Revision control
  • Others can collaborate in testing your mods and suggesting feature/code changes

I understand the need for revision control of Add-ons just like the Built-in code

"I want to modify an Add-on python file, correctly following correct rules of Gramps. "
You compress a complicated process into three lines, which, frankly, does not tell me how to get a modified Add-on accepted.
Please, do I really have to download the source code for Gramps, when I want to modify a file which is not included in that download ? If so can the system be simplified ?

Ahhh… You didn’t say you were trying to publish! I thought you were asking about how to get started with personal hacking on an add-on. Thanks for trying to contribute to the community!

If you have modified an existing add-on, you probably want to start by opening a conversation with the contributor of the previous version.

If you do not want to battle through the GitHub process, they may be willing to accept an eMailed ZIP file of your changes & fold it into their master repository. Alternately, you could create an enhancement request in MantisBT and post the zip there with a request that a developer angel will submit it for you.

Or you could request developer volunteer to mentor you through submitting a Pull Request on GitHub.

But please run your code through pyLint FIRST and clean up any of its complaints.

And since it was evidentially NOT clear… no, you do not have to download the source code for Gramps to get started on an add-on.

(You have already downloaded the core source code since you’re already running Gramps.)

I have done hacks to the Registration and ancillary files for a couple different add-ons, the emailed the updated archive to the Add-on owner. They’ve included the parts they liked & typically informed me about the parts that didn’t conform to standards.

But GitHub remains the preferred place to have those conversations. It identifies all the additions & deletions of your uploaded source code, then helps you discuss problems point-by-point.

I presume there is a Gramps section of MantisBT.
Do you have an address ?

Thanks for staying with me, we got to the right place eventually.

Here’s an example of a Bug Report submitted after @DaveSch coached on where to find the Python modules and some coding advice. Then @prculley was the developer angel who adopted the mod and submitted it for the 5.2 master on GitHub.

Thanks again Dave & Paul! I really do appreciate the encouragement!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.