Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make weather great again #158

Merged
merged 44 commits into from
Jun 14, 2021
Merged

Make weather great again #158

merged 44 commits into from
Jun 14, 2021

Conversation

chrisveilleux
Copy link
Member

@chrisveilleux chrisveilleux commented Apr 6, 2021

Description

Major refactor of the skill.

Looking at this PR might hurt your eyes. Might be easier just to checkout the branch and look at the changes holistically.
There are no docstrings or unit tests yet. The VK tests do pass and many of the expected fails no longer fail. Mostly putting this up to get feedback about the refactor.

Type of PR

  • Bugfix
  • Feature implementation
  • Refactor of code (without functional changes)
  • Documentation improvements
  • Test improvements

Testing

VK tests pass. Install skill and have at it!

Documentation

As noted previously, no docstrings yet. But they will be added before merge.

@forslund
Copy link
Collaborator

forslund commented Apr 7, 2021

I'll dig into it more later today, just curious of the source submodule. What is the meaning of source in this case?

source/config.py Outdated Show resolved Hide resolved
__init__.py Outdated Show resolved Hide resolved
@forslund
Copy link
Collaborator

forslund commented Apr 7, 2021

I focused on functionality and added the minor things I saw at a quick glance. A very nice improvement over all.

@chrisveilleux
Copy link
Member Author

I'll dig into it more later today, just curious of the source submodule. What is the meaning of source in this case?

I am not married to the name of the submodule. I have used it before for "source" code. I just wanted to name it something on the equivalent of the dialog or vocab directory.

@forslund
Copy link
Collaborator

forslund commented Apr 13, 2021

Ok then I get what you're going for. source feels a bit weird in something that is essentially a python module. I personally would find it more logical if it was called something named than something generic. especially since the entrypoint is not in the source folder.

Sidenote: the dialog, vocab, regex folders should likely be merged into the locale folder which is the newer convention (the multifolder resource structure is deprecated)

@chrisveilleux
Copy link
Member Author

Is there a skill I can look at that uses the the newer convention? I've already moved a bunch of dialog and vobab files around. seems like a good time to update to the latest convention.

@chrisveilleux
Copy link
Member Author

Ok then I get what you're going for. source feels a bit weird in something that is essentially a python module. I personally would find it more logical if it was called something named than something generic. especially since the entrypoint is not in the source folder.

Sidenote: the dialog, vocab, regex folders should likely be merged into the locale folder which is the newer convention (the multifolder resource structure is deprecated)

I have never been a fan of the top level directory being a python package. There are so many files in there (README.md, requirements.txt, etc.) that are not python code. Long term, I think the __init__.py should go in the source directory as well.

@forslund
Copy link
Collaborator

forslund commented Apr 19, 2021

The spotify skill uses the locale and the mark-2 skill as well. Though neither of them uses the subfolder system very well (updating that in spotify at the moment)

I agree that the __init__.py should be moved in to the source folder if this setup should be used. I'd probably not name it source since that's more c/c++ style than python...maybe just call it weather? But I won't get into a naming convention fight right now, any scheme is fine.

Using a subfolder for all skill code I would also move the locale folder into the subfolder (since it's a resource for the code in that folder), doing that I think the only issue would be the way we determine the skill-id...

__init__.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@forslund forslund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't been able to run it yet, just looked over the code and found a couple of nitpicks but nothing that really needs to be handled

__init__.py Show resolved Hide resolved
source/weather.py Outdated Show resolved Hide resolved
source/weather.py Outdated Show resolved Hide resolved
@Olzeke51
Copy link

Olzeke51 commented Apr 22, 2021

mycroft_missng_digit
heads ukp - background : not real sure how/ewhich method got 'great-again' on Mycroft ...!!
having to go to work so can't do a full test...
looked good at first install - THEN I did a 'Restart' from the pull down menu
BUT on the 4 hour display for 'Today's Weather" -- I miss a temperature unit's digit on one of the hours - it seems random between hours - like I mentioned -- haven't really got into it
FWIW I also lost my 'listening/thinking' ring of lights - - - I thin

@AIIX
Copy link
Contributor

AIIX commented Apr 22, 2021

QML pages are missing a background all pages or "mycroft.delegates" that require a solid background must assign one:

Mycroft.Delegate {
         id: example
         skillBackgroundColorOverlay: Qt.rgba(0, 0, 0, 1) //this can be simply "black" or any hex, rgba, hsva values https://doc.qt.io/qt-5/qml-color.html
}

@Olzeke51
Copy link

moved here from the standard weather-skill as this is for the 'great-again' version
Good Work - I hate to even comment ; but I was asked to test it out

**Describe the comment
requested 'what is next week's weather?'
got the next four days on one screen
the next screen (maybe 20 secs later??) showed me the last 3 days [Mon Tues Wed]
#1) THEN I started hearing the verbal conditions/hi/low {don't remember the order}
for Thur >> Sunday [while Mon .. Wed on screen]

all seemed reasonable timewise except a minor point
#2) a minute (59/60 secs) after I asked -- it was at the Tues verbal when it went to 'Standby Face"
and still had to report the Wed conditions
x:25 asked for weeks weather
x:34 4 day shows up
x:46 ring lights out
x:54 3 day shows up
x+1:24 Standby Face

To Reproduce
Steps to reproduce the behavior:
ask for 'next week's weather'

Expected behavior
#1)verbal should coincide with the screen display
[was delayed]
#2) last screen should hold until verbal is done

MarkII-pi DEV-kit , network cable, uSDC
ubuntu default
latest 04-08 with the new weather skill installed - SOmehow!!!

Good Work - liking it

@chrisveilleux
Copy link
Member Author

The spotify skill uses the locale and the mark-2 skill as well. Though neither of them uses the subfolder system very well (updating that in spotify at the moment)

I agree that the __init__.py should be moved in to the source folder if this setup should be used. I'd probably not name it source since that's more c/c++ style than python...maybe just call it weather? But I won't get into a naming convention fight right now, any scheme is fine.

Using a subfolder for all skill code I would also move the locale folder into the subfolder (since it's a resource for the code in that folder), doing that I think the only issue would be the way we determine the skill-id...

What is the subfolder system for the locale folder? Right now I just have all the files in the folder for each locale.

@chrisveilleux
Copy link
Member Author

QML pages are missing a background all pages or "mycroft.delegates" that require a solid background must assign one:

Mycroft.Delegate {
         id: example
         skillBackgroundColorOverlay: Qt.rgba(0, 0, 0, 1) //this can be simply "black" or any hex, rgba, hsva values https://doc.qt.io/qt-5/qml-color.html
}

Why is the background necessary? Is it related to the issue where numbers don't show up sometimes?

@Olzeke51
Copy link

ran a test last night on a 'clean' image, followed one method of getting 'great-again' and no missing numbers
8 'what's the weather" checks, a pull down menu/Restart with pwr cycle - still no issues

@forslund
Copy link
Collaborator

the locale folder isn't as strict as the old regex/dialog/vocab folders so you can spread the files in subfolders, so you can group the files logically instead of by type only.

For example create a folder called
locale/en-us/units in which the dialog files for celcius, fahrenheit, meters per seconds etc. could be placed

__init__.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@forslund forslund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found some issues regarding to the sunrise / sunset intents.

@chrisveilleux
Copy link
Member Author

What is left for this to be merged? I still need to change the WeatherDelegate to use the CardDelegate. Which I should be able to do tomorrow. That will take care of the background issue raised by Aix. Anything else I did not address?

Copy link
Collaborator

@forslund forslund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issues I found seem to have been corrected but haven't had time to re-review the code. Changing my request changes to a comment so it's not blocking if anyone gets to the reviewing before me :)

@forslund forslund self-requested a review May 6, 2021 20:59
Copy link
Contributor

@krisgesling krisgesling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loving this refactor so much!

I assure you that any comments below are far outweighed by the list of great improvements :)

__init__.py Outdated Show resolved Hide resolved
skill/dialog.py Outdated Show resolved Hide resolved
@@ -1,26 +1,47 @@
# <img src='https://rawgithub.com/FortAwesome/Font-Awesome/master/svgs/solid/sun.svg' card_color='#FEE255' width='50' height='50' style='vertical-align:bottom'/> Weather
Weather conditions and forecasts

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be more comfortable leaving this out until we have made a call on what the Mycroft official requirement is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the code IS formatted using Black. What if someone questions why the lines are longer than 79 characters? This is informational, not prescriptive. We can always remove it.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
__init__.py Show resolved Hide resolved
__init__.py Show resolved Hide resolved
__init__.py Outdated Show resolved Hide resolved
__init__.py Outdated Show resolved Hide resolved
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Utility functions for the weather skill."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to add some unit tests for these - they should be the simplest given they are pure.
Particularly useful as an example if we're going to point people to this as best practice.

Copy link
Contributor

@krisgesling krisgesling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, there is more that we want to do here but merging this version as it's been well tested IRL and will fix known bugs in the current version of the Skill.

@krisgesling krisgesling merged commit c9244c2 into 20.08 Jun 14, 2021
@Olzeke51
Copy link

I am confused... this is merged into 20.08 ...
but we are on 21.02 ...
so does it get pulled into 21.02 somewhere along the distribution path??

@chrisveilleux
Copy link
Member Author

I am confused... this is merged into 20.08 ...
but we are on 21.02 ...
so does it get pulled into 21.02 somewhere along the distribution path??

This PR was generated before 21.02 existed. Should have changed the destination branch before merge but didn't. I will work with Gez to get this into 21.02.

@krisgesling
Copy link
Contributor

I am confused... this is merged into 20.08 ...
but we are on 21.02 ...
so does it get pulled into 21.02 somewhere along the distribution path??

Yeah that was my bad - it has also been merged into 21.02 though and is compatible with both versions of mycroft-core.

@chrisveilleux chrisveilleux deleted the make-weather-great-again branch June 26, 2021 20:25
@JarbasAl JarbasAl mentioned this pull request Jun 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants