Entities, connectors, removing memory leaks and more in v0.16

Jacob Tomlinson
opsdroid
Published in
4 min readSep 29, 2019

We are excited to announce this release that we have added two new core maintainers. They have been making consistently high quality contributions over a long period of time so please welcome Cadair and SolarDrew who are joining myself and FabioRosado in running and guiding the project.

We’ve had a great summer of contributions so let’s dive into the highlights of the v0.16 release.

Consolidated entity access

Until now if you want to access an entity that has been discovered by a parser you need to access it at the parser specific attribute on the entity. For example if you are using the “parse” parser and you has an entity called “name” you could access it like message.parse_result['name'] . If you wanted to access the same entity but are using the regex parser you could access it at message.regex.group('name') .

From now on you can access this entity at message.entities['name']['value'] . You can also access the confidence from the parser that the value is correct at message.entities['name']['confidence'] . The original methods still exist, but hopefully this will make things more consistent as you explore other parsers.

More connectors

In this release we have seen the Gitter and Cisco Webex Teams (formerly Cisco Spark) connectors moved into the core which adds better support and stability. There have also been multiple bug fixes to the Matrix connector and rich layout support in that Slack connector.

Example of using Slack blocks to show rich output

Removing Memory leaks

For a while now we’ve been struggling with a memory leak in the Slack connector. There are a few different Python modules for Slack which support asyncio, but they all seem to have various flaws and little support. In the past we have even attempted to pick up maintenance for the library of our choice with little to no response. This all came to a head this year when we discovered a memory leak in aioslacker which was the library we were using at the time. Without writing our own Slack module (which we sadly don’t have the resources to do) we were stick in a tricky position. As a work around we provided guidance on automatically restarting opsdroid and setting process memory limits, but this was a nasty hack at best.

You can imagine our relief when the official Slack library released 2.0 which added asyncio support. As of this release we have switched to using the official library which will provide us with a more robust Slack connector and better support from the team at Slack. We sincerely apologise to all our users who were affected by this problem and the amount of time it took to get on top of it.

Other mentions

A lot of work from many amazing contributors has gone into this release. We’ve added private git repo support for modules, config validation, futureproofing changes to the CLI options and improvements to the events system. We’ve also started running Black over our codebase and dropped support for Python 3.5 in line with NEP29. Check out the full release notes for more information.

Full Release Notes

Enhancements

Add event entities (#955)
Add gitter connector (#957)
Add explicit config options (#963)
Add filters to logging (#966)
Add Slack rich layouts support (#968)
Specify SSH key for private git repo (#981)
Add validation YAML config files (#1003)
Adding cisco spark connector in opsdroid (#1041)
Events IIa — Core additions (#1069)
Refactor CLI commands (#1075)
Parse message if instance of events.Message (#1080)

Bug fixes

Reduce matrix the sync timeout to one minute (#969)
Replace Asyncio_redis with aioredis (#973)
Update pyyaml envvar/include code to work with latest version (#985)
Fixing rasanlu parser does not manage the new returned response after training request (#988)
Fix slack reactions (#990)
Telegram Connector: Fix update interval code #996 (#997)
Telegram: handle emoji only message — prevent infinite loop (#1011)
whitelisted_users field optional (#1058)
Make load and start_connectors async (#1072)
Make start_databases and train_parsers async (#1079)
Replace third party slack library with official one (#1081)

Documentation/code quality

Update loader.py with google style Docstrings (#948)
Add opsdroid version to log messages (#949)
Add Black (#958)
Add FUNDING.yaml with open collective (#959)
Remove Python 3.5 support (#960)
Update linting (#962)
Downgrade rtd to py36 (#965)
Updating readme with docker swarm/compose example (#977)
Make all tests offline #593 (#1009)
Add flake8 to the precommit hooks (#1073)
Add section about black to contributing (#1049)
Remove unused Attributes from Mongodb docstrings (#1028)
Fix linting issues for pydocstyle update (#1027)

--

--