Here's what I did now.
I browsed PyPI looking for similar packages, then took a look at wikidump's directory structure and its setup.py.
There I found out about the entry_points
parameter which allows one to specify module functions that will be converted to scripts at build time. These scripts may also have extra dependencies.
To work with this I converted the respective __main__
blocks into named functions and marked those as entry points. The relevant block (all setuptools.setup()
parameters) looks like this:
[...]
requires=['pyswisseph', 'numpy'],
extras_require={'Flask':['flask']},
entry_points={
'console_scripts':
['cerridwen = cerridwen.cli:main',
'cerridwen-server = cerridwen.api_server:main [Flask]']
}
[...]
Everyone gets the module and scripts, but the optional dependency will be installed only if the script that requires them is run for the first time. The script logic will also be installed as part of the main module so everyone can use their helper functions as needed.
As for having the scripts as examples, I intend to reference their github sources on the project's web site.
The directory structure was left in its original state.
I hope that helps someone else :)