|
1 | 1 | # BetterPython
|
2 |
| -WIP : A small but efficient, intuitive and responsive Python IDE right in your browser! Ships Micro Python, interpreter by your browser (so it works offline!), compiled with pyscript. |
| 2 | +[](https://github.com/jbdoderlein/betterpython/blob/master/LICENSE) |
| 3 | + |
| 4 | +[](https://GitHub.com/jbdoderlein/BetterPython/graphs/commit-activity) |
| 5 | +[](https://github.com/Naereen/badges/) |
| 6 | +[](https://github.com/Naereen/badges) |
| 7 | +<p style="font-style: italic"> Language : |
| 8 | + <span>English</span> | |
| 9 | + <a href="https://github.com/jbdoderlein/BetterPython/tree/master/lang/french#betterpython">Français</a> |
| 10 | + </p> |
3 | 11 |
|
4 |
| -## TODO |
5 |
| -### Write a good README |
6 |
| -Take exampel from BetterOCaml, with gifs, screenshot and usecases |
| 12 | +An efficient, intuitive and cross-platform web IDE for the [Python](https://www.python.org/) language, with your code interpreted and running in your browser! (no server is needed!) |
7 | 13 |
|
8 |
| -### Test on real programm (=debug) |
9 |
| -Make test on real world program = teaching material, see if the editor is capable |
| 14 | +## Installation / Usage |
10 | 15 |
|
11 |
| -### Change icon and name from BetterOCaml |
| 16 | +The IDE is hosted [here](https://jbdoderlein.github.io/BetterPython), <https://jbdoderlein.github.io/BetterPython>, but you can host your own version by simply copying the files from the `src/` directory on your host (on a folder of your laptop, or a folder of your web-server). |
12 | 17 |
|
13 |
| -### Change XtermJS look to better match BetterEditor design |
| 18 | +It is a *purely static website*: once your browser downloads the files from the server (about 3 MB), it will run the Python code in its javascript engine, without sending anything to a distant server! |
| 19 | +Your data is secure, and this website does not use any third party service cookie :no_good_man: :cookie:. |
14 | 20 |
|
15 |
| -Need to integrate termjs plugins (for autosizing) + see if we can integrate matplotlib inside |
| 21 | +Without installing any software on your laptop or smartphone, use [this web-based editor](https://jbdoderlein.github.io/BetterPython) to access to a MicroPython REPL and text editor, with syntax highlighting, and multiple-files that you can save to or load from your computer. |
16 | 22 |
|
17 |
| -### Make script to build from the sources the libs in the repo |
| 23 | +## How to use ? |
18 | 24 |
|
19 |
| -Track all libs used and write how to update each files |
| 25 | +TODO : usage GIF |
20 | 26 |
|
21 |
| -### Update PWA + serviceWorker settings |
| 27 | +The editor is made of 3 parts, as seen in this screenshot: |
| 28 | +- ** Navbar ** : this is where you can switch between multiple files. You can add, execute, save, load code in the editor and access to settings;; |
| 29 | +- ** Editor** : you can type code here and execute with `Ctrl+Enter`. This shortcut execute the current highlighted Python statement/block. To run the entire file you can use `Ctrl+Shift+Enter`. |
| 30 | +- ** Output & Console** : this the output of Python, showing values and messages printed to `sdtout`, you can also type command here (after the `>>> ` sign), and type `Enter`. |
22 | 31 |
|
23 |
| -Need to make mini-coi work with existing service worker to cache all fiels needed to the editor |
| 32 | +### :art: Theme |
24 | 33 |
|
25 |
| -### Clean up JS to remove every useless functions |
| 34 | +You can choose the theme in the settings, in the top right corner. Your preference should be used the next time you come back on the editor. |
| 35 | +There are currently three themes (two dark themes, "default" and "Monokai", and a light one, "MDN"). |
26 | 36 |
|
27 |
| -## BetterPython + BetterPythonLight ? |
| 37 | +If you have any suggestion for a new theme, [open an issue](https://github.com/jbdoderlein/BetterPython/issues/new) :+1: ! |
28 | 38 |
|
29 |
| -The choice of interpreter is important. |
| 39 | +## :sparkles: Use offline? |
| 40 | +### :computer: On a laptop or desktop |
| 41 | +- If you visit [the editor](https://jbdoderlein.github.io/BetterPython) webpage using your favorite browser, and if it works fine, you can add the link to your :star: "favorites", and then later on, if you open the direct link, it should work and load back BetterPython... even if your browser is offline! |
| 42 | +- This can only work if you don't clean-up or delete the cache of your browser, but it should work even if you turn-off and turn-on again your laptop! |
30 | 43 |
|
31 |
| -### MicroPython |
32 |
| -- lightweight |
33 |
| -- fast to load + to execute |
34 |
| -- no package = no matplotlib |
35 |
| -- work without worker if needed |
| 44 | +- BetterPython is a *Progressive Web App* (PWA), which can be installed on your laptop and used later on, even if you're offline! After being intalled, the app should appear in your global application menu (it works on Chromium on both Windows and Ubuntu). |
36 | 45 |
|
37 |
| -### Pyoide |
38 |
| -- real cpython implementation |
39 |
| -- can import package = can use matplotlib |
40 |
| -- heavy to load |
41 |
| -- package are heavy |
42 |
| -- need worker to work |
43 |
| -- import package is slow |
| 46 | +> If you can't install it as a PWA, [@Naereen](https://GitHub.com/Naereen) recommends trying [WebCatalog](https://webcatalog.app/), a multi-platform desktop app (for \*NIX, Windows and Mac OS), and you can then use it to "install" [the BetterPython editor](https://jbdoderlein.github.io/BetterPython), along with its integrated Python interpreter (of course), as a "native" desktop app. It then appears in the menu of your system, and it works offline! See [this 1:30min tutorial in video](https://github.com/jbdoderlein/BetterPython/issues/6#issuecomment-780269129)(This is a tutorial for [BetterOCaml](https://github.com/jbdoderlein/BetterOCaml), but it works in the same way.). |
44 | 47 |
|
45 |
| -2 solutions : choose one of the interpreter or make 2 versions |
| 48 | +### :phone: On a smartphone |
| 49 | +- It also works fine on smartphone running any recent OS and browser, :ok_hand: and the app should be "responsive" and you can switch to a vertical layout in the settings if your screen is too narrow. |
| 50 | +- Loading the Python toplevel can take a few seconds on a mobile 3G/4G or :snail: slow Wifi networks. |
| 51 | +- The *Progressive Web App* can be installed on your smartphone: there should be a small + button near the address bar, or a "Install it" option in the menu. Once you install it, there should be an icon in the home screen (but not in the app menu) that launches the app in full size mode (like a browser, but no address bar). It [works fine](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Developer_guide/Installing#what_browsers_support_installation) on Chrom(e|ium) and Firefox mobile on Android, at least. |
| 52 | +- If you think that this is not enough, and that the website should be bundled as a native iOS/Android app, please vote :+1: on [this issue](https://github.com/jbdoderlein/BetterOCaml/issues/14). |
| 53 | + |
| 54 | +## Python Interpreter |
| 55 | + |
| 56 | +BetterPython currently uses MicroPython, which offers high speed and short loading times. |
| 57 | + |
| 58 | +You can find out more about the differences with CPython on this [page](https://docs.micropython.org/en/latest/genrst/index.html). |
| 59 | + |
| 60 | +It is possible to integrate [Pyodide](https://pyodide.org/en/stable/) into BetterPython, but due to the interpreter's long loading time, this solution has not been retained. |
| 61 | + |
| 62 | +## About this project |
| 63 | + |
| 64 | +### :hammer_and_wrench: Dependencies |
| 65 | +BetterPython is made with these open-source tools: |
| 66 | +- [py_script](https://pyscript.net/) : provide Python in web browser with WASM; |
| 67 | +- [Materialize](https://materializecss.com/) : CSS and javascript framework; |
| 68 | +- [Codemirror](https://codemirror.net/) : javascript code editor. |
| 69 | +- [Tree Sitter](https://tree-sitter.github.io/tree-sitter/) : enable Python syntax analysis. |
| 70 | + |
| 71 | +### Contributing? |
| 72 | +Pull requests are welcome. For major changes, please [open an issue first](https://github.com/jbdoderlein/BetterPython/issues/new) to discuss what you would like to change. |
| 73 | + |
| 74 | +### :sos: Need help? |
| 75 | +If something is wrong or if you encounter any issue when using BetterPython, please [open an issue first](https://github.com/jbdoderlein/BetterPython/issues/new) (you have [to create a GitHub account](https://github.com/join) first). |
| 76 | + |
| 77 | +### :scroll: License |
| 78 | +This project is released publicly under the terms of the [MIT](https://opensource.org/license/mit) license. |
| 79 | + |
| 80 | +### Authors |
| 81 | +This project was initiated and is maintained by [@jbdoderlein](https://github.com/jbdoderlein/), with help and contributions from a few [other people](https://github.com/jbdoderlein/BetterPython/graphs/contributors). |
46 | 82 |
|
47 |
| -Need advice and feedbacks to decide |
|
0 commit comments