Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: SD70
Views: 95
1
\documentclass{beamer}
2
\usepackage{graphicx}
3
\usepackage{url}
4
5
\mode<presentation> {
6
\usetheme{Madrid}
7
}
8
9
\usepackage{graphicx}
10
\usepackage{booktabs}
11
12
\title[SageMathCloud]{How to Contribute to SageMathCloud}
13
\author{William Stein}
14
\institute[UW]
15
{
16
University of Washington \\
17
\medskip
18
SageMath, Inc.
19
}
20
\date{\today}
21
22
\begin{document}
23
24
\begin{frame}
25
\titlepage
26
\end{frame}
27
28
\begin{frame}
29
\frametitle{Screencast of this talk}
30
\vfill
31
\Large
32
\begin{center}
33
\url{https://youtu.be/GOuy07Kift4}
34
\end{center}
35
\vfill
36
\end{frame}
37
38
\begin{frame}[fragile]
39
\frametitle{Goal of talk}
40
41
{\bf Goal: } Explain how to work on SageMathCloud.
42
\vfill
43
44
{\bf Motivation: } I do around 95\% of SMC development:
45
\begin{verbatim}
46
> git log |grep Author |wc -l
47
9763
48
> git log |grep "Author: William Stein" |wc -l
49
9340
50
> git ls-files -z | stack overflow ...
51
278358 William Stein
52
5582 Harald Schilly
53
2622 Nicholas Ruhland
54
1117 William Jon Nich
55
909 Jon Nich ...
56
\end{verbatim}
57
58
\vfill
59
{\bf This must stop!!!}
60
61
62
\end{frame}
63
64
\begin{frame}
65
\frametitle{What is SMC?}
66
67
\begin{itemize}
68
\item
69
{\bf Launch:} I launched SMC in April 2013.
70
\item
71
{\bf Size:} SMC runs on dozens of VM's on Google compute engine. 250K projects made. Over 30K monthly active users. Over 850 simultaneous users.
72
\item
73
{\bf Features:} realtime collaboration, LaTeX editing, Sage worksheets, R, Jupyter notebooks, color terminals, write Fortran/C/C++/Java/Haskell/etc. programs, todo lists, course management, chatrooms.
74
\item
75
{\bf Devel:} SMC can also now be run in a new single-user developer-friendly mode.
76
\end{itemize}
77
78
\end{frame}
79
80
\begin{frame}
81
\frametitle{The Stack}
82
83
\begin{itemize}
84
\item {\bf Node.js:} javascript on server side; amazing ecosystem
85
\item {\bf CoffeeScript:} Javascript preparser -- no braces and semicolons
86
\item {\bf Engine.io/Primus:} websockets + fallback
87
\item {\bf React.js:} sane declarative user interfaces
88
\item {\bf RethinkDB:} scalable, replicated database that pushes changes (=nosql db + message queue)
89
\item {\bf SageMath:} mathematics
90
\item {\bf Jupyter Notebook:} interactive coding
91
\item {\bf webpack:} bundles all assets of webpage
92
\item {\bf LaTeX:} math typesetting: backend in Linux and mathjax on frontend
93
\end{itemize}
94
\end{frame}
95
96
\begin{frame}
97
\frametitle{Contributing to SMC}
98
99
\begin{itemize}
100
\item {\bf Use Github:} \url{https://github.com/sagemathinc/smc}
101
102
\item {\bf SMC dev:} (1) in an SMC project, (2) on Linux/OS X
103
104
\item {\bf License:} GPLv3+ compatible.
105
\end{itemize}
106
107
\end{frame}
108
109
\begin{frame}
110
\frametitle{Tutorial -- part 1: setup SMC dev environment (15 min)}
111
112
\begin{enumerate}
113
\item (2 min) In SMC, open or create a SMC project. On a laptop, install Node.js V5 and RethinkDB, and make sure python=python2.7.
114
115
\item (3 min) Open a terminal and clone the repo:
116
117
{\tt git clone https://github.com/sagemathinc/smc}
118
119
\item (1 min) Right now you must checkout the smc-in-smc branch (this will change): {\tt cd smc/; git checkout smc-in-smc}
120
121
\item (8 min) Build/install everything (uses nearly 1GB disk):
122
123
{\tt cd src; . smc-env; npm run make}
124
125
\item (1 min) Start everything (needs more than 1GB RAM to work smoothly):
126
127
{\tt cd dev/project; ./tmux-start-all}
128
129
This uses tmux, but you can instead directly start the three scripts in that directory.
130
131
\end{enumerate}
132
\end{frame}
133
134
\begin{frame}[fragile]
135
\frametitle{BUGS!!!!!!!}
136
There are several devel bugs right now. I will fix these this week.
137
\begin{itemize}
138
139
\item The first time after everything starts up, you will have to stop it all and start it again. (hub websocket server may not properly initialize the first time, when the database takes a long time to get configured.)
140
141
\item On a laptop, you must do
142
\verb+pip install ~/smc/src/smc_pyutil/+ to install various scripts systemwide.
143
144
\item In an SMC project, {\em anybody} with a project on the same host could connect to and modify your RethinkDB instance! However, they can't login to your server.
145
146
\item To test modifications to the sage server, you have to install {\tt smc\_sagews} into the project via {\tt pip install --user /path/to/smc/src/smc\_sagews/}
147
148
\item Proxy server {\bf not implemented}: IPython, Latex, project in project in project
149
150
\end{itemize}
151
152
\end{frame}
153
154
\begin{frame}
155
\frametitle{Tutorial -- part 2: exercises}
156
157
\begin{enumerate}
158
159
\item {\bf Change frontend UI:} Help page: change "Support" $\longrightarrow$ "Mom's favorites".
160
161
\item {\bf Change backend hub:} When creating account, change user's name to Super Mom.
162
163
\item {\bf Change local hub:} When opening a file, put 'HI MOM!' at the top.
164
165
\item {\bf Change console server:} Write 'HI MOM!' to terminal stream whenever opened.
166
167
\item {\bf Change Sage server:} Define extra variable in Sage worksheets called MOM.
168
169
\end{enumerate}
170
171
\end{frame}
172
173
\begin{frame}
174
\frametitle{Change frontend UI}
175
{\bf Exercise:} Help page -- change "Support" $\longrightarrow$ "Mom's favorites".
176
\vfill
177
178
\begin{enumerate}
179
\item Open {\tt smc/src/smc-webapp/r\_help.cjsx}
180
\item Change "Support" to "Random links"
181
\item When you save, webpack will update
182
\item Refresh help page and see change (react hot loader not yet implemented in SMC)
183
\end{enumerate}
184
185
\vfill
186
187
Someday:
188
\url{http://gaearon.github.io/react-hot-loader/}
189
190
\end{frame}
191
192
\begin{frame}
193
\frametitle{Change backend hub}
194
{\bf Exercise:} When creating account, change user's name to Super Mom.
195
196
\begin{enumerate}
197
\item Open {\tt smc/src/smc-hub/hub.coffee}
198
\item Note that it is way too big and needs to be refactored...
199
\item Find the function {\tt create\_account}
200
\item Add this code: {\tt mesg.first\_name = "Super"; mesg.last\_name = "Mom"}
201
\item Stop the hub and start it again: (1) use tmux to get to the hub log, hit control+c to stop it. (2) start it again in a separate terminal session, make new account, verify result.
202
203
\end{enumerate}
204
205
206
\end{frame}
207
208
\begin{frame}
209
\frametitle{Change local hub}
210
{\bf Exercise:} When opening a file, put 'HI MOM!' at the top.
211
212
\begin{enumerate}
213
\item Open {\tt smc/src/smc-project/local\_hub.coffee}
214
\item Look for lines involving {\tt fs.readFile}, and find {\tt @init(doc:data.toString()...}
215
\item Change it to {\tt @init(doc:'Hi Mom!' + data.toString()...}
216
\item Create a project and open it (NOTE: will get an error on first directory load!!)
217
\item Open a file
218
\end{enumerate}
219
220
221
\end{frame}
222
223
\begin{frame}
224
\frametitle{Change console server}
225
{\bf Exercise:} Write 'HI MOM!' to terminal stream whenever opened.
226
227
\begin{enumerate}
228
\item Open {\tt smc/src/smc-project/console\_server\_child.coffee}
229
\item Put this line at the bottom: {\tt socket.write("HI MOM!")}
230
\item Open a terminal (restart project if you had already opened a terminal!). Maybe hit return a few times. See "HI MOM!".
231
\end{enumerate}
232
233
234
\end{frame}
235
236
\begin{frame}
237
\frametitle{Change Sage server}
238
{\bf Exercise:} Define extra variable in Sage worksheets called MOM.
239
\begin{enumerate}
240
\item Open {\tt smc/src/smc\_sagews/smc\_sagews/sage\_server.py}
241
\item Search in the file for {\tt \_\_SAGEWS\_\_}
242
\item Add this line after it: {\tt namespace['MOM'] = "hi there!"}
243
\item (TEMPORARY-BUG) Install sage\_server code {\em into a nested project}: {\tt pip install --user /projects/[your project id]/smc/src/smc\_sagews/}
244
\item Open a Sage worksheet in your nexted project and type MOM (shift+enter) and see if it worked. (If it didn't, restart your sage server.)
245
\end{enumerate}
246
247
248
\end{frame}
249
250
251
252
253
\end{document}
254