jupyternotebooks ou.pptx
TRANSCRIPT
CurrentdraDofgeoloca3onac3vi3es:hFps://github.com/psychemedia/OU-TM11N/blob/master/d2/geocodingDemos.ipynbWhilstthenotebokkdescribesasimplesetofrelatedac3vi3es,theyrequirethatthenotebookserverhasaccesstothewiderinternetandiscapableofmakingcallstothirdpartyAPIsoverhFp.ItalsomakesuseofapythonpackagethatisnotpartofthestandardJupyternotebook/scien3ficpythondistribu3onandmustbeinstalledeitherbythestudentorprovidedaspartofanenhancedpythondistribu3onaccessedviathenotebookserver.Theac3vitydefini3onthusaddstwoaddi3onalrequirementstotheprovisionofabasic,“self-contained”Jupyternotebookdistribu3ondesignedtomakeuseofastandardscien3ficpythondistribu3on:1) ThatthekernelhasaccesstothewiderinternetinordertoaccessthirdpartyAPIs
(and,asasideeffect,externalpythonmodulerepositoriessuchaspip).2) Eitherthatthestudentuserhaspermissionstoinstallanaddi3onalpython
moduleiftherequiredaddi3onalpackageisnotinstalled,orthatthecourseteamcandeineapythondistribu3onwiththeaddi3onalrequiredpackage
4
Pushingattheboundarycondi3onsISDELIBERATE.Inpart,solvingtheproblemsintroducedhereinmeansthatJupyternotebookscanbeusedinaflexible,openmannertosupportcoursesinthefuture,andprovidestudentswithanopportunitytointeractwiththirdpartyservicesaswellasclosedworld,OUbasedac3vi3es.
5
Thenotebooksprovidetheac3vitydescrip3onsandareusedbyanotebookservertoprovidetheinterfacethroughwhichtheac3vi3escanbecompletedinaninterac3vemanner.hFps://github.com/psychemedia/OU-TM11N/blob/master/d2/geocodingDemos.ipynb
6
hFps://github.com/psychemedia/OU-TM11N/blob/master/d2/geocodingDemos.ipynbThenotebookneedstobeabletoaccessthirdpartyAPIs.NotethatthislimitalsoappliestoaccessingdatafilesbyURL,whichmeansdatafilescannotbeloadeddirectlyintoanotebookkernelfromaURL,butmustbedownloadedontotheuser’sdesktopanduploadedbyhandintothenotebookenvironmentiftheyaretobeprocessedusingthenotebook.
7
Thenotebookneedsaccesstoanon-standardpythonpackage.Eitherthisneedstobeinstalledinacustomisedpythonkernel,orstudentsneedpermissiontoinstalltherequiredpackage.Thenotebookrequiresnetworkaccesstofetchmap3lesusedtorenderanembeddedmap.
8
hFps://github.com/psychemedia/OU-TM11N/blob/master/d2/geocodingDemos.ipynbOneoftheac3vi3esallowsstudentstolookuptheloca3onofanetworkrouterfromitsMACaddress.Ifthestudentisrunningthenotebookkernellocally,andtheircomputerhaswifienabled,theyshouldbeabletoiden3fyalocalwifirouterMACaddressoftheirownandusethataspartoftheexercise.Ifthekernelisrunningonaremoteserver,itisunlikelythatwifinetworkingserviceswillbeavailable,inwhichcasewecanprovidestudentswithanalterna3veMACaddresstolookup.
9
TheTM351Jupyternotebookserverincludesseveralcustomisa3ons,including:- OUbrandingofnotebooks;- Customexports:MicrosoDWord.docx,ODSzip(azipfilecontainingtheoriginal
notebookandtheHTMLrenderingofit)
11
AJupyternotebookcanbeviewedinabrowseraseitherasta3cdocument,orasaninterac3veuserinterfacetoacodeexecu3ngkernelrunningasaprocessonthelocalmachine,oronaremotehost.EmbeddedcodeoutputscanincluderesponsesfromthirdpartyAPIs,datatables,charts,interac3vemapsgeneratedfromexecutedcode.
13
Thenotebooksourcefile(suffix.ipynb)isaJSONtextfile.ItcanberenderedtoanHTMLdocumentusingthe`nbviewer`applica3on.Thenotebookfilecanalsobeusedinterac3vely,asaGUItoabackendcomputa3onalprocessthatcanexecuteandevaluateelementsiden3fiedas“code”inthenotebook,andreturntheresultsofcodeexecu3onfordisplayinthenotebook.--{ipynb[label=".ipynb\n(JSONtextfile)"];nbviewer[label="nbviewer",color='yellow'];ipynb->nbviewer;group{shape=line;html1[label="HTML",color='lightgreen'];nbviewer->html1;
14
Thenotebookservercanberunvariously:- onthestudent’sdesktopasadesktopapplica3on,e.g.usingAnaconda(for
example,inFutureLearnLearntoCodeMOOC);- inavirtualmachinerunningonthestudent’sdesktopegasintheTM351
VirtualboxVM;- onaremotehost,suchasinaDockercontainerrunningonAzure;- onaremotehost,launchedviatheJupyterhubmul3-usernotebookserver
manager.Inthiscase,thenotebookmaylaunchasa“disposable”notebookserver(forexample,usingtmpnbortry.jupyter.org)ormayrequireanauthen3catedlogin.
15
Whatsortofissuesarerelevanttounderstandingouran3cipatedstudentexperienceofworkingwiththenotebooks?
16
HowdoI“run”aninterac3venotebook?- Ifyouarerunningalocalnotebookserver,youneedtoinstallitonyourdesktop
somehow,havesomemeansforstar3ngandstoppingtheserver,andknowwhatlocalURLtofindthenotebookson.(Insomecircumstancesthenotebookservermayautoma3callyopenthenotebookserverhomepageintheuser’sbrowser).
- Ifyouareaccessingaremoteserver,youneedtoknowwheretofindthenotebookserverandmayneedauthen3ca3oncreden3als.
DoIneedtorunthenotebookserveronmycomputer?-Thewifilookupac3vitywillrequirethenotebookservertorunonastudent’scomputerthathassupportforwificonnec3vity.Allotherac3vi3escouldrunonaremoteserver,aslongasthepythonkernelhasaccesstothewiderinternet.DoIneedanetworkconnec3on?- Toaccessthenotebooksrunningonaremoteserver,youwillneedanetwork
connec3oninordertoworkwiththenotebooksinterac3vely,Attheendofasession,youcanexportanHTML,docxorPDFversionofthenotebooktokeepa“flat”(non-interac3ve)porwoliorecordofit.
17
Thereareseveralwaysstudents*could*runJupyternotebooks–solet’squicklyreviewthem…Someapproachesmayworkforsomecoursesitua3ons,somemaynot…Alongthewayofreviewingthevariousofferings,canwecomeupwithsomesortofcriteriaforhelpingusiden3fywhatrequirementsdifferentsortsofac3vi3esmightimpose,andwhatsortsofrequirementscanbemetbythedifferentwaysofaccessingthenotebooks.
18
tmpnb.org/try.jupyter.orgThetemporarynotebookserverlaunchesatemporarycontainerpre-seededwithdemonotebooks.Thebackendserversareprovided(freetotheend-user)byRackspace.Userscanuploadtheirownnotebooksandexecutetheminacontainerlaunchedforthatindividual.Thecontainersareautoma3callydestroyed,alongwithanycontentuploadedtothemorcreatedbythenotebook,aDerashortperiodof3me.
20
tmpnb.org/try.jupyter.orgUserscannotinstalladdi3onalpackagesorcallouttotheinternettoaccessthirdpartyAPIsorURLs.
21
notebooks.azure.comMicrosoDareaggressivelytryingtogrowanaudiencefortheironlinedatasciencetools,andnotebooks.azure.comareacomplementtothatservice,offeringfreeJupyternotebooksinaprojectbasedenvironment.Notebookscanbecollectedtogetherinlibrariesandsharedwiththirdpar3es,offeringthepossibilityofplacingallthenotebooksrequiredforapar3cularcourseintooneprojectlibraryandallowsstudentstoclonethatlibraryinordertoaccessthenotebooks.Notebooksaresavedtothefileareabetweensessions.
22
notebooks.azure.comAccesstotheinternetfromthenotebookkernelappearstobeoff-limits,meaningnoaccesstothirdpartyAPIsorURLs.
23
CoCalcdoesnotprovideaccesstothewiderinternetonthefreeplan,butanpaidforupgradedoesallowcallstobemadetoexternalservices[UNTESTED].WehaveusedSageMathCLoud/CoCalcasoneofthewaysofaccessingJupyternotebooksintheFutureLearncourseLearntoCodeforDataAnalysis.
25
Anaconda-hFps://www.con3nuum.io/downloads-isascien3ficPythondistribu3onthatbundlesJupyternotebooks,whichcanbestartedfromthecommandlineorashortcutlauncher.Studentscandownloadandinstallthedistribu3onontheirowncomputer,andtheninstalltheaddi3onalrequiredpackage.AnacondawastheprimarymeansbywhichweencouragedlearnerstoaccessJupyternotebooksontheFutureLearnLearntoCodeforDataAnalysiscourse.
28
hFps://github.com/nteract/nteractnteractisacross-plawormHTML5(electron)desktopapplica3onthatrunsanotebookserveradprovidesaccesstonotebooksinastandaloneapplica3on.Doubleclickingonaipynbfilewillopenitinnteract.Althoughastandaloneapplica3on,nteractdependsonthepresenceofanappropriateIPythonkernel,suchasoneinstalledwithAnaconda.nteractiss3llunderdevelopmentandhasnothadanofficialreleasetodate.
29
hFps://www.virtualbox.org/wiki/DownloadsVirtualBoxisacross-plawormvirtualisa3onapplica3onthatcanbeusedtorunpredefinedvirtualmachines(VMs).AVirtualBoxheadlessVMcanbedefinedtoruntheJupyternotebookserverasaservice,accessedviathebrowseronthestudent’sowndesktop.NotebooksexistinafolderonthehostmachineandsharedintotheVM.TheVMapproachwasusedbyTM351todeliveranotebookserveralongwithseveralotherapplica3onstostudents.AUSBinstallerincludedallset-upfilesandtheVMimage,althoughitwasalsopossibletodownloadthisfromoriginalloca3onsontheweb.
30
Dockercommunityedi3onallowsyoutorundockercontainersonyourowndesktop.Dockernowrunsasana3veapplica3ononWindowsandMacs,handlingcontainervirtualisa3onwithouttheneedtoinstallVirtualBox.
31
I’mthinkinghere–fireupyourownhostanduseOUprovideddockercontainerimages,AmazonAMIimagesetc?eghFps://github.com/psychemedia/ou-tm351/blob/master/tm351_builder_unversioned/docs/tm351_ami.md
32
Launchyourowninstancebutatthegenerosityofathirdparty.EgmybinderThemybinderservertendstobeunreliable–butcouldtheOUhostit’sown,thatonlylauncheswhitelistedimagesfromauthen3catedOUstudentusers?
33
EgrunnotebookcontaineronOUOpenStack;advantages:notebookcanbeseededwithbrandednotebookserver,exportextensions,coursenotebooks
34
EgrunnotebookcontaineronOUOpenStack;advantages:notebookcanbeseededwithbrandednotebookserver,exportextensions,coursenotebooks
35
Provideatemporarynotebookserverrunningsomewhere,accesslimitedtoTM112students,pre-seededcoursenotebooks,JupyternotebookenvironmentcustomisedwithOUbranding,exportextensions,requiredpythonpackagespreinstalled.NetwrokaccesscontrolsfromoriginaltmpnbserverwouldneedtoberelaxedifcallsweretobemadetothirdpartyAPIs.Alterna3vely,OUcouldalsohostAPIendpointserverstohandlegeocoding,map3leserver,andnotebookscouldbeconfiguredtoaccessthoseOUprovidedservices.
36
HostedonOUironorAzure?Studentshaveauthen3catedaccesstotheirownnotebookserverviaJupyterhub.Thiswillsupportindividualpersistenceoffiles.
37
Mapswon’trender,callstothirdpartyAPIswillfail.Weakalterna3veistomakeexecutednotebookavailablesostudentscanreadthroughoutputsgeneratedascanned/exampleoutputsbyus.ThiscouldevenbeasfloatHTML,docx,PDFetc.Alterna3veistoprovidelinkedservicesrunninglocalAPIendpoints– egthereispostocodes.iocontainer,thereisa3leserveravailablethatrunswithOpenStreetMap3les.Thesecouldbeprovided:- WithinamonolithicVirtualboxVM(cf.TM351VM)- Asasetoflinkeddocker-composecontainers.VM/containercouldbedownloadedfrominternetorshippedviaUSBmemorys3ck.
40
Weakalterna3veistomakeexecutednotebookavailablesostudentscanreadthroughoutputsgeneratedascanned/exampleoutputsbyus.ThiscouldevenbeasfloatHTML,docx,PDFetc.
41
Addi3onalrequirementsforTM351:1) Persistenceofstudentnotebookssomewhere2) Abilitytoconnecttolinkedservices(postgres,mongo)3) Abilitytopersistlinkdatabasestate
42
TheTM351virtualmachineextendstherequirementsoveranaboveasimpleJupyternotebookserver.Inpar3cular,theTM351VMbundles:- Customisa3onstotheJupyternotebook;preinstalledpythonpackages;addi3onal
Linuxpackages.- Addi3onallinkedservicesthatareonlyexposedinsidetheVM(PostgreSQL,
MongoDB)- Anaddi3onalservicewithbrowserUIsexposedoutsidetheVM(OpenRefine)
43