Setup.py for a Plugin

Sorry if I seem like I am flooding with questions, but I think any answers will greatly help any future clueless folk like me :slight_smile:

Is setup.py necessary for a plugin and if yes - how exactly? What does it do?

This is how Python packaging works: You create a setup.py (with code calling setuptools’ setup(...) function) and a package containing your code.

Explaining this in-depth would be too much but there are many excellent guides out there on how Python packaging works. You could also have a look at one of the many plugins in https://github.com/indico/indico-plugins or https://github.com/indico/indico-plugins-cern - they all make use of this.

1 Like

Thank you!

P.S. I’m very new to the Python ecosystem, hence the type of questions :slight_smile:

Hmm… But do I still need a setup.py file if developing a plugin in a Dev Indico environment?

Yes, because you need to use the entry point to register your plugin. You’ll run pip install -e . in the folder containing setup.py though to install the plugin in “editable” mode, so any changes you make to the code will be taken into account (compared to a normal install where the code would be copied into the environment’s site-packages).