{"id":17280186,"url":"https://github.com/akuli/potti","last_synced_at":"2025-03-26T15:16:01.886Z","repository":{"id":220431221,"uuid":"751628586","full_name":"Akuli/potti","owner":"Akuli","description":"IRC bot that lets users run arbitrary Python code","archived":false,"fork":false,"pushed_at":"2024-11-03T23:10:35.000Z","size":118,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-31T16:18:04.197Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Akuli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-02T01:29:12.000Z","updated_at":"2024-11-03T23:10:32.000Z","dependencies_parsed_at":"2025-01-06T01:52:29.086Z","dependency_job_id":"152a43c3-063c-4db2-9fdc-2065899dcfe4","html_url":"https://github.com/Akuli/potti","commit_stats":null,"previous_names":["akuli/potti"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akuli%2Fpotti","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akuli%2Fpotti/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akuli%2Fpotti/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akuli%2Fpotti/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Akuli","download_url":"https://codeload.github.com/Akuli/potti/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245678901,"owners_count":20654738,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T09:19:40.136Z","updated_at":"2025-03-26T15:16:01.866Z","avatar_url":"https://github.com/Akuli.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Potti\n\nPotti is an IRC bot that lets users run Python code on it.\n\n![screenshot1](screenshot-basic.png)\n\nIf you don't know what IRC is, it doesn't really matter\nfor understanding the most interesting aspect of this project, that is,\nthe security of running arbitrary Python code.\n(If you want, try [my mantaray project](https://github.com/Akuli/mantaray) to get started with IRC.)\n\nThe Python code is executed securely but ridiculously\nby using [Deno, a secure-by-default javascript runtime](https://deno.com/),\nto run [Pyodide, a Python interpreter compiled into WebAssembly](https://pyodide.org/).\nPyodide naturally has no access to a real file system, because it's meant to be ran in a web browser.\nInstead, it creates a fake file system and\ncrashes with various funny errors when you try to access real operating system functionality.\n\n![screenshot2](screenshot-denied-pyodide.png)\n\nHowever, it is possible to escape Pyodide and run arbitrary javascript code\nwith the `pyodide.code.run_js()` function.\nIt doesn't matter, because [Deno is secure by default](https://docs.deno.com/runtime/manual/basics/permissions),\nand you will errors from Deno if you try to do stuff in javascript:\n\n![screenshot3](screenshot-denied-deno.png)\n\n\n## Setup\n\n**The bot only works on Linux.** Please create an issue if you want to run it on some other system.\n\nDevelopment setup:\n\n```\n$ git submodule update --init\n$ python3 -m venv env\n$ source env/bin/activate\n$ pip install -r requirements.txt\n$ pip install -r requirements-dev.txt\n$ pip install -r mantaray/requirements.txt\n$ ./download-deno.sh\n```\n\nRunning the bot for local development:\n\n```\n$ python3 -m potti --launch-server --launch-client\n```\n\nTests and type checking:\n\n```\n$ git submodule update --init\n$ python3 -m pytest\n$ mypy potti\n```\n\n\n## Background/history/motivation\n\nI've been ocassionally on an IRC channel named `##learnpython` for about 10 years now.\nIt is a small community of programmers, and it has gotten smaller over time,\nbut I still talk there regularly.\nI was a beginner programmer when I joined, and now I'm the person who helps others there the most.\n(If you want to talk on `##learnpython`, you can run [Mantaray](https://github.com/Akuli/mantaray).\nIt joins `##learnpython` by default.)\n\nOn the `##learnpython` channel, there was already an instance of [pbot](https://github.com/raylu/pbot/),\nwhich is another bot that runs people's code.\nIt uses some kind of sandbox thing to limit resources and chroot to a dummy file system.\n\nUnfortunately pbot is not open-source.\n[Its license is quite literally a joke](https://github.com/raylu/pbot/blob/master/LICENSE),\nso I can't legally fork the project, change a few things I find annoying, and run my own instance of the bot.\nThe author of pbot maintains it occasionally, but has left IRC and doesn't want anything to do with IRC.\nHe also refused to apply an open-source license when I asked.\n\nSo there's several reasons why I wanted to create this project:\n- I like being able to change the bot whenever and however I want,\n    especially when it stops working for whatever reason.\n- I want to use open-source software when it is reasonably possible.\n- `pbot` broke randomly (again) a few days ago.\n\nThis project works completely differently than pbot, and has nothing copied from pbot.\nI haven't looked at pbot's source code in years,\nand I'm pretty sure that webassembly didn't exist when pbot was created.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakuli%2Fpotti","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakuli%2Fpotti","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakuli%2Fpotti/lists"}