Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
| Download
Project: SD70
Views: 232\documentclass{beamer}1\usepackage{graphicx}2\usepackage{url}34\mode<presentation> {5\usetheme{Madrid}6}78\usepackage{graphicx}9\usepackage{booktabs}1011\title[SageMathCloud]{How to Contribute to SageMathCloud}12\author{William Stein}13\institute[UW]14{15University of Washington \\16\medskip17SageMath, Inc.18}19\date{\today}2021\begin{document}2223\begin{frame}24\titlepage25\end{frame}2627\begin{frame}28\frametitle{Screencast of this talk}29\vfill30\Large31\begin{center}32\url{https://youtu.be/GOuy07Kift4}33\end{center}34\vfill35\end{frame}3637\begin{frame}[fragile]38\frametitle{Goal of talk}3940{\bf Goal: } Explain how to work on SageMathCloud.41\vfill4243{\bf Motivation: } I do around 95\% of SMC development:44\begin{verbatim}45> git log |grep Author |wc -l46976347> git log |grep "Author: William Stein" |wc -l48934049> git ls-files -z | stack overflow ...50278358 William Stein515582 Harald Schilly522622 Nicholas Ruhland531117 William Jon Nich54909 Jon Nich ...55\end{verbatim}5657\vfill58{\bf This must stop!!!}596061\end{frame}6263\begin{frame}64\frametitle{What is SMC?}6566\begin{itemize}67\item68{\bf Launch:} I launched SMC in April 2013.69\item70{\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.71\item72{\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.73\item74{\bf Devel:} SMC can also now be run in a new single-user developer-friendly mode.75\end{itemize}7677\end{frame}7879\begin{frame}80\frametitle{The Stack}8182\begin{itemize}83\item {\bf Node.js:} javascript on server side; amazing ecosystem84\item {\bf CoffeeScript:} Javascript preparser -- no braces and semicolons85\item {\bf Engine.io/Primus:} websockets + fallback86\item {\bf React.js:} sane declarative user interfaces87\item {\bf RethinkDB:} scalable, replicated database that pushes changes (=nosql db + message queue)88\item {\bf SageMath:} mathematics89\item {\bf Jupyter Notebook:} interactive coding90\item {\bf webpack:} bundles all assets of webpage91\item {\bf LaTeX:} math typesetting: backend in Linux and mathjax on frontend92\end{itemize}93\end{frame}9495\begin{frame}96\frametitle{Contributing to SMC}9798\begin{itemize}99\item {\bf Use Github:} \url{https://github.com/sagemathinc/smc}100101\item {\bf SMC dev:} (1) in an SMC project, (2) on Linux/OS X102103\item {\bf License:} GPLv3+ compatible.104\end{itemize}105106\end{frame}107108\begin{frame}109\frametitle{Tutorial -- part 1: setup SMC dev environment (15 min)}110111\begin{enumerate}112\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.113114\item (3 min) Open a terminal and clone the repo:115116{\tt git clone https://github.com/sagemathinc/smc}117118\item (1 min) Right now you must checkout the smc-in-smc branch (this will change): {\tt cd smc/; git checkout smc-in-smc}119120\item (8 min) Build/install everything (uses nearly 1GB disk):121122{\tt cd src; . smc-env; npm run make}123124\item (1 min) Start everything (needs more than 1GB RAM to work smoothly):125126{\tt cd dev/project; ./tmux-start-all}127128This uses tmux, but you can instead directly start the three scripts in that directory.129130\end{enumerate}131\end{frame}132133\begin{frame}[fragile]134\frametitle{BUGS!!!!!!!}135There are several devel bugs right now. I will fix these this week.136\begin{itemize}137138\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.)139140\item On a laptop, you must do141\verb+pip install ~/smc/src/smc_pyutil/+ to install various scripts systemwide.142143\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.144145\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/}146147\item Proxy server {\bf not implemented}: IPython, Latex, project in project in project148149\end{itemize}150151\end{frame}152153\begin{frame}154\frametitle{Tutorial -- part 2: exercises}155156\begin{enumerate}157158\item {\bf Change frontend UI:} Help page: change "Support" $\longrightarrow$ "Mom's favorites".159160\item {\bf Change backend hub:} When creating account, change user's name to Super Mom.161162\item {\bf Change local hub:} When opening a file, put 'HI MOM!' at the top.163164\item {\bf Change console server:} Write 'HI MOM!' to terminal stream whenever opened.165166\item {\bf Change Sage server:} Define extra variable in Sage worksheets called MOM.167168\end{enumerate}169170\end{frame}171172\begin{frame}173\frametitle{Change frontend UI}174{\bf Exercise:} Help page -- change "Support" $\longrightarrow$ "Mom's favorites".175\vfill176177\begin{enumerate}178\item Open {\tt smc/src/smc-webapp/r\_help.cjsx}179\item Change "Support" to "Random links"180\item When you save, webpack will update181\item Refresh help page and see change (react hot loader not yet implemented in SMC)182\end{enumerate}183184\vfill185186Someday:187\url{http://gaearon.github.io/react-hot-loader/}188189\end{frame}190191\begin{frame}192\frametitle{Change backend hub}193{\bf Exercise:} When creating account, change user's name to Super Mom.194195\begin{enumerate}196\item Open {\tt smc/src/smc-hub/hub.coffee}197\item Note that it is way too big and needs to be refactored...198\item Find the function {\tt create\_account}199\item Add this code: {\tt mesg.first\_name = "Super"; mesg.last\_name = "Mom"}200\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.201202\end{enumerate}203204205\end{frame}206207\begin{frame}208\frametitle{Change local hub}209{\bf Exercise:} When opening a file, put 'HI MOM!' at the top.210211\begin{enumerate}212\item Open {\tt smc/src/smc-project/local\_hub.coffee}213\item Look for lines involving {\tt fs.readFile}, and find {\tt @init(doc:data.toString()...}214\item Change it to {\tt @init(doc:'Hi Mom!' + data.toString()...}215\item Create a project and open it (NOTE: will get an error on first directory load!!)216\item Open a file217\end{enumerate}218219220\end{frame}221222\begin{frame}223\frametitle{Change console server}224{\bf Exercise:} Write 'HI MOM!' to terminal stream whenever opened.225226\begin{enumerate}227\item Open {\tt smc/src/smc-project/console\_server\_child.coffee}228\item Put this line at the bottom: {\tt socket.write("HI MOM!")}229\item Open a terminal (restart project if you had already opened a terminal!). Maybe hit return a few times. See "HI MOM!".230\end{enumerate}231232233\end{frame}234235\begin{frame}236\frametitle{Change Sage server}237{\bf Exercise:} Define extra variable in Sage worksheets called MOM.238\begin{enumerate}239\item Open {\tt smc/src/smc\_sagews/smc\_sagews/sage\_server.py}240\item Search in the file for {\tt \_\_SAGEWS\_\_}241\item Add this line after it: {\tt namespace['MOM'] = "hi there!"}242\item (TEMPORARY-BUG) Install sage\_server code {\em into a nested project}: {\tt pip install --user /projects/[your project id]/smc/src/smc\_sagews/}243\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.)244\end{enumerate}245246247\end{frame}248249250251252\end{document}253254