Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Port the bot to Python 3 #111

Closed
izzy opened this issue Jul 31, 2016 · 9 comments · Fixed by #171
Closed

Port the bot to Python 3 #111

izzy opened this issue Jul 31, 2016 · 9 comments · Fixed by #171

Comments

@izzy
Copy link
Member

izzy commented Jul 31, 2016

There are currently two possibilities of making the bot Python 3 compatible - either port the twisted.words.protocols.irc module in Twisted's library or use another Library like irc3.

My proposal would be to use irc3, even though it would be considerably more changes in our own code. The architecture of the module fits quite nicely in our own plugin-based style of doing things. It would also allow us to close a few tickets because it has support for things like auto-throttling(see #41), reloading(see #9) and is written for Python 3(see #45).

The downside of it would be breaking all compatibility with older versions of the Bytebot and rewriting most of the code to use irc3 and asyncio instead of Twisted's functions for things like scheduling(see the cron functions).

Any comments or ideas on this?

@mape2k
Copy link
Contributor

mape2k commented Jul 31, 2016

Using a well-maintened library like irc3 should be more future-proof.

As most of the plugins are maintained by the bytebot core devs, breaking the compatibility should not be such a drawback.

@jurkov
Copy link
Contributor

jurkov commented Aug 2, 2016

Please consider if a messenger lib like libpurple from pidgin would also an option. With a messenger lib, Bytebot could work across different networks like irc, twitter, telegram maybe also hangouts

@izzy
Copy link
Member Author

izzy commented Aug 6, 2016

@jurkov With libpurple there's a simple problem: Every network uses different kinds of content. This might include message formatting, other content than text, etc. - which might be fine for a simple multi-messenger, but not for a bot. This would make this bot enormously complex, which in turn makes it hard to maintain.

With irc3 this wouldn't be the case and we still would be able to add functionality to the bot by simply adding a pipe(a feature the irc3 lib does provide) and then processing everything else externally.

@izzy izzy added this to the Python3 milestone Oct 12, 2016
@izzy
Copy link
Member Author

izzy commented Oct 12, 2016

I've successfully created a demo bot with irc3. The weather, status and station plugins are already ported and run just fine. You can find the code in refactor-irc3.

The bot can be run by installing the new packages from contrib/requirements.txt and then running irc3 config.ini

I was thinking about removing porting the most used plugins, removing the other plugins, moving the py3 version to master and porting the rest later, leaving one issue open per plugin under the Python3 milestone.

Any comments?

@jurkov
Copy link
Contributor

jurkov commented Oct 20, 2016

Thank you for your work!
I get the following error on windows:

ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)

@jurkov
Copy link
Contributor

jurkov commented Oct 20, 2016

I activated ssl_verify = CERT_NONE and added before line 304 in irc3/base.py

context.check_hostname = False

@mape2k
Copy link
Contributor

mape2k commented Oct 21, 2016

@mkzero: We should port most of the plugins used before pushing it to master - otherwise the porting process will not be visible properly in commits IMHO. But an issue per plugin will better coordinate who is working on the plugin.

We're planning to migrate this in a hackathon, so most of the useful plugins will be ported afterwards.

@izzy
Copy link
Member Author

izzy commented Oct 24, 2016

For the SSL problem: I submitted a new issue to the irc3 repository and it already got fixed, thus will be released with the upcoming version 0.9.6

For those who can't wait to test with SSL enabled, you can upgrade the package to the github master branch of the irc3 project like this:

. env/bin/activate
pip install --upgrade git+https://github.com/gawel/irc3

@mape2k
Copy link
Contributor

mape2k commented Dec 24, 2016

Finished... Hooray ;)
@mkzero: You could now branch old version, merge to master and close depend issues...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants