Using Python and XMPP to build a decentralized social network J er - - PowerPoint PPT Presentation

using python and xmpp to build a decentralized social
SMART_READER_LITE
LIVE PREVIEW

Using Python and XMPP to build a decentralized social network J er - - PowerPoint PPT Presentation

Using Python and XMPP to build a decentralized social network J er ome Poisson (Goffi) FOSDEM Saturday 30th January 2016 Some words about the project a lot of features other interfaces about the technologies global architecture


slide-1
SLIDE 1

Using Python and XMPP to build a decentralized social network

J´ erˆ

  • me Poisson (Goffi)

FOSDEM

Saturday 30th January 2016

slide-2
SLIDE 2

Some words about the project a lot of features

  • ther interfaces

about the technologies global architecture Python ! about the choice of Python some advantages Twisted Urwid Pyjamas A New Hope Things we have learned Salut ` a Vous

slide-3
SLIDE 3

Some words about the project

Libervia/Salut ` a Toi is a Multipurpose, multi frontend communication tool

slide-4
SLIDE 4

Some words about the project

◮ project started in 2008/2009 ◮ Social Contract

http://salut-a-toi.org/social_contract.html

◮ non profit association

slide-5
SLIDE 5

Outline

Some words about the project a lot of features

  • ther interfaces

about the technologies global architecture Python ! about the choice of Python some advantages Twisted Urwid Pyjamas A New Hope Things we have learned Salut ` a Vous

slide-6
SLIDE 6

Some words about the project

◮ instant messaging (of course) ◮ end 2 end encryption ◮ P2P file sharing ◮ blog engine (decentralized !) ◮ lot of experimentations

slide-7
SLIDE 7
slide-8
SLIDE 8

Outline

Some words about the project a lot of features

  • ther interfaces

about the technologies global architecture Python ! about the choice of Python some advantages Twisted Urwid Pyjamas A New Hope Things we have learned Salut ` a Vous

slide-9
SLIDE 9
slide-10
SLIDE 10
  • ther interfaces

◮ don’t reinvent the wheel ◮ we use standards (XMPP) ◮ factorization

slide-11
SLIDE 11

Outline

Some words about the project a lot of features

  • ther interfaces

about the technologies global architecture Python ! about the choice of Python some advantages Twisted Urwid Pyjamas A New Hope Things we have learned Salut ` a Vous

slide-12
SLIDE 12
slide-13
SLIDE 13

Python !

we use Python everywhere we can

◮ Twisted (backend, web frontend) ◮ curses Urwid (console frontend) ◮ Pyjamas (web frontend) ◮ WxWidgets Kivy to be done ◮ Jinja (web frontend)

. . . and sometime we don’t

◮ Qt/C++ (Desktop frontend)

slide-14
SLIDE 14

Outline

Some words about the project a lot of features

  • ther interfaces

about the technologies global architecture Python ! about the choice of Python some advantages Twisted Urwid Pyjamas A New Hope Things we have learned Salut ` a Vous

slide-15
SLIDE 15

about the choice of Python

◮ speed (execution)

slide-16
SLIDE 16

about the choice of Python

◮ speed (execution)

◮ pypy ◮ cython ◮ C/C++ inclusion

slide-17
SLIDE 17

about the choice of Python

◮ speed (execution)

◮ pypy ◮ cython ◮ C/C++ inclusion

◮ speed (development) ◮ popular (libraries) ◮ popular (similar projects) ◮ popular (tools)

slide-18
SLIDE 18

tools

◮ Mercurial ◮ BuildBot ◮ D-Feet

slide-19
SLIDE 19

Outline

Some words about the project a lot of features

  • ther interfaces

about the technologies global architecture Python ! about the choice of Python some advantages Twisted Urwid Pyjamas A New Hope Things we have learned Salut ` a Vous

slide-20
SLIDE 20

some advantages

◮ debugging (pudb & ipdb) ◮ stability (Python & Twisted) ◮ workaround/monkey patching ◮ standard library (re, argparse, dom, urlparse/urllib) ◮ Python is fun !

slide-21
SLIDE 21

Twisted

◮ asynchronous ◮ huge framework ◮ well thought abstractions ◮ test driven development

slide-22
SLIDE 22

Twisted

◮ Deferred

def fosdemTalkCb ( s e l f , r e s u l t ) : p r i n t u”OK! {}” . format ( r e s u l t ) def fosdemTalkEb ( s e l f , f a i l u r e ) : p r i n t u” D i s a s t e r ! {}” . format ( f a i l u r e ) d = getFosdemTalkOpinion () d . addCallbacks ( s e l f . fosdemTalkCb , fosdemTalkEb )

◮ inline callbacks

@defer . i n l i n e C a l l b a c k s def fosdemTalkPoll ( s e l f ) : try :

  • p i n i o n = y i e l d

getFosdemTalkOpinion () except BadTalkException as f a i l u r e : p r i n t u” D i s a s t e r ! {}” . format ( f a i l u r e ) e l s e : p r i n t u”OK! {}” . format ( o p i n i o n )

slide-23
SLIDE 23

Urwid

◮ D-Bus integration ◮ good widgets set ◮ customization ◮ lot of nice stuff (resizing, keys, etc) ◮ it just works !

slide-24
SLIDE 24
slide-25
SLIDE 25

Pyjamas

◮ Python −

→ JavaScript transpiler

◮ very active at the time ◮ a GWT port ◮ handle browsers incompatibilities ◮ main advantages for us :

◮ factorization ◮ no context switch

slide-26
SLIDE 26

Pyjamas

  • but. . .

◮ it’s nearly Python, but it’s not Python ◮ heavy and ugly pages (code) ◮ difficult to debug ◮ no luck to move to Python 3 ◮ project hijacked ◮ and now dead

slide-27
SLIDE 27

Outline

Some words about the project a lot of features

  • ther interfaces

about the technologies global architecture Python ! about the choice of Python some advantages Twisted Urwid Pyjamas A New Hope Things we have learned Salut ` a Vous

slide-28
SLIDE 28

A New Hope

Brython

slide-29
SLIDE 29

A New Hope

Brython

◮ not a compiler, an interpreter ◮ Python 3 ◮ Python test suite ◮ active ◮ debugger ◮ stay close to HTML

slide-30
SLIDE 30

Things we have learned

◮ stay focused ◮ new technologies can wait ◮ look for the community ◮ and the stability

slide-31
SLIDE 31

Outline

Some words about the project a lot of features

  • ther interfaces

about the technologies global architecture Python ! about the choice of Python some advantages Twisted Urwid Pyjamas A New Hope Things we have learned Salut ` a Vous

slide-32
SLIDE 32

Thanks for your attention

◮ http://salut-a-toi.org (official website) ◮ https://www.libervia.org (d´

emo)

◮ goffi@goffi.org (courriel) ◮ goffi@jabber.fr (jid)

  • r meet me in Prague !