-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Read skills from XDG Base directory specification locations #2803
Conversation
Voight Kampff Integration Test Failed (Results). |
Voight Kampff Integration Test Failed (Results). |
Voight Kampff Integration Test Failed (Results). |
Hello @PureTryOut! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2022-06-02 05:58:07 UTC |
Voight Kampff Integration Test Failed (Results). |
14 similar comments
Voight Kampff Integration Test Failed (Results). |
Voight Kampff Integration Test Failed (Results). |
Voight Kampff Integration Test Failed (Results). |
Voight Kampff Integration Test Failed (Results). |
Voight Kampff Integration Test Failed (Results). |
Voight Kampff Integration Test Failed (Results). |
Voight Kampff Integration Test Failed (Results). |
Voight Kampff Integration Test Failed (Results). |
Voight Kampff Integration Test Failed (Results). |
Voight Kampff Integration Test Failed (Results). |
Voight Kampff Integration Test Failed (Results). |
Voight Kampff Integration Test Failed (Results). |
Voight Kampff Integration Test Failed (Results). |
Voight Kampff Integration Test Failed (Results). |
Was just glancing at this as we were looking at the PR for MSM and I wondered if we also need to update |
Good call, yes it needs to be. Fixed. EDIT: Actually never mind, this script isn't needed at all anymore. The new skill directories don't require root rights and will be made by the pyxdg dep if they don't exist yet, so no need preparing anything. I'll just remove the script. |
As I said before, my personal preference is both at the same time. But since that is impossible for now, the user level.
That is handled by #2802. It assumes users (rather than devs) will use The various XDG things are split out over a total of 3 PR's: #2802, #2794 and this one, #2803. Each PR moves some stuff over to the user's home directory, but together no data is outside of |
So does that mean you want everything related to that virtual environment, so configs as well as data, to be stored inside that env @chrisveilleux? In that case exporting |
I still don't understand the unit test failure 🤔 |
I'm not sure the test is actually using that This seems to work: def test_update_download_time(self):
"""Test updating the next time a download will occur."""
skill_updater = SkillUpdater(self.message_bus_mock)
skill_updater.dot_msm_path = self.temp_dir.joinpath('.msm')
skill_updater.dot_msm_path.touch()
dot_msm_mtime_before = skill_updater.dot_msm_path.stat().st_mtime
sleep(0.5)
skill_updater._update_download_time()
dot_msm_mtime_after = skill_updater.dot_msm_path.stat().st_mtime
self.assertLess(dot_msm_mtime_before, dot_msm_mtime_after) |
You seem to be right. I didn't understand why the test was failing as I didn't touch it, but now I actually looked at it it seems Now I just don't understand how this test ever worked before 🤔 Anyways, updated. |
And now our good friend VK is failing again 😠 |
Codecov Report
@@ Coverage Diff @@
## dev #2803 +/- ##
=======================================
Coverage 52.80% 52.81%
=======================================
Files 123 123
Lines 11104 11106 +2
=======================================
+ Hits 5864 5866 +2
Misses 5240 5240
Continue to review full report at Codecov.
|
@krisgesling any clue why VK is being difficult again? For some reason it seems to fail while sending emails, but the log only mentions warnings and no actual errors. This PR is the big second part of the XDG stuff and moves the last files away from |
It looks like this line:
should be: return MycroftSkillsManager(platform, skills_dir=skills_dir, repo=repo) Presuming it shouldn't be |
Ah, good find, you're right! No it shouldn't be Hopefully it passes now, fingers crossed 🤞 |
Nope... Seems the volume skill still failed if I read it right? |
Hmm, if it's volume then #2992 might fix it. I'm at pycon today, but ll try have another look in a break. |
I've just been reading back through the thread and wanted to pull out the questions to make sure we cover everything. 1. User level vs system level?The XDG changes as a whole will (by default) move everything out of the system level to the user level. 2. Directory to use for SkillsThere still seems to be concern about using a "data" directory for Skills. Unfortunately there aren't a large number of options to choose from. I think the Arch wiki provides a cleaner overview of the XDG directories, but there's also the XDG specification itself. Some relevant snippets:
|
I'm not sure why this keeps being asked. I assume people just want their config and data separate depending on the virtual environment used, and that's perfectly possible by setting the env values properly. With this PR included MyCroft makes use of the For example you can save everything to export XDG_CONFIG_HOME=/opt/mycroft-core
export XDG_DATA_HOME=/opt/mycroft-core
export XDG_CACHE_HOME=/opt/mycroft-core |
Just hit an issue in MSK - we'll need to do an updated release of that to use XDG too. Posting here so I don't forget |
@krisgesling how is that MSK release coming along? I really want this in... |
Hey Bart, I haven't had time to look at MSK and it's not in our next few sprints so it will likely be some time before I can get to it. Is this something you'd have time to look at? |
If you could link me to the issue in MSK, maybe? |
Thanks! I know working on MSK is not what you set out to do. I've created a new issue and linked it to this PR: I think it should just be Skill and test creation but we'll want to test all the major functions to be sure. |
So now the MSK changes are merged, what's left here to do (besides rebasing, will do that in a sec)? If we need to continue the discussion on the proper location for these things then fine, but let's do that so we don't keep this hanging for longer unnecessarily. |
@krisgesling a few months later and last time I didn't get a response, can we please move this forward? |
Hi Bart, I know it's gone on for a long time. What this really needs is someone to comprehensively test it out and stake their reputation on it being solid. Then we can merge it in. Right now, I can't provide the time it will take to do that. I'm spending every moment I have getting the Mark II's out the door to fulfill a 4 year old promise to many thousands of people. I know that is going to be frustrating, however it's our number one priority. If any core contributor community members have time to review and test this it would be much appreciated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to work rather well. A part from a nitpick of an unnecessary import, I did run into a possible edge case that may or may not be something...
I had an nonstandardly named folder in the /opt/mycroft/skills (this is allowed but mainly happens in development setups). In my case what normally gets installed in a folder fallback-query.mycroft
was simply in a folder called skill-query
(the original name I used when I created the first draft). After startup I got errors such as:
Exception in thread Thread-4:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/home/ake/projects/python/mycroft-core/mycroft/skills/skill_manager.py", line 243, in run
self._start_settings_update()
File "/home/ake/projects/python/mycroft-core/mycroft/skills/skill_manager.py", line 198, in _start_settings_update
self.upload_queue.start()
File "/home/ake/projects/python/mycroft-core/mycroft/skills/skill_manager.py", line 56, in start
self.send()
File "/home/ake/projects/python/mycroft-core/mycroft/skills/skill_manager.py", line 71, in send
loader.instance.settings_meta.upload()
File "/home/ake/projects/python/mycroft-core/mycroft/skills/settings.py", line 245, in upload
self._update_settings_meta()
File "/home/ake/projects/python/mycroft-core/mycroft/skills/settings.py", line 287, in _update_settings_meta
skill_gid=self.skill_gid,
File "/home/ake/projects/python/mycroft-core/mycroft/skills/settings.py", line 190, in skill_gid
skill = skills[skill_dir]
KeyError: '/home/ake/.local/share/mycroft/skills/skill-query'
Doing some checking it seems like msm had both copied the old skill folder and created a folder called fallback-query.mycroftai
.
This is all first glance analyzis and I need to confirm that this is it. If it is the case I wouldn't consider this a blocker for the issue since it's mostly for devs it would occur. (And not very often at that)
Also move over skills from data_dir if they still exist
I kinda forgot what I pushed 4 months ago, can you still reproduce this @forslund? |
I have not. It was a pretty crazy set of circumstances that only occurs with messy devs like myself. |
Description
This makes mycroft-core read skills from all locations as specified by the XDG Base Directory specification, so in/usr/share/mycroft/skills
,/usr/local/share/mycroft/skills
, and$XDG_DATA_HOME/.local/share/mycroft/skills
if it exists and otherwise~/.local/share/mycroft/skills
.This makes mycroft-core read skills from the XDG Base Directory location in the user's home folder, so
$XDG_DATA_HOME/.local/share/mycroft/skills
if it exists and otherwise~/.local/share/mycroft/skills
.This requires MycroftAI/mycroft-skills-manager#90 for the installation of skills part.
How to test
Contributor license agreement signed?
CLA [x]