License plugins

Creating a license

  1. Create a new class that extends betty.license.License and implements the abstract methods, for example:

    from typing import override
    from betty.license import License
    from betty.machine_name import MachineName
    
    class MyLicense(License):
      @override
      @classmethod
      def plugin_id(cls) -> MachineName:
          return "my-module-my-license"
    
      # Implement remaining abstract methods...
      ...
    

#. Tell Betty about your license by registering it as an entry point. Given the license above in a module my_package.my_module, add the following to your Python package:

[project.entry-points.'betty.license']
'my-module-my-license' = 'my_package.my_module.MyLicense'
SETUP = {
    'entry_points': {
        'betty.license': [
            'my-module-my-license=my_package.my_module.MyLicense',
        ],
    },
}
if __name__ == '__main__':
    setup(**SETUP)

See also

Read more about how to use licenses and Betty’s built-in licenses at Licenses.