SlideShare a Scribd company logo
PyPedia


The free programming environment
       that anyone can edit!
From:
http://wiki.python.org/moin/SandboxedPython




Hmm.. nice idea.

Fortunately, there is a Sandboxed Python: googleappengine

..and an advanced, highly extendable wiki engine: Mediawiki

The combination of all these is… PyPedia


This presentation takes a tour to the core functionality of www.pypedia.com
Let’s say you have a method in python:
• Sign in www.pypedia.com . Suppose that your
  username is “JohnDoe”.
   (In the rest of this presentation replace “JohnDoe” with your username)



• Create an article with title: Foo_user_JohnDoe

• Save the article with the prefilled text unchanged.
The article
should
look like this
• Edit the “code” section and add the code of
  the method.
• Tip: Click three times in the code text area for
  code friendly formatting.
• Save the edit.
• Done! You have a script of your own published
  in PyPedia.
• In the article, press the “Execute on browser”
  button (              )
• The function’s output and returned value
  appear in an area under the button:
• Let’s add some parameters
• Edit the code:
• Then edit the parameters section:
• This is what you see:




• Inside the <inputs> tags add the text:
<param name="arg_1"   type="data" value="default_input"   label="Enter value for argument 1:"/>
<param name="arg_2"   type="eval" value=”4"               label="Enter value for argument 2:"/>
• What are all these??



                                                                 Ignore this part
                                                                 Automatically generated
                                                                 (Edits here will be removed)



                                                                 Add this part


                                                                  Text to display in the form


                           • If type=“data” then the input is treated as
                             string
The name of the argument   • If type=“eval” then the input is treated as     Default values
                             python expression (i.e. [3,4,5])
• Click save. The parameters section of the
  article should look like this:




• Fill the parameters and press the “Execute on
  browser” button. This should appear:

                        Play with the arguments. A complete online
                        script has been created!
Cool, but I want to call the function from my local
computer..

• Install the PyPedia python library:
git clone git://github.com/kantale/pypedia.git

• Load the function in python:
>>> import pypedia
>>> from pypedia import Foo_user_JohnDoe
>>> print foo_user_JohnDoe(“test”, [1,2,3])
  function foo
  Arguments: test [1,2,3]
  42
>>>

• You can call the method of any user and your
  method can be called by anyone
Some tips of the python library:
• pypedia.before_timestamp = “20120416000000”
  – Import the most recent revision of functions and
    classes that are older than 16/4/2012 (something like
    method permalinks..)
• pypedia.enable_cache = True
  – Suppress method download if method already exists
• pypedia.debug = True
  – For debug info
• pypedia.warnings = False
  – Suppress warnings
You can call the function from the PyPedia front page:
Now let’s make another article:
• Create the article: Goo_user_JohnDoe
• Edit the code section:
• Save and press the button “Execute on browser”




• A method can call any other method without
  importing.
• All PyPedia articles belong to the same
  namespace (as with any wiki).
• Same behavior exists for classes.
• In the Goo_user_JohnDoe article press the
  “Download code” button.
• The file Goo_user_JohnDoe.py is downloaded.
• Open this file with a text editor:




• It contains all the code required for executing the
  method (including the user parameters).
• Executing locally the method is as simple as:
#> python Goo_user_JohnDoe.py
• In the Foo_user_JohnDoe article edit the
  section “Unit tests”:
• Now edit the code of the method (edit the
  code section) so that it will not return 42, but
  something else. Upon saving, this pops up:




• With unitests you can guarantee a certain
  behavior of your methods.
• As with any wiki, in PyPedia a method can
  have more than one name:
• Create the page: Hoo_user_JohnDoe
• Replace all the prefilled text with:
  #REDIRECT [[Foo_user_JohnDoe]]
• Save the page
• In the front page run:
Hoo_user_JohnDoe("test", [1,2,3])
• The result is exactly the same as running the
  function: Foo_user_JohnDoe
Executing a method in a remote computer:
• Edit your user page and add an “ssh” section:


                           ==ssh==
                           host=www.example.com
                           username=JohnDoe
                           path=/home/JohnDoe/runPyPedia




• Substitute the above values with real ones for a
  computer that you have remote access (the
  username doesn’t have to be the same as your
  PyPedia username).
• Save the page.
• This content is NOT shown to anyone and
  there isn’t anyway to retrieve it (to change just
  make another “ssh” section).
• Login and cd to the path that you declared of
  your remote computer.
• Install there:
      – The PyPedia python library:
git clone git://github.com/kantale/pypedia.git
      – The utility ssh_wpl_client:
wgethttps://raw.github.com/kantale/PyPedia_server/master/utils/ssh_wpl_client.py
• On the article Foo_user_JohnDoe press the
  “Execute on remote computer” button.
• Enter the password of your remote computer
  and press GO!




• A new tab opens with the following content:
PyPedia’s REST api:
• http://www.pypedia.com/index.php?get_code=G
  oo_user_JohnDoe(1,2)
  – Fetch the constraint-free version necessary to run the
    command Goo_user_JohnDoe(1,2)
  – Use wget or curl to save the content in a file
• http://www.pypedia.com/index.php?b_timestam
  p=20120418000000&get_code=Goo_user_JohnD
  oe(1,2)
  – Fetch the most recent revision of the constraint-free
    version of the code as it was before 18/4/2012
• By sharing these links we can archive and
  reproduce our analysis.
Who can edit my article?
• By default only you (and the admins) can edit
  any part of the article.
• Edit the Permissions subsections and add any
  users (coma separated) that you want to allow
  editing.
• Special user names:
  – SIGNED: Any signed user can edit this section
  – ALL: Any user can edit this section
• On the top of each article there is a button:

• With this you can create a personalized version of the
  article that only you can edit.
• For example if you fork the article:
  Foo_user_Someonethen the article
  Foo_user_JohnDoewill be created with the same
  content but with different user privileges.
• This is similar to the Github’s “fork” feature.
What is the “Development Code” section ?
• ANY user (yes any) can edit this section. The
  code is not parsed, not downloaded and not
  run at all.
• Users (that are not allowed to edit) should use
  this section to make suggestions for code
  corrections.
• Alternatively they can use the Talk pages for
  comments regarding any part of the article.
• The Documentation, Return and See also
  subsections allow any kind of content.
• Use wiki text formatting in these sections to
  document your method and help other people
  to use it.
• All content is under the Simplified BSD License
• Articles that are well written and documented
  with thorough unitests and parameters may be
  copied to the main namespace by the admins
• I.e. if the method Foo_user_JohnDoe is good
  enough, the admins can create the article Foo
  with the same content
• Only the admins can edit the main namespace
How safe are the contents of PyPedia ??
• Run “User” methods only if you trust the code
  or the user (or if you are running in a sandbox).
• The admins can delete methods with misleading
  and/or malicious content.
• Methods in the main namespace should be
  considered safe.
• As with any open content no guarantee is given
  for the security or efficiency of the code.
Thanks for reading!

• Contact: admin@pypedia.com
• Join us in google groups:
  http://groups.google.com/group/pypedia
• Twitter: @PyPedia

• PyPedia’s source code:
  – Mediawiki extension:
    https://github.com/kantale/PyPedia_server
  – Python library:
    https://github.com/kantale/pypedia

More Related Content

PDF
Drupal8 for Symfony developers - Dutch PHP
PDF
Make XCUITest Great Again
PPTX
How to get full power from WebApi
DOCX
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
PDF
Angular 2 Component Communication - Talk by Rob McDiarmid
PPTX
Apache Ant
PPT
Ant - Another Neat Tool
PPTX
ITPROceed 2016 - The Art of PowerShell Toolmaking
Drupal8 for Symfony developers - Dutch PHP
Make XCUITest Great Again
How to get full power from WebApi
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
Angular 2 Component Communication - Talk by Rob McDiarmid
Apache Ant
Ant - Another Neat Tool
ITPROceed 2016 - The Art of PowerShell Toolmaking

What's hot (20)

PPT
Apache Ant
PPTX
PPTX
Real World Asp.Net WebApi Applications
PDF
Angular performance slides
PPT
Apache Ant
PDF
119764860 dx-auth
PDF
KAAccessControl
PDF
Life outside WO
PDF
How To Structure Go Applications - Paul Bellamy - Codemotion Milan 2016
PPSX
Sunil phani's take on windows powershell
PDF
Rich Internet Applications con JavaFX e NetBeans
PPTX
Wt unit 5
PDF
PPTX
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
PPTX
WuKong - Framework for Integrated Test
PPT
Apache Ant
PDF
Unit Testing with WOUnit
PDF
In memory OLAP engine
PPT
Intoduction to Play Framework
PPTX
Scaladays 2014 introduction to scalatest selenium dsl
Apache Ant
Real World Asp.Net WebApi Applications
Angular performance slides
Apache Ant
119764860 dx-auth
KAAccessControl
Life outside WO
How To Structure Go Applications - Paul Bellamy - Codemotion Milan 2016
Sunil phani's take on windows powershell
Rich Internet Applications con JavaFX e NetBeans
Wt unit 5
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
WuKong - Framework for Integrated Test
Apache Ant
Unit Testing with WOUnit
In memory OLAP engine
Intoduction to Play Framework
Scaladays 2014 introduction to scalatest selenium dsl
Ad

Viewers also liked (6)

PPT
Presentació1
PPT
Mag slideshow final
PPTX
Music Portfolio
PDF
Pcboverview
PPTX
Practicum fall 2011
PPT
Mag slideshow final
Presentació1
Mag slideshow final
Music Portfolio
Pcboverview
Practicum fall 2011
Mag slideshow final
Ad

Similar to PyPedia (20)

PPTX
PyCourse - Self driving python course
PPTX
ITC 110 Week 10 Introdution to Python .pptx
PDF
Wait, IPython can do that?! (30 minutes)
PPT
Introduction to the intermediate Python - v1.1
PDF
Drupal8 for Symfony Developers (PHP Day Verona 2017)
PDF
Eclipse IDE, 2019.09, Java Development
PPTX
Object oriented programming design and implementation
PPTX
Object oriented programming design and implementation
PPT
391Lecture0909 Vision control of git.ppt
ODP
OpenStack Contribution Process
ODP
Openstack contribution process
PPTX
Bitbucket git-bamboo-jira
PDF
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
PPTX
Python Tutorial Part 2
DOCX
In this project, you will learn to use some of the team” features o.docx
PDF
Expanding XPages with Bootstrap Plugins for Ultimate Usability
PPTX
Mercurial training
PPT
CSE 390 Lecture 9 - Version Control with GIT
PPTX
Professional Help for PowerShell Modules
PPTX
Baabtra django framework installation and sample project using aptana
PyCourse - Self driving python course
ITC 110 Week 10 Introdution to Python .pptx
Wait, IPython can do that?! (30 minutes)
Introduction to the intermediate Python - v1.1
Drupal8 for Symfony Developers (PHP Day Verona 2017)
Eclipse IDE, 2019.09, Java Development
Object oriented programming design and implementation
Object oriented programming design and implementation
391Lecture0909 Vision control of git.ppt
OpenStack Contribution Process
Openstack contribution process
Bitbucket git-bamboo-jira
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Python Tutorial Part 2
In this project, you will learn to use some of the team” features o.docx
Expanding XPages with Bootstrap Plugins for Ultimate Usability
Mercurial training
CSE 390 Lecture 9 - Version Control with GIT
Professional Help for PowerShell Modules
Baabtra django framework installation and sample project using aptana

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
A Presentation on Artificial Intelligence
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Big Data Technologies - Introduction.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
A comparative analysis of optical character recognition models for extracting...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Unlocking AI with Model Context Protocol (MCP)
Building Integrated photovoltaic BIPV_UPV.pdf
Review of recent advances in non-invasive hemoglobin estimation
sap open course for s4hana steps from ECC to s4
Chapter 3 Spatial Domain Image Processing.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Programs and apps: productivity, graphics, security and other tools
A Presentation on Artificial Intelligence
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Reach Out and Touch Someone: Haptics and Empathic Computing
Big Data Technologies - Introduction.pptx
Encapsulation_ Review paper, used for researhc scholars
Assigned Numbers - 2025 - Bluetooth® Document
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
MIND Revenue Release Quarter 2 2025 Press Release
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
A comparative analysis of optical character recognition models for extracting...
“AI and Expert System Decision Support & Business Intelligence Systems”
Unlocking AI with Model Context Protocol (MCP)

PyPedia

  • 1. PyPedia The free programming environment that anyone can edit!
  • 2. From: http://wiki.python.org/moin/SandboxedPython Hmm.. nice idea. Fortunately, there is a Sandboxed Python: googleappengine ..and an advanced, highly extendable wiki engine: Mediawiki The combination of all these is… PyPedia This presentation takes a tour to the core functionality of www.pypedia.com
  • 3. Let’s say you have a method in python:
  • 4. • Sign in www.pypedia.com . Suppose that your username is “JohnDoe”. (In the rest of this presentation replace “JohnDoe” with your username) • Create an article with title: Foo_user_JohnDoe • Save the article with the prefilled text unchanged.
  • 6. • Edit the “code” section and add the code of the method. • Tip: Click three times in the code text area for code friendly formatting.
  • 7. • Save the edit. • Done! You have a script of your own published in PyPedia. • In the article, press the “Execute on browser” button ( ) • The function’s output and returned value appear in an area under the button:
  • 8. • Let’s add some parameters • Edit the code:
  • 9. • Then edit the parameters section: • This is what you see: • Inside the <inputs> tags add the text: <param name="arg_1" type="data" value="default_input" label="Enter value for argument 1:"/> <param name="arg_2" type="eval" value=”4" label="Enter value for argument 2:"/>
  • 10. • What are all these?? Ignore this part Automatically generated (Edits here will be removed) Add this part Text to display in the form • If type=“data” then the input is treated as string The name of the argument • If type=“eval” then the input is treated as Default values python expression (i.e. [3,4,5])
  • 11. • Click save. The parameters section of the article should look like this: • Fill the parameters and press the “Execute on browser” button. This should appear: Play with the arguments. A complete online script has been created!
  • 12. Cool, but I want to call the function from my local computer.. • Install the PyPedia python library: git clone git://github.com/kantale/pypedia.git • Load the function in python: >>> import pypedia >>> from pypedia import Foo_user_JohnDoe >>> print foo_user_JohnDoe(“test”, [1,2,3]) function foo Arguments: test [1,2,3] 42 >>> • You can call the method of any user and your method can be called by anyone
  • 13. Some tips of the python library: • pypedia.before_timestamp = “20120416000000” – Import the most recent revision of functions and classes that are older than 16/4/2012 (something like method permalinks..) • pypedia.enable_cache = True – Suppress method download if method already exists • pypedia.debug = True – For debug info • pypedia.warnings = False – Suppress warnings
  • 14. You can call the function from the PyPedia front page:
  • 15. Now let’s make another article: • Create the article: Goo_user_JohnDoe • Edit the code section:
  • 16. • Save and press the button “Execute on browser” • A method can call any other method without importing. • All PyPedia articles belong to the same namespace (as with any wiki). • Same behavior exists for classes.
  • 17. • In the Goo_user_JohnDoe article press the “Download code” button. • The file Goo_user_JohnDoe.py is downloaded. • Open this file with a text editor: • It contains all the code required for executing the method (including the user parameters). • Executing locally the method is as simple as: #> python Goo_user_JohnDoe.py
  • 18. • In the Foo_user_JohnDoe article edit the section “Unit tests”:
  • 19. • Now edit the code of the method (edit the code section) so that it will not return 42, but something else. Upon saving, this pops up: • With unitests you can guarantee a certain behavior of your methods.
  • 20. • As with any wiki, in PyPedia a method can have more than one name: • Create the page: Hoo_user_JohnDoe • Replace all the prefilled text with: #REDIRECT [[Foo_user_JohnDoe]] • Save the page • In the front page run: Hoo_user_JohnDoe("test", [1,2,3]) • The result is exactly the same as running the function: Foo_user_JohnDoe
  • 21. Executing a method in a remote computer: • Edit your user page and add an “ssh” section: ==ssh== host=www.example.com username=JohnDoe path=/home/JohnDoe/runPyPedia • Substitute the above values with real ones for a computer that you have remote access (the username doesn’t have to be the same as your PyPedia username).
  • 22. • Save the page. • This content is NOT shown to anyone and there isn’t anyway to retrieve it (to change just make another “ssh” section). • Login and cd to the path that you declared of your remote computer. • Install there: – The PyPedia python library: git clone git://github.com/kantale/pypedia.git – The utility ssh_wpl_client: wgethttps://raw.github.com/kantale/PyPedia_server/master/utils/ssh_wpl_client.py
  • 23. • On the article Foo_user_JohnDoe press the “Execute on remote computer” button. • Enter the password of your remote computer and press GO! • A new tab opens with the following content:
  • 24. PyPedia’s REST api: • http://www.pypedia.com/index.php?get_code=G oo_user_JohnDoe(1,2) – Fetch the constraint-free version necessary to run the command Goo_user_JohnDoe(1,2) – Use wget or curl to save the content in a file • http://www.pypedia.com/index.php?b_timestam p=20120418000000&get_code=Goo_user_JohnD oe(1,2) – Fetch the most recent revision of the constraint-free version of the code as it was before 18/4/2012 • By sharing these links we can archive and reproduce our analysis.
  • 25. Who can edit my article? • By default only you (and the admins) can edit any part of the article. • Edit the Permissions subsections and add any users (coma separated) that you want to allow editing. • Special user names: – SIGNED: Any signed user can edit this section – ALL: Any user can edit this section
  • 26. • On the top of each article there is a button: • With this you can create a personalized version of the article that only you can edit. • For example if you fork the article: Foo_user_Someonethen the article Foo_user_JohnDoewill be created with the same content but with different user privileges. • This is similar to the Github’s “fork” feature.
  • 27. What is the “Development Code” section ? • ANY user (yes any) can edit this section. The code is not parsed, not downloaded and not run at all. • Users (that are not allowed to edit) should use this section to make suggestions for code corrections. • Alternatively they can use the Talk pages for comments regarding any part of the article.
  • 28. • The Documentation, Return and See also subsections allow any kind of content. • Use wiki text formatting in these sections to document your method and help other people to use it.
  • 29. • All content is under the Simplified BSD License • Articles that are well written and documented with thorough unitests and parameters may be copied to the main namespace by the admins • I.e. if the method Foo_user_JohnDoe is good enough, the admins can create the article Foo with the same content • Only the admins can edit the main namespace
  • 30. How safe are the contents of PyPedia ?? • Run “User” methods only if you trust the code or the user (or if you are running in a sandbox). • The admins can delete methods with misleading and/or malicious content. • Methods in the main namespace should be considered safe. • As with any open content no guarantee is given for the security or efficiency of the code.
  • 31. Thanks for reading! • Contact: admin@pypedia.com • Join us in google groups: http://groups.google.com/group/pypedia • Twitter: @PyPedia • PyPedia’s source code: – Mediawiki extension: https://github.com/kantale/PyPedia_server – Python library: https://github.com/kantale/pypedia