botamusique icon indicating copy to clipboard operation
botamusique copied to clipboard

Import local libs as extensions

Open Fr6jDJF opened this issue 5 years ago • 7 comments

Basic loader for local libraries with optional looping tasks.

  • Custom libraries placed in the local-lib folder(configuration.default.ini) can be installed as in example "local_lib_pipinstal.sh" with: venv/bin/python -m pip install -e local-lib/testlib As it will be installed as *.egg-link in venv/../../site-packages, updating is a matter of updating the files in local-lib folder.
  • list with libs to be loaded in configuration.default.ini
  • lib has it's own libconfiguration.ini
  • lib has it's own lang translation files *example lib holds help message(!test command only) that extend the main help string.
  • No lib reload(just restart bot)
  • No auto dependency install(TestLib performs one basic check on it's own for feedparser example), need to figure out if/how to have those installed by the setup files

Fr6jDJF avatar Nov 15 '20 14:11 Fr6jDJF

Hello. Thanks for contributing to our project.

I have noticed you made a lot of changes. Can you provide details about the functionalities you'd like to add? I guess what you are aiming for is adding additional commands and hooks in the main loop of the bot by adding "libraries". Did I get it right?

TerryGeng avatar Nov 15 '20 14:11 TerryGeng

Hello. Thanks for contributing to our project.

I have noticed you made a lot of changes. Can you provide details about the functionalities you'd like to add? I guess what you are aiming for is adding additional commands and hooks in the main loop of the bot by adding "libraries". Did I get it right?

Correct, For me, it's non-general functions that interact with running services(for now I have some broadcast info to chat), but it might just as well extend to more general libs supporting the discussions on Mumble, like IMDB look ups, game server status and such.

So a.t.m I manually inject my own code to interact with my running services, what means auto update must be disabled, aging the instance. functionality like this would be the solution for that.

Started issue: https://github.com/azlux/botamusique/issues/229

Fr6jDJF avatar Nov 16 '20 16:11 Fr6jDJF

Great! Thanks for the improvement.

I'd suggest you check out the ABC of python, and write a template ABC class for all Libs inside libimport.py (or I think you can rename libs into plugins and rename libimport.py into plugins.py to avoid confusion).

Another thing: I think you don't have to use force push in this PR. Using force push makes it hard for me to find out what is your improvement across each commit. You can just commit as usual and we will squash this PR before merging. What's your idea?

TerryGeng avatar Nov 24 '20 07:11 TerryGeng

Great! Thanks for the improvement.

I'd suggest you check out the ABC of python, and write a template ABC class for all Libs inside libimport.py

I'm not known with that, I will check that out, thank you.

(or I think you can rename libs into plugins and rename libimport.py into plugins.py to avoid confusion).

Ok, that would be:

                    shown with log.debug
                             v

/local-lib/rssplugin/rssplugin/typ_rssplugin.Rss

        ^_________^
   would translate(shown by pip freeze) in to "local-rssplugin" by pip setup.cfg

Another thing: I think you don't have to use force push in this PR. Using force push makes it hard for me to find out what is your improvement across each commit. You can just commit as usual and we will squash this PR before merging. What's your idea?

I know sorry, I'm not used to push PR, to me -f seemed the only way to get this PR updated again.

Fr6jDJF avatar Nov 24 '20 17:11 Fr6jDJF

I know sorry, I'm not used to push PR, to me -f seemed the only way to get this PR updated again.

Actually you can just keep pushing commits into your 'importlib' branch, and new commits will just show up here :).

TerryGeng avatar Nov 25 '20 13:11 TerryGeng

Hello! Any update on this PR?

TerryGeng avatar Jan 21 '21 11:01 TerryGeng

Hello! Any update on this PR?

Looks like this user hasn't been active on GitHub since January 3, 2021... I would love to contribute to this PR to get it merged on botamusique, though.

@TerryGeng, could we get a checklist going to see what's left for this to get merged?

I will look into this & review the changes as soon as I have some time.

luca0N avatar Aug 02 '23 23:08 luca0N