Latest / Talk Python To Me / #146: Building Alexa Skills with Python and Flask
Transcript
- 0:00Voice assistants and voice interfaces are quickly becoming the new hot way to interact with computers.
- 0:05Two of the more notable ones are Amazon Echo devices and Google Home devices.
- 0:09Wouldn't it be great if we could program these with Python?
- 0:12And even better if we could use well-known APIs such as Flask?
- 0:16This week you'll meet Eric Cho, Dave Botella, and Cam Sweeney,
- 0:20who discuss their frameworks and apps they built around Amazon and Google devices.
- 0:24This is Talk Python To Me, episode 146, recorded December 20th, 2017.
- 0:30Welcome to Talk Python To Me, a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities.
- 0:50This is your host, Michael Kennedy.
- 0:53Follow me on Twitter where I'm @mkennedy.
- 0:55Keep up with the show and listen to past episodes at talkpython.fm.
- 0:58And follow the show on Twitter via at Talk Python.
- 1:01This episode is brought to you by Datadog and us here at Talk Python Training.
- 1:06Be sure to check out what we're offering during the segments.
- 1:08It really helps support the show.
- 1:10Hey, everyone.
- 1:12Quick bit of news before we get started on the episode.
- 1:15First, it's 2018, and we have announced some of our 2018 courses over at training.talkpython.fm.
- 1:22So there's a bunch of cool ones that are listed, and we've already shipped our first course, Mastering PyCharm.
- 1:28If you're trying to get better with PyCharm, if you've tried this application that can do so much for your Python code and kind of got overwhelmed,
- 1:35well, here's an eight-hour course with hands-on exercises that can really help you get better and more productive with PyCharm.
- 1:41So be sure to check that out.
- 1:43And if you are interested in the course or any of the other courses, we announced a new way to buy them, the Everything Bundle.
- 1:49So now you can pay just one price and own every course at Talk Python Training forever.
- 1:55It's way better than a subscription and about the same price.
- 1:58Be sure to check both of these out over at training.talkpython.fm.
- 2:02Thanks for checking out the courses.
- 2:03Now let's get to the interview.
- 2:05Eric Dave Kam, welcome to Talk Python.
- 2:08Hey, good to be here.
- 2:09Thanks.
- 2:09Yeah, thanks for having me.
- 2:10Yeah, I'm really looking forward to talking about talking to computers.
- 2:14It's going to be a good time.
- 2:15For sure.
- 2:16Yeah.
- 2:17So we're going to talk about Alexa.
- 2:19And just a warning to everyone out there listening, if you have some kind of Echo device, some kind of Alexa-enabled device,
- 2:26it's a really good time to mute it because while sometimes on podcasts we can avoid saying things like Alexa or Siri or those types of activation words,
- 2:36that's not going to work for this one.
- 2:38It's just not.
- 2:39So put yourself on mute.
- 2:40Just fair warning there.
- 2:42So let's start at the beginning.
- 2:43I guess we'll start with you, Eric.
- 2:45How did you get into programming in Python?
- 2:46Thanks for having me.
- 2:48And how did I get into programming?
- 2:50So you know how there are people who knew they wanted to be a programmer since they were age seven?
- 2:55I'm definitely not one of those.
- 2:56I'm a super late bloomer.
- 2:58I think I remember not long ago I was on your show talking about getting your first gig as a software developer.
- 3:04So that's kind of the timeline.
- 3:07Yeah, that was episode 39.
- 3:09That's like almost two years ago.
- 3:11But yeah, that's awesome.
- 3:12Yeah, almost two years ago.
- 3:13And so I used to use...
- 3:14So I've been a network engineer for most of my adult working life.
- 3:18And I used Python to solve network engineering problems.
- 3:22And I just kind of never looked back.
- 3:24Okay, awesome.
- 3:25Yeah.
- 3:25And networking is increasingly becoming a programming job itself, isn't it?
- 3:29Absolutely.
- 3:30So, you know, software-defined networking, although the original idea of OpenFlow never took off, but it actually puts, you know, software to front and center of network engineering.
- 3:38So without going too much deep into it, you know, I think it's just this fundamental shift that's going to be around for a long time.
- 3:45Yeah, absolutely.
- 3:46Dave, how about you?
- 3:47Oh, I've always been really a hobbyist, mostly starting with my parents' TRS-80 color computer back in the day when I was a kid, working with BASIC and fiddling around with that.
- 3:57Coming to Python, I honestly can't quite remember when I got started.
- 4:01I think it might have been towards the end of high school, maybe sometime early in college.
- 4:06I do vividly remember I kind of made a personal choice not to learn Perl and instead picked up Python.
- 4:12So sometime around then.
- 4:14If I look at the popularity of those two languages, I would say that was probably a good fortuitous choice there.
- 4:19Yeah, most likely.
- 4:20Yeah.
- 4:22And Cam, how about yourself?
- 4:24I'm kind of like Eric.
- 4:25I didn't really get into programming until later in life.
- 4:29I went to school to become a biologist and probably like the last few months of college, I just started picking up Python with automate the born stuff and just decided that's what I wanted to do.
- 4:45So yeah, it's only been a few years.
- 4:46I remember listening to that show with Eric on about getting your first job and that's actually really helpful.
- 4:52No, that's really awesome.
- 4:53Yeah.
- 4:54What a crazy way to circle back, right?
- 4:57Yeah, seriously.
- 4:57Small world.
- 4:58And now you're on this podcast with Eric.
- 5:01Yeah.
- 5:01Yay!
- 5:02It's nuts.
- 5:03Yeah, it totally is.
- 5:05And so do you still do any biology or are you just doing programming these days?
- 5:09Yeah, I'm just doing biology or programming.
- 5:13Never even stepped foot into a lab after school.
- 5:18You know what?
- 5:19There's a place better for creating stuff out of bits.
- 5:22Let's do that.
- 5:23Yeah, definitely.
- 5:24All right.
- 5:24So maybe let's go with you, Kim, since we're just talking about it.
- 5:28What do you do day to day these days?
- 5:30Yeah.
- 5:30So currently I'm freelancing and doing contract work for this company called Produvia.
- 5:35It's basically using AI and chat services for just different industries.
- 5:42Currently we're working on something for the hotel industry and things.
- 5:46That's cool.
- 5:47Is it voice assistant stuff or is it more like chatbots, like a Facebook messenger type thing?
- 5:52Yeah.
- 5:52So it's just been more messenger, like Slack based and like web app based.
- 5:57But we're planning on moving into the voice space pretty soon.
- 6:00So that's pretty exciting.
- 6:01It's definitely an exciting time for that.
- 6:03Dave, how about you?
- 6:04I'm an independent software consultant, mostly in the enterprise space and the kind of the sexy realm of knowledge management and enterprise search.
- 6:13So definitely not.
- 6:16Search all the things inside of your company.
- 6:18Yeah.
- 6:18Not as marketable as like AI and actual chat stuff.
- 6:22Yeah, but that's an important thing.
- 6:23Like these companies are huge and stuff gets crammed into SharePoints that people don't know about and Excel and access.
- 6:30And it's insane, right?
- 6:32The back end, like real world, as I kind of call it, it's predominantly Excel.
- 6:35I mean, that's the reality.
- 6:37So that's where I spend most of my time, mostly in the realm of Java.
- 6:42But when I get a chance to choose, I usually choose Python for some projects.
- 6:45So I've got most of my experience is sort of Java and Python.
- 6:50How do I get them to talk to each other, especially when dealing with interacting with any of these legacy enterprise systems?
- 6:56Okay.
- 6:56And you said you contribute to this thing called JPY.
- 6:59What's the story of that?
- 7:01JPY, yeah.
- 7:03Yeah, I had a particular request from a client to deal with an old kind of proprietary binary format from a, I'm not going to say the vendor's name, but a statistical software package.
- 7:12And this format had been around for a long time.
- 7:16Needless to say, somebody had reverse engineered it already, which was great.
- 7:19And published their findings.
- 7:21And it was really wrangling bits and bytes, dealing with pages of data inside this file format.
- 7:27And since this had to all be plugged into a Java program, long story short, I found it easier to solve the problem in Python.
- 7:33And then I just needed to find a way to stick that inside this Java app.
- 7:38Luckily, JPY, I came across as written by a consultancy in, I think, Germany, contracted to like the European Space Agency.
- 7:47And they wrote it originally to deal with this kind of data interchange between some other application that the ESA uses for the scientists and everything to get data in and out.
- 7:57And they wanted to use Python, like a lot of folks in the scientific community.
- 8:01Right.
- 8:02So I was able to take that and figure out a way to plug it in and solve some problems along the way.
- 8:07That's pretty cool.
- 8:07The only way that I knew about, I was aware of to do that before was with Jython.
- 8:12And so is it kind of like Jython?
- 8:13So it doesn't run on the JVM.
- 8:16It's nice and simple in that it's basically automation and kind of data passing between the JVM and a Python interpreter.
- 8:23And you can do it bidirectionally.
- 8:24So from Java, you can spin up a Python interpreter and run Python code, get data back in Java using the Java native interface.
- 8:36And the really cool thing is since I can't remember the person's name, but somebody did a fantastic job in the last year or so with the Windows distribution of Python.
- 8:45Right.
- 8:46That would be Steve Dower.
- 8:47Thank you, Steve.
- 8:48Yes.
- 8:48Yeah.
- 8:48And it's great because you can easily bundle it with something like this and pretty much ship it with your product and have an embedded Python instance.
- 8:57And it's funny that it works great on Windows, yet most of the time it's a headache on Linux.
- 9:01I just don't get it.
- 9:02Yeah.
- 9:03How funny.
- 9:04That's kind of the opposite.
- 9:05All right, Eric.
- 9:06You're doing network stuff, right?
- 9:08Like you said, just a little bit ago.
- 9:09Yeah.
- 9:09So mostly networking stuff.
- 9:11But lately, I think for the past two years ago, it's been very focused on network security kind of accidentally.
- 9:18And so within network security, very focused on distributed denial of service and use quite a bit of Python, but also other tools, whatever works for us to glean a little bit for that threat intel piece for DDoS.
- 9:30Oh, that's really cool.
- 9:31Yeah.
- 9:31Yeah.
- 9:31Yeah.
- 9:31Yeah.
- 9:31The whole computer security stuff around just both sides.
- 9:35The white hat, black hat, whole thing is really Python heavy.
- 9:39So that's pretty cool.
- 9:40Yeah, absolutely.
- 9:41And I think for us, since we're sort of a startup-ish company and certainly a small operation.
- 9:47So we choose to be very focused on solving this DDoS space well.
- 9:52And, you know, people talk about 10x better, and that's why we shoot for it, right?
- 9:56Like if we could do 10x better than our competitor, then we're able to, people, our customers, potential customers will be able to grasp the benefits of our stuff rather than our competitors.
- 10:06So that's why we shoot for it.
- 10:08Yeah.
- 10:08Sounds like a fun project.
- 10:09All right.
- 10:10So let's start out by talking about these voice assistants in general.
- 10:13We're going to focus on Alexa.
- 10:14They've got a really good developer story.
- 10:16They've got a really good Python developer story.
- 10:18And you guys have all either created some skills or worked on frameworks for creating skills.
- 10:25But let's say maybe, Dave, can you give us kind of a survey of the various options we have?
- 10:32We've got Alexa.
- 10:33We've got Google Voice and so on.
- 10:35There's Alexa Google Assistant.
- 10:37Can't remember exactly what they're calling it.
- 10:39Anyone can jog my memory here.
- 10:40I'm more well-versed in the Amazon ecosystem or ecosystem, if you will.
- 10:46Would you guys count Apple's Siri or Microsoft's Cortana in this space?
- 10:51Have they opened those up with APIs and SDKs?
- 10:54I actually don't know.
- 10:56You know, they have so many.
- 10:57Apple's so weird.
- 10:58They have like NDAs for developers and stuff, right?
- 11:01I haven't been paying attention for Apple.
- 11:03And I also haven't been paying attention to Cortana.
- 11:07Yeah.
- 11:07So I don't know.
- 11:08Yeah.
- 11:08I would say that's probably a no last time I checked, but it was a few months ago.
- 11:13For Siri and Cortana, definitely not.
- 11:16But for Google, yes.
- 11:18But they don't really promote it.
- 11:19So it wasn't until I actually got a physical Google, I guess, mini, then I started looking at it.
- 11:26And they do have a developer platform that opened up with third parties, whatever they call it, skills equivalent of Google.
- 11:32So, but that's, you know, Amazon's been really at the front and center for catering to our third-party developers, I would say.
- 11:39Yeah, that's interesting.
- 11:41I mean, on one level or another, all of those companies have been pretty good towards developers.
- 11:46But yeah, Amazon with AWS and all the stuff going on there, they're really kind of built for that, right?
- 11:53You can, you know, leverage their Lambda computing to implement your Alexa skill, for example, and things like that.
- 12:01Yeah, so pretty interesting.
- 12:02Yeah, totally.
- 12:03And also, I think they're actively going out.
- 12:05So you don't see as much, say, meetup groups or trainings.
- 12:10And I know they actually contracted Bignor Ranch to do Alexa trainings to bring people up to speed.
- 12:16And you see, you know, a lot of Twitter feeds from their evangelists.
- 12:19So I think all those feeds into the funnel of people, you know, maybe you could reach a thousand developers and, you know, maybe 10% to 1% of them actually take up.
- 12:28And then you funnel it down to the people who actually were public skills.
- 12:32So I think Amazon is the biggest, I guess, spread out the biggest net for these developers and then trying to catch those who are interested in the space.
- 12:40Yeah.
- 12:41Kim, what do you think?
- 12:42Yeah, definitely.
- 12:43Google, they have it open.
- 12:45And it's actually, it's gotten a lot easier to develop for the Google Assistant.
- 12:49But like Eric was saying, they don't really advertise out anything.
- 12:53Whereas, you know, Alexa is like, they're just like reaching out for like anyone to develop.
- 12:59Like they're really pushing it as something anyone can get into, which is really cool.
- 13:04And then, yeah, Siri, I don't, I'm pretty sure they don't really even have that open or anything.
- 13:10I've never heard of any third party Siri skills or whatever, which is pretty surprising just because they're, you know, they were the first to the space.
- 13:17And I feel like they kind of maybe dropped the ball with that.
- 13:20I totally agree.
- 13:21There's no way they can't have some sort of programming API though, right?
- 13:25Since they're going to have their HomePod thing.
- 13:27And I just looked, Microsoft has the Cortana Skills Kit, which came out in September, but it's in public preview.
- 13:34So, you know, that's also, I guess, a thing.
- 13:37But they don't, their devices aren't really out yet.
- 13:40Although there's some interesting places, I guess it shows up.
- 13:42Yeah, I think Cortana, even though like the development kit's not really out there, I'm pretty sure they do have a good amount of like integrations with different services aren't strictly aimed at Cortana.
- 13:55Right.
- 13:55So that's kind of cool.
- 13:56Yeah, they definitely are trying to integrate that into Azure and all their cloud stuff.
- 13:59So let's maybe just go down the list of the hardware that's available.
- 14:05So, you know, by way of contrast, like for Apple, I guess you have your phone.
- 14:10You guess you have your Mac if you turn that on and you have this HomePod thing.
- 14:14If you look at Alexa, I'll just go through the list kind of quick because there's tons of it.
- 14:19There's the Echo, which is like this tall speaker thing.
- 14:23There's Echo Plus, which is the same speaker, but is also a smart home hub.
- 14:28There's Echo Show, which is like a touchscreen video type of version.
- 14:33There's the Kinect, which will turn it into a landline.
- 14:37There's the Echo Spot, which will let you make video calls and stuff.
- 14:42That one's kind of cool.
- 14:43It's got a little screen on it.
- 14:45There's the Dot.
- 14:46That's like the little mini one.
- 14:47There's the Tap, the Look, the Fire TV.
- 14:51And they actually are integrating them into cars as well, which is pretty cool.
- 14:54So Ford Sync is coming out with Alexa integration.
- 14:59So you can say, ask it for driving directions and playing music and stuff like that, which is cool.
- 15:05And BMW and Mini are also integrating it as well for the 2018 models.
- 15:10So that's just some of the devices that these skills run on, right?
- 15:15I would also add to that.
- 15:17So the Spot, so we're recording this on the 19th of December, and that's when the Spot will actually come out.
- 15:24So I think outside of a few tech reviewers and on-site reviews, website reviewers, nobody has seen the Spot yet.
- 15:31Yeah.
- 15:32And then Show is kind of expensive.
- 15:34So I would say mostly in the wild, you would see the Echo and the Echo Dot, especially if you're talking about cars.
- 15:40There's a bunch of YouTube videos showing people how they fit like the Dot directly into the cup holder.
- 15:46And that's kind of cute and neat.
- 15:47And I know a bunch of my friends have done that.
- 15:49That is really cool.
- 15:50I've actually done that too.
- 15:53I would do that if it wouldn't freak out my wife.
- 15:55She doesn't like it around so much.
- 15:57She's not...
- 15:57We'll talk about the thing, constant listening, right?
- 16:00But my car has four USB plugs, and it runs off USB.
- 16:04It could just put it in one of those little cup holders.
- 16:06It'd be awesome.
- 16:06But no, it doesn't go in the car in my house, I'm afraid.
- 16:10I guess we should make the distinction between Alexa and all those pieces of hardware I talked about.
- 16:17So there's all this hardware, and then there's Alexa.
- 16:19Dave, do you want to maybe talk about the two?
- 16:22I mean, the hardware is really just the gateway to interact with the Alexa service.
- 16:26And the primary kind of concept is this idea of an utterance or a user's intent.
- 16:35So what is the user intending to try to do when they talk to the device?
- 16:39I believe Amazon splits the technology up into at least two or three different services now in the back end.
- 16:46That as a developer at scale, you could use individually for different things like voice recognition or text to speech.
- 16:53So it's kind of like the front end and back end of the Alexa service.
- 16:57But to the consumers, they really interact with just sort of the combination of all of that.
- 17:02Right.
- 17:03And can you take the Alexa AI piece, the software piece, and put it on your device?
- 17:09It's like if I was on Kickstarter and making some smart bike that would, I don't know, turn on the blinkers when I would tell it to turn.
- 17:15It's like, you know, whatever.
- 17:16Something stupid.
- 17:17Could I get that and plug it in?
- 17:18Yeah.
- 17:19A couple of folks have done some interesting projects like that.
- 17:21A while back, I know one of the initial kind of popular hacks that appeared online was somebody taking a Teddy Ruxpin and making it speak and basically becoming kind of a conduit for Alexa.
- 17:34And it was both exciting and creepy at the same time.
- 17:37That's exactly how I imagined it would be.
- 17:39There's still some videos on YouTube.
- 17:41You can even use it piecemeal.
- 17:43So if there are things where you wanted to build a service that did text-to-speech, you could use that portion.
- 17:48If you just needed to deal with sort of understanding and matching with some confidence what the user's utterance was, they have that as a service as well.
- 17:57That sounds pretty cool.
- 17:58It's definitely some really neat services that they have.
- 18:00And it seems like it makes it really easy to plug in your logic into their kind of text and sentiment understanding.
- 18:06Yeah, and like most Amazon services, you can either use them as individual piecemeal kind of components or pull them together into a solution.
- 18:14I guess one of the things I want to do is give people a sense of some of the skills that you can have on an Alexa device and then talk about ones that you have all either contributed to or worked on or something like that.
- 18:27So let me just run down the list.
- 18:28So there's over 20,000 Alexa skills now, which is pretty awesome.
- 18:33It definitely seems like the place where developers are building new things compared to all these other places we talked about.
- 18:39So you can have them for finance.
- 18:41You can ask what your credit card balance is.
- 18:44You can ask what the stock price is.
- 18:45You've got if this, then that integration.
- 18:47So if I get an email from this person that says this, put it on, edit them.
- 18:52You can speak to it about all the if this, then that.
- 18:55You basically integrate with that.
- 18:57It integrates with like electric cars.
- 18:59So I have a charge point charger from my car and I can ask it.
- 19:03You've got to direct it towards the skill.
- 19:05Right.
- 19:05So you say like ask charge point how many miles were added last time when I charged or something like that.
- 19:10So that's really cool.
- 19:11Got smart home drinks.
- 19:13You could ask it for like what cocktail you should have and how to make it.
- 19:16Flash briefing, travel.
- 19:18Like you could ask it where you could go for $400 or Lyft, all sorts of stuff.
- 19:22Right.
- 19:22Maybe go around each one of you.
- 19:25Like what's your favorite skill?
- 19:27Not sure what my favorite skill would be, but I've never published a skill to like the Alexa marketplace or whatever it's called.
- 19:35But I've mainly just created like little personal ones for my own use.
- 19:40Back before I found out about this project called Home Assistant, which basically connects different smart appliances.
- 19:48I use Alexa to like control some lights and stuff.
- 19:51And then for my old job, I would just ask Alexa to trigger like some scripts to run my computer like nightly.
- 19:58Alexa, is my server up?
- 20:00Alexa, am I still employed?
- 20:05Exactly.
- 20:06Yeah.
- 20:07And then I also created the audio sample skills for the Flaskask repo, which we'll be talking about in a little bit.
- 20:13And that was pretty fun.
- 20:15Yeah.
- 20:16I really like how Alexa allows you to stream audio, like good sized audio streams.
- 20:21That makes it really cool.
- 20:22Yeah.
- 20:22I do a lot of listening to music on my Alexa.
- 20:24It's cool.
- 20:25Yeah.
- 20:25Yeah, definitely.
- 20:26How about your...
- 20:26Yeah.
- 20:27My favorite skill is my skill.
- 20:29So I published several skills and the ones that are my favorite and certainly attract the most unique users per month is Seattle English Tutor.
- 20:39So if you imagine, you know, just having this person or this assistant who would help you train your English skill, if English was your second language, which was my case, then that's what it is.
- 20:50So actually, the first time I heard how Alexa operates and how, you know, see a few examples, this just springs to mind.
- 20:58And of course, you know, this was also inspired by Mandy Chen.
- 21:02So she was one of the earlier developers slash evangelist.
- 21:05And she put out this beta and just kind of took it from there and published this skill and working on version two of that.
- 21:11That's pretty exciting.
- 21:12Very cool.
- 21:13Dave?
- 21:13It's a toss up.
- 21:14So, you know, there's your favorite is usually the one you have published if you've got one published.
- 21:18So I worked with Vermont Public Radio to help them basically create an Alexa skill that would allow users to stream their live streams as well as the episodic podcast content that they release.
- 21:31Yeah, that's cool.
- 21:32I'm thinking about doing that for the various podcasts, like especially around Python Bytes, because it's got all these little pieces.
- 21:37And there's a lot of cool things you can do with audio because that's the native format of this thing, right?
- 21:42It's quite awesome.
- 21:43You can just kind of point the Alexa service at a stream and it can handle kind of starting and stopping and just kind of knowing a little bit where it left off.
- 21:51Then you also had another one that got banned, right?
- 21:53Yeah.
- 21:54Like you were a rebel.
- 21:56So this was when I first got my dot, it was almost a year ago.
- 21:59It was about, I think it was Christmas last year.
- 22:01The very first thing I did was make a skill that would interact with Twitter, go to Donald Trump's Twitter feed, grab a random tweet of his last, you know, 100 or 200, whatever is accessible via the API, and read it out loud.
- 22:16So you could ask Alexa, you know, what's, you know, either his latest tweet or to ask Alexa to read a random one.
- 22:23And it was almost always comical.
- 22:24But after submitting it...
- 22:27They wouldn't put it up there, huh?
- 22:28No.
- 22:28So they were running, this kind of goes back to the idea of Amazon having done a pretty good job in developer outreach.
- 22:34They were offering a free Amazon hoodie or something like that.
- 22:38If you got a skill published in the store before maybe January 10th or something like that.
- 22:44And I submitted it and they rejected it because of copyright infringement, allegedly.
- 22:49So I didn't know you could own your tweets, but that's sort of news to me.
- 22:56My guess is they were just sort of afraid of the litigious Donald Trump at the time.
- 23:01Yeah, it must be because that is the public thing.
- 23:04And especially now, it's, you know, communication of the United States government in a sense.
- 23:09So that, right, that's kind of in one sense, all ours, I guess.
- 23:14I don't know.
- 23:14It turned out I did some digging.
- 23:15There were some already in the skill store.
- 23:18They avoided using Trump's name.
- 23:20So they said things like presidential tweets or something like that.
- 23:23This portion of Talk Python To Me was brought to you by Datadog.
- 23:27Datadog is a monitoring solution that provides deep visibility into your Python apps.
- 23:32So you can understand why certain requests are slow or what caused a specific error.
- 23:36Datadog's open source tracing client auto instruments popular libraries like Flask and Redis,
- 23:41as well as async libraries like async.io.
- 23:44So you can get started without making any code changes.
- 23:46Within minutes, you'll be able to investigate bottlenecks in your code by exploring interactive flame graphs and rich dashboards.
- 23:53Start a free trial to see for yourself.
- 23:55As a bonus, Datadog will send you a free t-shirt.
- 23:58Just visit talkpython.fm/Datadog for more details.
- 24:03The certification process and all that is kind of evolving, just like everybody.
- 24:09You know, they're kind of evolving as we go.
- 24:12So if you put the name unofficial or like fan or fans of or whatever, then you get, not to guarantee it,
- 24:21but you know, you get, you have an easier time getting it approved if it was, you know, something of that nature.
- 24:26Okay.
- 24:26Yeah.
- 24:26That's good advice.
- 24:27The president of the United States is not a matter, but yeah.
- 24:30But just like normal companies, like fan of Disney of, you know, whatever it is.
- 24:35So something like that.
- 24:36Cool.
- 24:36All right.
- 24:37Well, let's talk about how you build these things.
- 24:38So obviously Python is a good way to do it, which is pretty awesome.
- 24:43And I guess the first thing people might wonder is, do they have to commit to going and buying an Echo device, piece of hardware, so that they can do this?
- 24:52The answer is no.
- 24:53It's like developing for Android apps.
- 24:55You could use the simulator.
- 24:56It's not as good as a real thing, but it's, it'll get you closer until you feel like you were committing, you feel like committing to a hardware purchase.
- 25:04And of course the hardware is getting cheaper and cheaper and so on.
- 25:07But, so the software that you could use is echo sim.io for the website to, you know, kind of click on it and then speak and just behave just like Alexa, except you can't do video stream, voice streaming.
- 25:18So I don't know if you do podcasts and so on.
- 25:21And another tool is your Revert mobile app that you could download and then behave just like Alexa.
- 25:26That's like an iOS app, but then you can talk to it and it basically, it is an Alexa, but it's just a software one, huh?
- 25:34Yeah, absolutely.
- 25:34So it's like, you know, it's both Android and iOS as far as I know.
- 25:38And so when you launch it, it just has this big dot, right?
- 25:41Like the whole screen just filled with the dots and you click on it and then, you know, it listens for whatever input using your microphone and then, you know, dishes out the response that way.
- 25:49And you link it to your Amazon account, of course.
- 25:51Cool.
- 25:52So one thing that I ran across getting ready for this show that I had seen a couple of years ago and I kind of forgot, but it seems so super helpful here is Ngrok.
- 26:00Have any of you guys used Ngrok for this?
- 26:02Yeah.
- 26:03Ngrok is a great tool.
- 26:05Tell people what it is.
- 26:05It exposes a local port on your computer and basically tunnels, provides you a public URL that will tunnel traffic through that into your local port.
- 26:18So if you're like developing a skill or some other type of application that needs to receive requests from the outside, you just fire up Ngrok and point it, give it the port you want to expose.
- 26:31And then you get this temporary Ngrok.io URL.
- 26:37And that's basically just the public URL that you get for free.
- 26:41Yeah, that's really cool.
- 26:42Because one of the reasons you need that is you basically have two choices when you set up an Alexa skill.
- 26:47There's as you go through the Amazon dashboard.
- 26:50And one of them is where do we invoke this, the logic of your skill?
- 26:55And it could either be an AWS Lambda, which is the serverless computing thing, which you can definitely do in Python, or it could be some HTTP endpoint.
- 27:06And so if you want to do like a dev version testing on your machine, you can run, say, like Flask or Flask Ask, for example, on localhost on a certain port.
- 27:18And then you can use Ngrok to map that localhost only port out to Ngrok.com, IO, whatever it is.
- 27:25And then that becomes a public HTTPS URL that you can tell Amazon is how to get to it.
- 27:30And it actually hits your dev server.
- 27:31I guess you could even like have breakpoints and all sorts of crazy stuff when you talk to Alexa, right?
- 27:35I think for Ngrok, the free version, because I actually look into Ngrok for not for Alexa skills, but for my day job.
- 27:41So I think for the free version, you could have your familiar ports when you launch.
- 27:46And if you pay, I think, $10 a month, you get two reserved ports.
- 27:50And you could even use custom domains for you to fix them when you launched Ngrok.
- 27:55So but yeah, you know, if you don't use Ngrok, I guess let's just say you have your own HTTP server, you have to worry about like certs, and you have to worry about trusting issues and so on.
- 28:05So Ngrok, it's kind of what I've seen people do if they don't use Lambda and use your own server.
- 28:09Okay, that makes a lot of sense.
- 28:11All right.
- 28:12So I guess, Eric, I'll stick with you for a sec.
- 28:14What do you use when you're writing these skills?
- 28:17Like what's the tech stack look like?
- 28:18I just use the, I think other people would echo this, the front part, like the interaction with Alexa to resolve whatever your voice stream is into an intent.
- 28:29There's no other way than to just using their templates, using the ask Alexa skill kit.
- 28:35And then like you mentioned, I use the triggering for Alexa as the input to trigger my Lambda function.
- 28:41And then Lambda function, if I need a database, I use DynamoDB.
- 28:44And that's kind of the whole flow.
- 28:46Yeah, that's pretty cool.
- 28:47And DynamoDB is a really interesting NoSQL as a service inside AWS, which is cool.
- 28:52Yeah, super fast.
- 28:53Yeah, it's crazy fast.
- 28:54That's cool.
- 28:55Cam, how about you?
- 28:56Yeah, so I don't use Lambda or AWS or anything.
- 29:01I just typically, since I haven't published, it's usually just through NCROC.
- 29:05But I write all the code using Flaskask.
- 29:08And then once I'm ready to kind of just have that running, I host it on Heroku, just like the free tier.
- 29:15So it's kind of just two steps.
- 29:17Yeah, that's nice and easy.
- 29:18Yeah.
- 29:19We'll definitely, we'll talk more about Flaskask in just a second.
- 29:22Dave, how about yourself?
- 29:23Yeah, it's Flaskask in Heroku.
- 29:25And with Heroku, the free tier for most skills, especially if it's sort of just a personal skill, and you don't expect it to become like a top 10 skill in the skill store, you can pretty much run the free tier indefinitely.
- 29:39I can imagine like how much traffic could Alexa possibly generate?
- 29:42That's sort of the good thing is that it's very kind of quick in the interactions.
- 29:46And even if you're doing something with audio and audio directives and opening a stream, the stream actually goes from the stream source to Amazon and then to the endpoint, whether it's a dot or something else.
- 29:57So you don't have to worry about it.
- 29:58You don't have to flow it.
- 29:59Yeah.
- 29:59You don't have to pass that through.
- 30:00Yeah, that makes it really nice.
- 30:02Yeah.
- 30:02So your Heroku instance or something else could spin down for a while.
- 30:05That stream could play for a half hour.
- 30:07The user might then pause it or stop it.
- 30:09And then you'll get the call to your server from Amazon saying that the user stopped the stream.
- 30:15Yeah.
- 30:15So it seems like a lot of stateless, really quick, short type of things.
- 30:18Yep, definitely.
- 30:19And that's sort of the catch is the stateless part is that this is probably getting a little too far ahead.
- 30:23But I mean, that's really the hardest part in dealing with the skill development is that Amazon assumes you're going to wrangle all the statefulness.
- 30:31Right.
- 30:31And that might be why you might want a database, for example, like Eric was saying.
- 30:35Right.
- 30:36More or less push the session into the database.
- 30:39The next request comes in from that user and you can like kind of infer where you might want to pick up again.
- 30:44Because it's not like normal web application development where you might have a cookie or a session or something.
- 30:49And then all this middleware you can use, it'll automatically pick that up.
- 30:52What do you use to trigger off of to identify the user?
- 30:55Do you have their account, their device ID, something like that?
- 30:58From my experience, there are a couple different things.
- 31:00And they change based on basically what part of the Alexa skills API you're using.
- 31:05For things like audio, it's once the user actually starts a stream and they start hearing audio on their Echo device, it actually closes the session.
- 31:14So your session that you might be tracking with a session ID actually is no longer.
- 31:19When that user, that same user issues a stop or a pause or a skip, it'll look like a brand new request to your Echo application in Heroku, for instance.
- 31:30So there's like a special, I believe, context ID.
- 31:33This is an area I actually caused me to give a whole 45-minute talk at a local Burlington Python meetup here around the oddities of this.
- 31:44But for a while, there's even discrepancies in Amazon's only.
- 31:49I don't believe so, unfortunately.
- 31:50All my materials are online.
- 31:51Okay.
- 31:52We haven't been recording them.
- 31:53But Amazon's documentation was also kind of incorrect.
- 31:56And for those who had been doing skill development maybe for a while or kind of tried their hand at it like a year ago, if you tried to do any of the audio stuff with Amazon's actual formal test suite that they have in their developer web app, it didn't work because it didn't have this proper kind of unique context ID generation.
- 32:15So you just have to hold on to that, and then you need to hold on to the stream ID.
- 32:19There are certain things you can give to Amazon saying, you know, if you're doing a dialogue with a user and you're not closing the session, the user chooses, I think, you know, common example skills or like pick your, tell me your favorite color.
- 32:30And then you use that later on in the conversation.
- 32:33Amazon can hold that session-based information.
- 32:37But once you start playing a stream, the session's gone.
- 32:41So it's on you to have a caching layer or a database that says, okay, for this particular interaction, they started this stream.
- 32:49So that way, when you get the stop or the pause or the skip, you know what it refers to.
- 32:53Okay.
- 32:54Yeah, that's cool.
- 32:54It sounds challenging, but you can make it work.
- 32:57It's one of the newer areas for playing streams.
- 32:59So from day one, you always get the user ID and the session ID.
- 33:04So the session ID obviously just, you know, as good as the session goes.
- 33:07And the user ID is what, it's a string that associated with your Amazon account.
- 33:11So say if you use have multiple like Echo and Echo Dot, you will get the same user ID for both devices when they launch the same skill.
- 33:19So later on, I think you face a challenge.
- 33:22If you want to differentiate between Echo and Echo Dot, then you want to use the, there's a newer checkbox to say, ask for a user's locale.
- 33:30And if you do that, then you actually get past the device ID.
- 33:33And that's how you get by for identifying unique devices versus just the user ID.
- 33:37Right.
- 33:38If you have like one in your kitchen and one in the living room and the kids are messing with it in the living room and you're in the kitchen, right?
- 33:45Like, yeah.
- 33:45You might want to differentiate between those.
- 33:47There are instances that you want to have a frictionless experience between, you know, different devices that you have as long as you have the same ID.
- 33:54Like say, for example, if you enable a skill set, you know, for your one device, then you automatically enable it because it's associated to your Amazon account.
- 34:01But there are other times when you need to differentiate between devices because of device limitation.
- 34:06You know, for example, you know, Echo Show will show you a little screen and while the Echo itself doesn't.
- 34:12So there are different use cases for them.
- 34:14And because this is so new and Amazon's learning as we go, they definitely try to iterate based on that.
- 34:20And one thing that I would kind of just stand my soapbox and sing the praises for Amazon is they do listen to developers, arguably more so than Apple and Google and all the other platforms.
- 34:31That's how I feel about it.
- 34:32That's pretty cool.
- 34:33So let's talk about what Dave and Cam have brought up, this thing called Flask Ask.
- 34:39So Flask Ask is, is that the ASK, Alexa Skill Kit is what the ask stands for?
- 34:45Right.
- 34:47Okay, cool.
- 34:47So Cam, tell us what Flask Ask is.
- 34:51It's a Flask extension.
- 34:53It's made by this guy, John Wheeler.
- 34:55And it's a really cool Python package to get started with Alexa.
- 34:59Basically, he created, he provides some decorators with Flask.
- 35:05You know, you would route your view functions with at app.route.
- 35:09You do the same thing, but it's with like ask.
- 35:12And then you basically just write your code as if you're doing typical Flask web app.
- 35:19You just have your view function.
- 35:20And when you return your response, it provides special response classes to either ask or tell the user.
- 35:29So you can like ask something and then expect a response back to that question.
- 35:34Or you can just send a message to the user.
- 35:37And it just makes it really simple to get going.
- 35:40And I've seen that it's pretty cool.
- 35:42It's brought in a lot of people who are new to Python or programming in general or just diving in, which is pretty good for the Python ecosystem.
- 35:52A lot of people know Flask or they know some Python web framework, which is super similar to Flask in a way or another.
- 35:59And if you can just write a Flask app and instead of put, you know, the view decorator or whatever, the route decorator, you can just say at ask.intent.
- 36:09And name basically the intents of your app, which is pretty cool.
- 36:14So it seems like it's really, really approachable.
- 36:17Dave, what would you add to it?
- 36:18It adds templating as well for the dialogues and the interactions with the user.
- 36:23I know what templating looks like in the website.
- 36:25Like that's the HTML.
- 36:27But what does that mean in the context of a voice assistant?
- 36:31It's extremely similar.
- 36:32So you can define your basically the spoken portion of Alexa when she talks back to you.
- 36:39She or it or whatever you want to call it.
- 36:40And you can also use different pluggable variables as well.
- 36:45So it's sort of like if you were building a web application with Flask or Django or any of the other Python frameworks.
- 36:51They typically have some sort of templating engine where you can write your HTML, but then have some programmatic logic in there and do some dynamic substitution when it renders it.
- 37:01You can do the same thing with the spoken responses back.
- 37:04So it makes it a lot easier because the big nicety of Flask ask, other than it fits right into the kind of the Flask model of building web applications,
- 37:14is that it also deals with wrangling all the nasty JSON that you need to send back to Alexa.
- 37:20Yeah, that's pretty awesome that you can kind of forget about that.
- 37:23Yeah, you can take Flask ask.
- 37:24You can be up and running and never have to really, you have to know a little bit about the sort of how the API works with the idea of the requests and the responses.
- 37:32But you don't need to know the JSON format, which is pretty lengthy.
- 37:36The templating and the stuff for the responses, what's also cool is it also allows for SSML.
- 37:42So you can kind of give like the actual voice response some more kind of customization.
- 37:51Yeah, like the inflections, the way you can kind of tailor how things are pronounced.
- 37:55So it's not as robotic.
- 37:57Yeah, that's cool.
- 37:58So you can make it sound like it's a question like go to the store versus go to the store.
- 38:03Yeah, I think some of that Amazon does pretty well by default.
- 38:06But for, you know, if you have the name of a product or something, I had a heck of a time with the Vermont Public Radio skills, just making it sound kind of conversational.
- 38:17I can imagine.
- 38:17A good thing for SSML is besides, you know, like you want to change the default behavior.
- 38:22Like if you want to, instead of say cat, you want to spell out the C-A-T.
- 38:26That's where you invoke your SSML.
- 38:29They also have a bunch of what they call the speechlets.
- 38:32So that when you want to add more speechlets, but you don't want to worry about like encoding your audio into a specific format that Amazon likes.
- 38:42So, for example, you could have SSML go, wow, or like, hey, you just open a door, making a door sound like that kind of door sound if you want to play like a voice game.
- 38:52And that's exactly what you use SSML for.
- 38:54You just use a little tag, like XML tag, and then you find out the list of ever-growing list of speechlets that they have.
- 39:02And then you could start having interactions that way without worrying.
- 39:06Like I said, like the biggest challenge for encoding your own audio for Amazon is the bunch of restrictions that they place to just because for their consideration and for a speed of getting that file and play back.
- 39:17For voice, you don't have the luxury of visual.
- 39:20So you always have to short, concise, and fast.
- 39:23So that's kind of cool that they have these, you know, I would say about 30 speechlets.
- 39:28And of course, they're adding in more every day.
- 39:30That sounds really cool.
- 39:31One of the things you made me think of when you're talking about your door and stuff is you could do a pretty awesome audio replacement of like a text-based game, right?
- 39:42You walk into the room and you see this.
- 39:43What do you want to do?
- 39:44Like all those types of games like Leisure Shoot Larry or The Muds or whatever.
- 39:49You could probably have a really awesome little skill that is like that game, right?
- 39:53That is exactly the example they give.
- 39:55So if you have gone through some of the later, not the beginning, but the later like Amazon workshops and stuff, and that is exactly the example that will walk you through.
- 40:05And the JSON example, I'm sorry, the JavaScript example that they give online that they publish open source is the game that you interact with people and especially kids.
- 40:17They don't have a lot of patience and they don't have a lot of white vocabularies.
- 40:21So they use that as an example.
- 40:23So, you know, you open up a box and do you either take a look at it or you close it right away?
- 40:28And then you wait for the kids to respond and then you'll go from there.
- 40:32So you have all these, you know, interactions that, like you said, the gaming aspect of it.
- 40:36That sounds pretty fun.
- 40:38You know, with this Flask ask thing, it makes it so much sense, like where ngrok fits in.
- 40:43So basically you write your code as a Flask application, which, you know, you can run.
- 40:50It's going to run on localhost on port 5000.
- 40:52But then in order to actually test and develop and debug that, you need to be able to let Amazon services directly call that service, right?
- 41:02Right.
- 41:04You can do some local testing because it is a Flask application.
- 41:08I see.
- 41:08So if you know what to send, what to expect, you can like send it that over and over just through like Postman or a unit test or something, right?
- 41:16Exactly.
- 41:16And you can do it programmatically in your unit tests and you can always look at the response that comes back.
- 41:21But I mean, from my experience, nothing, if you're going to submit something and not use it just for personal use, nothing beats actually using a hardware device.
- 41:30Cool. Is there a way to make like personal skills that your Alexa has that are not public?
- 41:36It's like associated with your Amazon account.
- 41:38Like, I think it's in development or something.
- 41:42That's what the skill is marked as.
- 41:43But do you guys know if that like persists or is there like a limit to how long you can keep it like running privately?
- 41:52I don't think there's a limit because I definitely have some old ones lingering that I haven't cleared out.
- 41:57Until Lambda starts to charge money, I would just keep all of my skills.
- 42:00And so you could, you know, for sure, you know, keep a skill in development.
- 42:05And I think more recently, I don't know how long it's been, but definitely more recent than day one is that you could start inviting your people to, you know, beta test that skill set.
- 42:15So you have their Amazon, I think you either you get their email address associated with their Amazon account.
- 42:20And then you could submit it to, you know, a little page or portal to say, I want to have, you know, my code test, beta test my skill.
- 42:28So that way I could share that skill without having to publish it in the marketplace.
- 42:31That's pretty cool.
- 42:32I can just imagine you might want to automate some stuff for you, but it's too specific.
- 42:37Yeah.
- 42:38Once my grandma started turning on my living room lights, I would just like cut her off.
- 42:41Right.
- 42:41That's right.
- 42:45Like if my robot lawnmower finishes and then goes in the garage, first open the garage.
- 42:51And when it's in the garage, close the garage and then turn on the sprinklers.
- 42:54Like that's probably not a skill everyone wants, but that'd be really cool to say.
- 42:57Go mow the yard and then water it.
- 43:00You know, what's super creepy is that for the new Amazon show, you actually have a drop-in mode.
- 43:05So they could actually call you like a Skype call with video without you knowing.
- 43:10I think you could, it has to be opt-in.
- 43:12But if you have two shows blown to the same account, you can actually do that drop-in thing.
- 43:16And which is just super creepy.
- 43:17I mean, it's almost up there as Amazon keys, but you know, that's another story.
- 43:21Another day.
- 43:21Yeah.
- 43:23The Amazon keys, where you basically give Amazon a key for the delivery people.
- 43:28Interesting.
- 43:29Two, third-party contractors for Amazon as well.
- 43:32That's right.
- 43:33Not even Amazon.
- 43:33Yeah, exactly.
- 43:34But anyways.
- 43:35Quite interesting.
- 43:36Yeah.
- 43:37That's a whole nother level.
- 43:38So Dave and Cam, you guys both contributed various things.
- 43:44Cam, let's start with you.
- 43:45What do you do for Flask Ask?
- 43:47Yeah.
- 43:47So Flask was like my first real step into the open source world.
- 43:52I started by just going through the code base and trying to document everything.
- 43:57Or like the doc strings and everything.
- 43:59And that kind of just gave me a really good understanding of how the whole thing worked.
- 44:03And then at the time, there was no support for audio streaming besides through SSML, which is, it's limited to like, I don't know, 30 seconds or a minute or something.
- 44:16And once Amazon announced like basically the audio streaming capability, I implemented the, basically the response classes for streaming like audio streams from some URL.
- 44:32So that you just say return audio and then whatever.
- 44:36Dave came along later and really made that much more solid for working across with that whole session issue here speaking of.
- 44:45Yeah, cool.
- 44:46And Dave, how about you?
- 44:47I basically built off of a lot of the groundwork that Cam had laid.
- 44:50So I had, I found Flask Ask when I first started doing skill development.
- 44:55And I used it as the basis for the streaming skill for Vermont Public Radio.
- 44:59And everything was working great.
- 45:02And we went and pushed out kind of a testable version into Heroku.
- 45:06And as we were manually testing it, we found that every once in a while, the stream would just sort of get interrupted or stop.
- 45:14After some debugging, I found out that it was because with running it in Gunicorn.
- 45:19I never know how to pronounce it.
- 45:21It had multiple sort of workers.
- 45:25And one worker would retreat or respond to a request from Amazon.
- 45:30And then the other one would.
- 45:31And they didn't have any sort of shared state.
- 45:35They were just using kind of thread local storage.
- 45:37I think that's basically what the default behavior was at the time.
- 45:40So I had to find a way to get them to use some shared state to be able to solve the problem of starting and stopping the streams.
- 45:47And luckily, all it required was digging into sort of work sub, the underlying kind of underpinnings of Flask, figuring out how that worked.
- 45:54And conveniently, there was a caching layer already there.
- 45:57So it was a matter of just kind of bringing that up into the Flask ask world, making it simpler.
- 46:01Yeah, that's cool.
- 46:02Using the simple cache, I think, is the actual name.
- 46:04So it's as simple as that, where it'll do it in memory.
- 46:06And that solved the streaming problem.
- 46:09Let's say push across the different request threads, right?
- 46:12Right.
- 46:12Because you can never guarantee who's going to respond to it.
- 46:14And if you did spin up multiple, let's say you did have a massively popular skill, or maybe your skill is actually part of a larger application.
- 46:22It also just happens to be an Alexa skill endpoint.
- 46:26You might not even know which server responds to it.
- 46:28Interesting.
- 46:29So something that's similar to this that you created, Cam, is called Flask Assistant.
- 46:34All right.
- 46:35Tell people quickly about that.
- 46:36Yeah, it's basically just the Flask ask for Google Assistant.
- 46:41And rather than using the Alexa Skills Kit and basically the whole Amazon ecosystem, it uses something called Dialogflow, which used to be called API.ai.
- 46:54And what that is, is basically a NLP, a natural language processing platform owned by Google.
- 47:03And so it's pretty analogous to Flask ask.
- 47:06It's got a very similar API and everything and allows you to integrate your, it's not called a skill for Google Assistant or API.ai, but basically your little voice app with things like Google Assistant or Skype or Facebook Messenger.
- 47:24Do they have to run in different processes?
- 47:25Or could I host both a Flask Assistant and Flask ask app in the same code on the same server?
- 47:31I actually haven't tried that, but it should be possible just by basically stacking decorators.
- 47:36And then one cool thing about Dialogflow is that Alexa is actually one of the integrations.
- 47:42So if you were to do it that way, you could basically export your project into the Alexa Skills Kit.
- 47:48But I mean, if you're going to do that, it makes more sense to just use Flask ask since it's...
- 47:52Right.
- 47:52Yeah.
- 47:53Yeah.
- 47:53And maybe you just run two processes on two different ports or whatever.
- 47:56But yeah, it's still pretty cool.
- 47:57Yeah.
- 47:58It's been fun working on that.
- 47:59We're getting sort of near the end of our time together.
- 48:02Let's talk about maybe a few higher level questions.
- 48:06First, maybe Eric, you can go with this one first.
- 48:09How do you make money as an Alexa developer?
- 48:12So if I was working on an iPhone app, an iPhone game, I know how I make money there.
- 48:17Or Android, just not as much per user.
- 48:20But still, you put it in the store, people buy it.
- 48:22You don't buy these skills.
- 48:24You just tell Alexa to install them or you go to your phone and install them, right?
- 48:26Yeah, that was my question from day one.
- 48:28It's like, how do you make money from it?
- 48:30And so they recently announced an in-app purchase.
- 48:33So essentially, you could make purchase just very much like what you do in an iPhone app.
- 48:38But I haven't...
- 48:39Because it's so new, I don't know the details on that.
- 48:42But currently, you have two ways to make money.
- 48:45Well, three ways, I guess.
- 48:46So one is you could get Alexa credits, AWS credits if your Alexa skill invoke charges.
- 48:53But since I tie my end to Lambda, and currently the first million calls per month in Lambda is free.
- 48:59So basically, it's $100 per month and it's month-to-month basis.
- 49:03So I basically just use that to fund my other AWS usage.
- 49:07So that's pretty cool.
- 49:08And the second way that you can make money is you could be a top skill.
- 49:11I've seen people who post on their Twitter tweets that they've made like $1,100 per month of being top skills.
- 49:19But I don't know what the selection criteria is.
- 49:22So I can't say for sure like how to do it or how not to do it, what gets you there.
- 49:27But that's certainly another way that they've announced and you can make money from it.
- 49:32And the third way is basically just use Alexa as a front end for your voice user interface.
- 49:38And you tie that into external account.
- 49:41And that's what the majority of the companies are doing, whether it's public radio, maybe they do charge people.
- 49:46I'm sure in this case they don't, but for Vermont, public radio.
- 49:50But like say Uber, for example, right?
- 49:52Then you use Alexa to order your Uber rides or Domino's Pizza, which is a US pizza chain that you could use that to order pizza.
- 49:59And tie into your account.
- 50:01And then that you make money that would increase your usage.
- 50:04That's a third way.
- 50:04Right.
- 50:05It's just a funnel, right?
- 50:06To an existing business model.
- 50:08Yeah.
- 50:08Exactly.
- 50:08And I don't know.
- 50:09I don't think there's any studies.
- 50:11I'm sure Amazon's more than happy to tell you how much increase of usage that, you know, people increase their, you know, monthly spending on Uber or Domino's Pizza by 20% just by having your Alexa skill or whatnot.
- 50:22But I haven't seen any studies like that.
- 50:24So I can't say for sure.
- 50:25But the third way seems to be most common for business today outside of just hobbyists or some other companies.
- 50:32Yeah.
- 50:32Right.
- 50:32I mean, Dave, that sounds more like what you're doing.
- 50:34I know public radio doesn't necessarily directly make money, but increasing listenership is a key goal, right?
- 50:40Right.
- 50:40There's sort of two sides to this.
- 50:42One is being able to engage.
- 50:44In this case, since it's Vermont Public Radio, it's engaging listeners and building awareness and also helping drive contributions during fundraisers.
- 50:54So obviously having the ability, you're using the stream.
- 50:57So you're delivering your product.
- 50:58In this case, they're live content and they're episodic content.
- 51:03And in doing so, they also have the ability to advertise and promote their own offerings.
- 51:07So that's sort of one approach where it's sort of more of a marketing channel.
- 51:12And I think in what Eric was saying is really sort of what I describe as like the post-walled garden economy where you no longer get rich in the app store within the walled garden.
- 51:24You really have to use it as a way to accelerate your business model outside of it and just meet the customer where they are.
- 51:31You know, if they're in their kitchen and they're trying to cut vegetables and corral a kid with one arm, being able to have the conversation with them over Alexa is sort of the way to meet them in their time of need.
- 51:42That's pretty awesome.
- 51:43The other thing that I think we're touching on is these devices, except for mine when I just turned off the microphone so we could actually have this without being interrupted.
- 51:52Are you sure, Michael?
- 51:53I mean, that's a good question, right?
- 51:56These things are generally always listening to us, but maybe they don't process everything we're listening.
- 52:02Maybe they don't share everything we're listening.
- 52:03But Cam, maybe you start first.
- 52:05What are your thoughts on the privacy around always listening devices?
- 52:08When you get one of these devices, you just got to be aware of that and personally be okay with it.
- 52:15I'm not sure if Alexa provides this, but I know with the Google Home, you can go to your account activity and see and listen to everything that it has recorded.
- 52:26And I know you can delete that.
- 52:29I'm not sure if Amazon is as transparent, but I think it's just something you got to accept if you're going to buy one of these.
- 52:36Yeah.
- 52:36Eric, what do you think?
- 52:37I think the answer is yes.
- 52:38So I know I have been going into my Amazon or the Alexa app and listening to what Alexa knows about me and deleting the voice bits and so on.
- 52:49But of course, you know, this is a big topic and it's been the news recently just because of the murder case.
- 52:54I forgot which state it was in.
- 52:55Basically, you know, you could go, we'll probably include it in the show notes or whatnot.
- 52:59But so I actually went out and looked at the official response from Amazon regarding this.
- 53:04You'd never know, like, how much do you trust Amazon, right?
- 53:07Back to the Amazon key issue.
- 53:08But the official word is that they do a one second buffering to detect your wake word.
- 53:15And then they constantly delete that one second buffering.
- 53:17So unless you hear one of the wake words in today's setting is one of the four, right?
- 53:24You could choose to have Alexa, Amazon, computer or Echo as your wake word.
- 53:28So they do that one second thing to do echo cancellation and they do to detect false positives.
- 53:34But the wake word and then only if you speak the wake word, then you start recording and so on.
- 53:38Obviously, like you did, Michael, is to put on the mute button when you really don't want anything to, when you don't want Echo or Alexa to participate anything.
- 53:46Yeah.
- 53:46And Dave, what do you think?
- 53:47I've really got two sides to this.
- 53:48One is I'm less concerned about what Amazon or somebody else is hearing.
- 53:52But I do like to play around with it because I'll use funny voices.
- 53:55Like even with Comcast, they now have like voice control and the remotes.
- 53:59And I just try to see how good it can recognize the weirdest voice it can come up with.
- 54:03And it's shockingly good.
- 54:05And if they want to record that, feel free.
- 54:07They can keep that on a server somewhere.
- 54:09I'm more concerned about sort of the secondary kind of proliferation of all the connected things that people are going to run out and buy and plug into this ecosystem.
- 54:18Because, you know, you look at, you know, the smart home things, even just a smart home outlet.
- 54:24That was like the big thing.
- 54:25I know my family went out and bought last year when we all got Echo Dots.
- 54:29Usually you have to sign up for a third party service or something from that consumer electronics manufacturer who's not skilled at securing a software based environment.
- 54:40Yeah.
- 54:41And that's what integrates with Amazon.
- 54:42So I'm less concerned about Amazon and more concerned about all these kind of secondary vendors that are going to do a poor job and they're just going to create these holes in our homes.
- 54:53Because, I mean, Amazon actually is pretty good at making sure even the media that you play, like the streams and everything, are done through a kind of, it's kind of annoying.
- 55:04But it has to be a, I believe, a TLS based encrypted connection and it has to have the appropriate headers in the communication.
- 55:13So it's hard to, you know, even get media to play in an unsecure way via the Echo devices.
- 55:20Yeah, that's a good point.
- 55:22I definitely think the Internet of Things is, the cheaper the device, the more likely you're going to have trouble with it exposing you to things.
- 55:29As somebody who deals with DDoS the whole time, right?
- 55:32Like, so, so like, I mean, we do thread Intel and, you know, like the, of course, the Mariah botnet that you heard about last year was all on IoT devices and so on.
- 55:41So this is a big concern, you know, instead of being an infected host with, you know, something that the user look at every day, it's now becoming all these unmanaged, relatively powerful devices that spread around like monitoring temperatures, right?
- 55:55Yeah, like, aside from just, you know, the things you talk about, like, as this all progresses with all these different smart sensors, like, either activating or deactivating based on your, like, daily routine, whatever entity is, like, in control of all this, all this information, they can build, like, a really good picture of what your life is like, just by all these small little adjustments you make with your smart appliances and stuff, you know?
- 56:23Like, they can tell when you're home or, like, when you cook and all these things.
- 56:26So it's something to be aware of.
- 56:28Yeah.
- 56:28How many people live in your house based on how many unique voices does it hear, for example?
- 56:32But remember, it's, as they said, I think it was the NSA after the whole Edward Snowden thing.
- 56:38It's just metadata.
- 56:39What are they going to do with it?
- 56:41That's right.
- 56:41It's just metadata.
- 56:41Come on.
- 56:42Come on.
- 56:43No problem.
- 56:44I don't see how that could go.
- 56:45Right.
- 56:45All right.
- 56:47Very cool.
- 56:47Even all that stuff said, it sounds like most of us, maybe all of us, have some kind of Alexa device that's generally on or more or less okay with it, at least in limited parts of our life.
- 56:58Yeah.
- 56:59For me, at least it is.
- 57:00Yeah.
- 57:00I don't have any smart appliances outside of, I've tried them and then I unplug them just to see how they work, but then I don't use them on a daily basis.
- 57:08Yeah.
- 57:08And I've got my Alexas in both the first and second floor here and use them daily.
- 57:12They're really, really nice.
- 57:14All right.
- 57:15Well, I guess we're pretty much out of time, so I'll have to leave it there for the Alexa stuff.
- 57:19But let's go down the two questions.
- 57:22So Dave, we'll go with you first.
- 57:24Favorite editor?
- 57:24I can't make up my mind.
- 57:26I either use Vim or Emacs, depending on the situation.
- 57:29And my hands are in constant pain as a result.
- 57:32Cam?
- 57:34Sublime.
- 57:35It's just so quick and nice.
- 57:37And Eric, have I corrupted you?
- 57:39Yes, you have.
- 57:39So I used to use Vim, but then since I listened to Talk Python too much, and so I now use PyCharm exclusively.
- 57:45I definitely love that.
- 57:46All right.
- 57:48And Eric, keep going with you.
- 57:49How about a notable PyPI package?
- 57:51Yeah.
- 57:51So I like requests.
- 57:52Of course, as half of the people here, I think that it should be in the standard library.
- 57:56And if Ansible counts, then that's definitely what I would like as well.
- 58:01The library slash packages.
- 58:02Yeah, I think it does.
- 58:03That's cool.
- 58:04Ansible.
- 58:04All right, Cam?
- 58:05So aside from Flaskask and Flask Assistant, if anyone's interested in making their own
- 58:10skills or anything, or just not even skills, but just programs to control things within their
- 58:16house, I would check out Home Assistant.
- 58:17It's a really cool project.
- 58:19It's a very cool project.
- 58:19It controls so many devices.
- 58:21It's a really cool on-your-own-network website.
- 58:25And yeah, I had the guys on episode 122 a while back, so definitely cool.
- 58:30Dave?
- 58:31You can't beat requests.
- 58:34I was going to say that.
- 58:35Yeah, awesome.
- 58:35Okay, so I agree.
- 58:37Request is definitely the most popular one on the show and out in the world.
- 58:41Final call to action.
- 58:42People want to get started.
- 58:43They want to get started with Alexa.
- 58:44They want to get started with Flaskask, things like that.
- 58:47What do they do?
- 58:48Just jump in, you guys.
- 58:49Yeah, I think they could just go.
- 58:50There's a bunch of templates, pre-made templates and step-by-step guide.
- 58:54Like I said, Amazon's very involved in reaching out to potential developers.
- 58:57So you could easily get a lot of freebies that way if you publish your skill sets.
- 59:02Go check out some of the tutorials for Flaskask and get started.
- 59:05It's not too hard.
- 59:06There's a bunch of sample projects, each one of them.
- 59:09I did some work in making sure that they're sort of sanity checked with each version.
- 59:14So they should actually work.
- 59:16And they'll show you how to use things like Flask Blueprints with Flaskask.
- 59:20They basically recreate some of the traditional Alexa skill kit demo applications as well.
- 59:26Well, it sounds really fun.
- 59:27And I'm definitely looking forward to building something that I can talk to Alexa about.
- 59:31I'm just not sure what yet.
- 59:32Thanks for being on the show, everyone.
- 59:34Awesome.
- 59:34Thank you.
- 59:35Thank you.
- 59:35Yeah, thank you.
- 59:36Yep.
- 59:36Bye.
- 59:37This has been another episode of Talk Python To Me.
- 59:40Today's guests were Eric Cho, Dave Botella, and Cam Sweeney.
- 59:44And this episode has been brought to you by Datadog and us at Talk Python Training.
- 59:49Datadog gives you visibility into the whole system running your code.
- 59:53Visit talkpython.fm/datadog and see what you've been missing.
- 59:58Don't even throw in a free t-shirt for doing the tutorial.
- 1:00:01Are you or a colleague trying to learn Python?
- 1:00:03Have you tried books and videos that just left you bored by covering topics point by point?
- 1:00:07Well, check out my online course, Python Jumpstart, by building 10 apps at talkpython.fm/course
- 1:00:13to experience a more engaging way to learn Python.
- 1:00:16And if you're looking for something a little more advanced, try my Write Pythonic Code course
- 1:00:21at talkpython.fm/pythonic.
- 1:00:23Be sure to subscribe to the show.
- 1:00:26Open your favorite podcatcher and search for Python.
- 1:00:28We should be right at the top.
- 1:00:30You can also find the iTunes feed at /itunes, Google Play feed at /play, and
- 1:00:35direct RSS feed at /rss on talkpython.fm.
- 1:00:39This is your host, Michael Kennedy.
- 1:00:41Thanks so much for listening.
- 1:00:42I really appreciate it.
- 1:00:43Now get out there and write some Python code.
- 1:00:45I'll see you next time.
- 1:01:05Thank you.