Mycroft Skills Manager - python

im not a fan of msm using bash, i decided to write it in python Py MSM

this version should be fully functional if used as a library

TODO

  • messagebus messages for mycroft-core interaction
  • testing permissions issues in mark1/picroft
  • command line util
  • mycroft skill with stats about skill - repo and installed skills
  • create readme.md
  • parse readme.md
  • skiller.sh functionality
  • submit skill to skills repo

install

pip install py_msm

Usage

from py_msm import MycroftSkillsManager

msm = MycroftSkillsManager()

print msm.platform
print msm.default_skills
print msm.list_skills()
print msm.url_info("https://github.com/JarbasAl/skill-stephen-hawking")
print msm.name_info("date time")
msm.update_skills()
msm.remove_by_name("stephen hawking")
msm.install_by_name("diagnostics")
msm.install_defaults()

Credits

JarbasAI

Nice work, @Jarbas_Ai

@KathyReid
I have been doing a bit of development lately with my own set of skills and I have been plagued by a few msm issues that I have been able to overcome but I am not confident I am using the tool correctly.
I am on a picroft platform.
I am only able to have success with msm if I follow this proceedure

  1. ssh into picroft
  2. sudo su
  3. source /opt/venvs/mycroft-core/bin/activate
  4. cd skills
  5. msm install “skill repo name”
    After this my skill will install but the skill has the username “pcwii” hyphenated at the end of my skill-name.
    Also the skill-name is owned by root:root not mycroft:mycroft.
    To solve this I rename the directory then chown -R mycroft:mycroft the skill-name directory.
    Although this is working for me it feels like I am definitely missing something with the usage on msm.
    Has the documentation for msm been clearly outlined for different platforms?
    Lastly if I perform an msm update (after steps 1, 2 and 3 above) I am getting an “uncommitted changes” error on a couple skills. The issue is I am pretty sure all my changes on github are committed.
    Thanks for all your work and support

OK, I’m out of my depth on this one - @Wolfgange do you have any ideas on what might be happening here?

If you are using Mycroft via apt-get (the default with picroft), there should be a file at /usr/bin/msm that will run msm properly under the correct user. You should be able to just run msm install "repo name" and it will turn that command into sudo su mycroft -c "/opt/venvs/mycroft-core/bin/msm install 'repo name'". As for the uncommitted changes issue, if you post the output of msm update, we can debug further. There’s a chance a permissions issue could cause the uncommitted changes so you could try a chown -R mycroft:mycroft /opt/mycroft/skills to see if it helps.

1 Like

Ok, I am no access to my machine so I can’t provide the msm output at this time. As far as the apt-get goes, I am actually running the picroft image. The image was created a very long time ago (8 months maybe). I have not had to re-create it as it has been working fine since, even with all the core updates over that time. Could the issue be due to that? I will provide the output to msm at my next opportunity to assist in the debugging. Thanks for the help @Wolfgange and @KathyReid .

@Wolfgange
here is a portion of my skill log. The skills showing the error are skills I have created.

22:24:08.432 - msm.mycroft_skills_manager - ERROR - Error running install_or_update on nanoleaf-skill: SkillModified(Uncommitted changes:
M init.py
M settings.json
)
22:24:08.434 - git.cmd - DEBUG - Popen([‘git’, ‘fetch’], cwd=/opt/mycroft/skills/kodi-skill, universal_newlines=False, shell=None)
22:24:08.470 - git.cmd - DEBUG - Popen([‘git’, ‘fetch’], cwd=/opt/mycroft/skills/skill-weather, universal_newlines=False, shell=None)
22:24:08.491 - msm.mycroft_skills_manager - ERROR - Error running install_or_update on decora-smart-wifi-skill: SkillModified(Uncommitted changes:
M settings.json
)
22:24:08.521 - git.cmd - DEBUG - Popen([‘git’, ‘fetch’], cwd=/opt/mycroft/skills/skill-playback-control, universal_newlines=False, shell=None)
22:24:08.546 - msm.mycroft_skills_manager - ERROR - Error running install_or_update on yeelight-skill: GitException(Git command failed: GitCommandError([‘git’, ‘fetch’], 255, b’error: cannot open .git/FETCH_HEAD: Permission denied\n’, b’'))
22:24:08.563 - git.cmd - DEBUG - Popen([‘git’, ‘fetch’], cwd=/opt/mycroft/skills/skill-date-time, universal_newlines=False, shell=None)
22:24:08.568 - git.cmd - DEBUG - Popen([‘git’, ‘fetch’], cwd=/opt/mycroft/skills/skill-naptime, universal_newlines=False, shell=None)
22:24:08.586 - git.cmd - DEBUG - Popen([‘git’, ‘fetch’], cwd=/opt/mycroft/skills/skill-stop, universal_newlines=False, shell=None)
22:24:08.668 - msm.mycroft_skills_manager - ERROR - Error running install_or_update on hyperion-control-skill: SkillModified(Uncommitted changes:
M init.py
)
22:24:08.674 - git.cmd - DEBUG - Popen([‘git’, ‘fetch’], cwd=/opt/mycroft/skills/skill-wiki, universal_newlines=False, shell=None)

Any skill that you see an uncommitted change for settings.json is because that file is changed by the software. The skill author should add that file to the .gitignore and remove it from their skill. I’m not sure about the skills that have changes in __init__.py. I’d just check the changes with cd /opt/mycroft/skills/nanoleaf*; git diff.

1 Like