the Python-only web framework Iwan Vosloo EuroPython 2015 About - - PowerPoint PPT Presentation

the python only web framework
SMART_READER_LITE
LIVE PREVIEW

the Python-only web framework Iwan Vosloo EuroPython 2015 About - - PowerPoint PPT Presentation

the Python-only web framework Iwan Vosloo EuroPython 2015 About 10 z o 80 p 26 600 loc e (40% tests) 15 Python Financial industry / in-house development EuroPython 2015 the Python-only web framework Background What it is


slide-1
SLIDE 1

EuroPython 2015

the Python-only web framework

Iwan Vosloo

slide-2
SLIDE 2

EuroPython 2015

15 Python Financial industry / in-house development 10

About

z

  • p

e 80

26 600 loc (40% tests)

slide-3
SLIDE 3

EuroPython 2015

  • Background
  • What it is
  • How it works
  • Why you should care
  • Strategy
  • Status
  • Questions

the Python-only web framework

slide-4
SLIDE 4

EuroPython 2015

Background

Web frameworks

def func(code code co) code code code code code code

GET /some/url map url to some code

1

HTML Template <html> <body> </body> </html>

2

read from a database

3

merge data with template

4

respond final HTML

slide-5
SLIDE 5

EuroPython 2015

Background

Web frameworks

def func (code code co)

re-use templates css frameworks js libraries

slide-6
SLIDE 6

EuroPython 2015

Background

Technology focus

HTTP (routing) HTML (template language) Javascript (js libraries) CSS (other frontend libraries)

slide-7
SLIDE 7

EuroPython 2015

What it is

Goal focus

HTTP (routing) HTML (template language) Javascript (js libraries) CSS (other frontend libraries) Save Name: Email: Add Address

Address Book

John: john@example.org View: / View: /add Button

how

slide-8
SLIDE 8

EuroPython 2015 Widget

What it is

Pages are widgets

Save Name: Email: Widget Widget

slide-9
SLIDE 9

EuroPython 2015

What it is

Composing widgets

panel1 = Div(view) panel1.add_child( P(view, text='a paragraph with text') )

Div

a paragraph with text

P

slide-10
SLIDE 10

EuroPython 2015

What it is

Widgets are not HTML

slide-11
SLIDE 11

EuroPython 2015

What it is

Widgets are not HTML

sliding_panel = SlidingPanel(view) panel1 = sliding_panel.add_panel(Div(view)) panel1.add_child(P(view, text='a paragraph with text')) panel2 = sliding_panel.add_panel(Div(view)) panel2.add_child(P(view, text='a different paragraph'))

slide-12
SLIDE 12

EuroPython 2015

What it is

Widgets are not HTML

slide-13
SLIDE 13

EuroPython 2015

How it works

Behind the SlidingPanel

GET /some/url?index=2 HTML (showing second panel) JS

slide-14
SLIDE 14

EuroPython 2015

How it works

Behind the SlidingPanel

HTTP (routing) HTML (template language) Javascript (js libraries) CSS (other frontend libraries)

Server-side logic Extra URLs & Query string arguments

SlidingPanel

how

slide-15
SLIDE 15

EuroPython 2015

How it works

Widget lifetime

Add Address

Address Book

John: john@example.org

AddressBookPanel

slide-16
SLIDE 16

EuroPython 2015

How it works

Widget lifetime

class AddressBookPanel(Div): def __init__(self, view): super(AddressBookPanel, self).__init__(view) self.add_child(H(view, 1, text='Address Book')) for address in Session.query(Address).all(): self.add_child(AddressBox(view, address))

slide-17
SLIDE 17

EuroPython 2015

How it works

Defining a UserInterface

Save Name: Email: Add Address

Address Book

John: john@example.org View: / View: /add

slide-18
SLIDE 18

EuroPython 2015

How it works

Defining a UserInterface

class AddressBookUI(UserInterface): def assemble(self): addresses = self.define_view('/', title='Addresses') addresses.set_page(HomePage.factory()) add = self.define_view('/add', title='Add an address') add.set_page(AddPage.factory()) self.define_transition(Address.events.save, add, addresses)

slide-19
SLIDE 19

EuroPython 2015

Why you should care

slide-20
SLIDE 20

EuroPython 2015

Why you should care

Knowledge & focus

Widget TextInput ValidationConstraint Event Action Field Layout Button

forget technological details

CheckboxInput Menu TabbedPanel

slide-21
SLIDE 21

EuroPython 2015

Why you should care

Re-use

Widget TextInput ValidationConstraint Event Action Field Layout Button i18n access control accessability graceful degradation

forget technological details

Menu double submit concurrency security issues quirks

slide-22
SLIDE 22

EuroPython 2015

Why you should care

Complicated requirements

slide-23
SLIDE 23

EuroPython 2015

Strategy

“No-html” frameworks

main stream no-html

slide-24
SLIDE 24

EuroPython 2015

Strategy

Maintain web semantics

  • Tabbed browsing
  • Bookmarks
  • Back button
  • ...
slide-25
SLIDE 25

EuroPython 2015

Strategy

Support web ideals

  • JavaScript optional
  • Device independence
  • Accessibility
  • ...
slide-26
SLIDE 26

EuroPython 2015

Strategy

Web-grown API

JS JS JS

slide-27
SLIDE 27

EuroPython 2015

Strategy

Aim: higher level issues

Save Name: Email: Add Address

Address Book

John: john@example.org

slide-28
SLIDE 28

EuroPython 2015

Strategy

Leverage existing wisdom

slide-29
SLIDE 29

EuroPython 2015

Status

Our journey

idealistic impossible

foundation

risk concrete

more flexibility bells & whistles interest & community

slide-30
SLIDE 30

EuroPython 2015

Dream

You’re invited

  • 1. Look at examples
  • 2. Join mailing list(s)
  • 3. Install
  • 4. Follow tutorial
  • 5. Help

spread the word infra- structure evolve core grow up

slide-31
SLIDE 31

EuroPython 2015

Thanks

On groups.google.com:

  • reahl-announce
  • reahl-discuss

www.reahl.org @reahl

iwan@reahl.org