👋 Hey all, the time has come… Like finally! I know it has been a long time. The project has been paused for about 2 years. We’ll talk about the reasons of this endless pause in another blog post.
Today, we’ll focus on the new release of Leon and understand what’s new, where the project is leading to and the thinking process behind some decisions.
The focus of this release is quite obvious. 2 years pause on a project requires a deep work on:
- Rethinking about the project vision.
- Redefining who would be interested in the project.
- Analyzing technical debt and taking action.
At least that’s how I put it together.
It’s important to mention that the work here was not only technical. I needed to refocus on the WHY of Leon.
- Why did I build Leon at the first place?
- What problems is it solving?
- Is it still valuable today?
Let’s focus on the technical part as the other part will be covered in another blog post.
That is what happens when you don’t update your project dependencies for about 2 years… Let images speak for themselves.
I believe you got a rough idea of what needed to be done. Clearly I updated all dependencies that Leon relies on. Of course I could make use of tools such as Dependabot but I preferred to update everything manually. It allowed me to have a better control of what I was doing and see if each dependency still has its seat in the project. Most of all, and this is only my own opinion, I prefer to keep dependency updates as a one-shot task instead of having noises in pull requests.
I read the changelog of each dependency to understand what has changed, has been improved and check if there was any breaking change.
You can find a list of all the updates here.
It was working pretty well after the update, but GUI clients like GitKraken was not working properly anymore due to their recent changes (it was working well before). So I decided to drop Husky or any Git hook trigger script because I don’t want this be a bottleneck for contributors. So I keep it simple without commit restriction.
I believe that the CONTRIBUTING.md file is enough to understand how to commit to the project. However, it’s quite important to respect the commit convention as it eases the changelog generation for each new release.
But here is the thing, I want to continue to use the
module-alias npm package as I find it brings better readability of the imports. I found that it requires to build a custom module loader to resolve it. I concluded that it was too much steps to achieve for a small output, then I chose to postpone the Babel dropping task. If you are interested into that specific case, there is an ongoing GitHub issue.
I might come back to this task once the ecosystem will be more ready.
Thanks to the last changes, apparently Leon might work on at least Raspberry 3B+ as per this comment. A deeper look will be provided on this side.
Feel free to contribute.
Leon uses Snowboy for its hotword detection. Unfortunately the project has been discontinued and is suffering from the lack of maintainability.
Indeed, Snowboy uses node-pre-gyp which helps to publish and install Node.js C++ addons from binaries. So when a new Node.js version is shipped,
node-pre-gyp must update its listing of the supported targets by specifying the:
Usually it is done through this file.
Please keep in mind that is a temporary solution as this part of Leon should be improved in the future. If you have any suggestion for a hotword detection alternative or wish to build one, don’t hesitate to shoot me an email at email@example.com.
I found some alternatives such as Porcupine from Picovoice that works pretty well. But at the moment I’m writing this, their tooling does not allow to have short hotword like
Leon. Which is in fact a best practice, but it means we’d need to comply such limitations.
The points above were the main ones to focus on for this release. But there are actually more things coming with it!
I’m happy to say that Leon’s web app is now powered by Vite. The web app will get major changes in the future, so a review was necessary before to kick off the work.
The web app was using some Node.js features and Browserify. This is an unnecessary layer in our case. I wanted every feature be natively supported by the browsers as upcoming clients will also be natively supported by their respected platform.
Now that we are on an explicit browser compatible codebase, this is where Vite enters the game. In sum: better DX and performance.
Learn about the benefits here.
Until a while I was always using CircleCI for my projects as I think it is doing a great job for CI and CD.
However, since GitHub has launched GitHub Actions I liked the idea of having the codebase close to the CI, so we don’t need to get out of the GitHub ecosystem.
Sometimes on CircleCI, Leon was having troubles since the Node.js 14+ upgrade from the Leon’s CI Docker image. The same Docker image was finishing all the jobs perfectly on different machines but not on CircleCI ones. It was timing out or finishing with an error for the end-to-end modules tests. The error was related to the Node.js child process that did not work. So my bet is it was sometimes running out of memory.
Since I migrated to GitHub Actions, none of these happened. As Leon was using the Docker type on CircleCI, it looks like there is bit more hardware power on GitHub Actions. I did not try with the raw CircleCI Linux types as I wanted to use the Leon’s Docker image dedicated for its CI.
Today Leon’s CI is composed of 3 GitHub Actions workflows:
- build: to ensure Leon can be built successfully.
- lint: to ensure the source code is written as per the standards of the project.
- tests: to ensure the quality of the features.
If you are interested in migrating from CircleCI to GitHub Actions, GitHub has put together an article that is pretty straightforward.
Leon needs an HTTP server to allow clients to grab some metadata such as the version, language, etc. and for more in the future… This is also where the WebSocket handshake happens to establish a bi-directional connection with clients.
Most of the time we hear about Express.js because it is a well established web framework in the Node.js ecosystem, since the early days. But Fastify also joined the OpenJS Foundation which means it is also serious.
I agree with most of what is explained in this article.
Thanks to the great job from Théo, the migration is shipped with this new release.
You can try Leon with a single-click thanks to Gitpod.
It will automatically setup an environment with all the requirements and run an instance for you. It allows potential contributors to get started pretty fast and add value to the project.
You can try it here.
Again, kudos to Théo for suggesting and making this happens 👏
To ensure that the minimum Node.js and npm versions are respected, the following has been added to the
Since the previous release, NLP.js pushed a lot of work and has released a major version, moving from a monolithic library to multiple independent packages. So I spent some time to make Leon’s NLP compatible to the latest changes.
These changes mostly include the NER and NLU of Leon and still makes use of neural network.
Please feel free to take a look at the roadmap to have a full understanding of what has been done for this release.
This release includes a few if it’s nearly none breaking changes:
- Have I Been Pwned module: it now requires a key to be able to request their API.
- IBM Watson: IBM will shutdown their legacy API (end of life on 26 May 2021). Leon complies to the last changes of the IBM Watson Node.js SDK. If you are using Watson TTS or Watson STT, you can make the changes as specified in the docs.
- Amazon Polly: Amazon did a complete modular rewrite of their Node.js SDK. Leon complies to these changes. If you are using Amazon Polly, make sure to pull the last configuration file structure for Amazon Polly.
In the long term, an important guideline needs to be followed so Leon can shine better:
- Then we hope we can grow the community bigger thanks to what Leon will be able to do.
- Scale Leon with new useful modules.
- The idea is to get closer and closer to closed source assistants thanks to the growing community and better foundations. But by ALWAYS keeping the core open and a flexibility that challenges our imagination.
In a shorter term, here is what we can expect to see:
- A blog post explaining my Coming Back on the project, the WHY and things I mentioned earlier. It’s important for me to share you my thoughts and this journey.
- A full rebranding with a new visual identity of the project that reflects more the values and vision of Leon.
- The CLI so it improves the onboarding experience by removing the hassle of the requirements, centralizing commands and more… Kudos to Arthur and Théo who are working on it! 👏
- Take a look at the roadmap to see more.