OLD | NEW |
1 .. _cds2014_python: | 1 .. _cds2014_python: |
2 | 2 |
3 ######################################## | 3 ######################################## |
4 What a Difference Python Makes - Codelab | 4 What a Difference Python Makes - Codelab |
5 ######################################## | 5 ######################################## |
6 | 6 |
7 Introduction | 7 Introduction |
8 ------------ | 8 ------------ |
9 | 9 |
10 .. include:: python_summary.inc | 10 .. include:: python_summary.inc |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 a popup blocker the first time. Click on the URL to accept the popup. | 66 a popup blocker the first time. Click on the URL to accept the popup. |
67 It also clobbers /tmp/differ for good measure. | 67 It also clobbers /tmp/differ for good measure. |
68 | 68 |
69 As you can see, this isn't quite what we're going for. | 69 As you can see, this isn't quite what we're going for. |
70 | 70 |
71 You'll want to modify diff.py, using the editor you selected earlier. | 71 You'll want to modify diff.py, using the editor you selected earlier. |
72 You'll probably want to consult the |difflib| documentation. | 72 You'll probably want to consult the |difflib| documentation. |
73 I would suggest you check out the HtmlDiff class and make use of | 73 I would suggest you check out the HtmlDiff class and make use of |
74 the make_file member function. Note our goal is to create a | 74 the make_file member function. Note our goal is to create a |
75 full HTML diff, so the make_table function is insufficient. | 75 full HTML diff, so the make_table function is insufficient. |
76 I would also suggest the splitlines | 76 The splitlines function may also come in handy. |
77 function may come in handy. | |
78 | 77 |
79 You can test diff.py manually as you would in a normal UNIX environment. | 78 You can test diff.py manually as you would in a normal UNIX environment. |
80 It can be run like this:: | 79 It can be run like this:: |
81 | 80 |
82 ./diff.py before.txt after.txt out.html | 81 ./diff.py before.txt after.txt out.html |
83 | 82 |
84 Once everything is working diff.html will contain an html diff. | 83 Once everything is working, diff.html will contain an html diff. |
85 After the initial `make` you can hit "Run" to test your changes. | 84 After the initial `make` you can hit "Run" to test your changes. |
86 | 85 |
87 Now get to it, and good luck! | 86 Now get to it, and good luck! |
88 | 87 |
89 | 88 |
90 What you've learned | 89 What you've learned |
91 ------------------- | 90 ------------------- |
92 | 91 |
93 While the details of building and packaging Python have been | 92 While the details of building and packaging Python have been |
94 insulated from you for the purpose of this exercise, the key take-home lesson | 93 insulated from you for the purpose of this exercise, the key take-home lesson |
95 is how easy it is to leverage Python using PNaCl. | 94 is how easy it is to leverage Python using PNaCl. |
96 As you've likely experienced, the initial start time is non-trivial. | 95 As you've likely experienced, the initial start time is non-trivial. |
97 We're working on improving this, both by improving PNaCl, | 96 We're working on improving this, both by improving PNaCl, |
98 and our Python port. | 97 and our Python port. |
99 | 98 |
100 The same approach to deploying Python apps can be used for the other | 99 The same approach to deploying Python apps can be used for the other |
101 interpreted languages that have been ported to PNaCl. | 100 interpreted languages that have been ported to PNaCl. |
102 | 101 |
103 Check out the range of interpreters, libraries, and tools | 102 Check out the range of interpreters, libraries, and tools |
104 `already ported to PNaCl and ready to be integrated with your Web App | 103 `already ported to PNaCl and ready to be integrated with your Web App |
105 <https://code.google.com/p/naclports/wiki/PortList>`_. | 104 <https://code.google.com/p/naclports/wiki/PortList>`_. |
106 | 105 |
107 While our in-browser environment is rapidly evolving | 106 While our in-browser environment is rapidly evolving |
108 to become a complete development solution, | 107 to become a complete development solution, |
109 for the broadest range of development options, check out the | 108 for the broadest range of development options, check out the |
110 `NaCl SDK | 109 `NaCl SDK |
111 <https://developer.chrome.com/native-client/sdk/download>`_. | 110 <https://developer.chrome.com/native-client/sdk/download>`_. |
112 | 111 |
113 For questions, concerns, and help contact us at | 112 For questions, concerns, or help contact us at |
114 `native-client-discuss@googlegroups.com | 113 `native-client-discuss@googlegroups.com |
115 <https://groups.google.com/forum/#!forum/native-client-discuss>`_. | 114 <https://groups.google.com/forum/#!forum/native-client-discuss>`_. |
116 | 115 |
117 Bring your interpreted app to PNaCl today! | 116 Bring your interpreted app to PNaCl today! |
118 | 117 |
119 .. include:: ../nacldev/cleanup_web.inc | 118 .. include:: ../nacldev/cleanup_web.inc |
OLD | NEW |