The Brython 3.10 (Browser Python) project release is presented with an implementation of the Python 3 programming language for execution on the side of a web browser, allowing you to use Python instead of JavaScript to develop scripts for the Web. The project code is written in Python and distributed under the BSD license.
By including the brython.js and brython_stdlib.js libraries, a web developer can use the Python language to define client-side site logic using Python instead of JavaScript. To include Python code on pages, use the tag Ρ mime-ΡΠΈΠΏΠΎΠΌ Β«text/pythonΒ». ΠΠΎΠΏΡΡΠΊΠ°Π΅ΡΡΡ ΠΊΠ°ΠΊ Π²ΡΡΡΠ°ΠΈΠ²Π°Π½ΠΈΠ΅ ΠΊΠΎΠ΄Π° Π½Π° ΡΡΡΠ°Π½ΠΈΡΡ, ΡΠ°ΠΊ ΠΈ Π·Π°Π³ΡΡΠ·ΠΊΠ° Π²Π½Π΅ΡΠ½ΠΈΡ ΡΠΊΡΠΈΠΏΡΠΎΠ² (). ΠΠ· ΡΠΊΡΠΈΠΏΡΠ° ΠΏΡΠ΅Π΄ΠΎΡΡΠ°Π²Π»ΡΠ΅ΡΡΡ ΠΏΠΎΠ»Π½ΡΠΉ Π΄ΠΎΡΡΡΠΏ ΠΊ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ°ΠΌ ΠΈ ΡΠΎΠ±ΡΡΠΈΡΠΌ DOM. ΠΠΎΠΌΠΈΠΌΠΎ Π΄ΠΎΡΡΡΠΏΠ° ΠΊ ΡΡΠ°Π½Π΄Π°ΡΡΠ½ΠΎΠΉ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠ΅ Python ΠΏΡΠ΅Π΄Π»Π°Π³Π°ΡΡΡΡ ΡΠΏΠ΅ΡΠΈΠ°Π»ΠΈΠ·ΠΈΡΠΎΠ²Π°Π½Π½ΡΠ΅ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠΈ Π΄Π»Ρ Π²Π·Π°ΠΈΠΌΠΎΠ΄Π΅ΠΉΡΡΠ²ΠΈΡ Ρ DOM ΠΈ JavaScript-Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠ°ΠΌΠΈ, ΡΠ°ΠΊΠΈΠΌΠΈ ΠΊΠ°ΠΊ jQuery, D3, Highcharts ΠΈ Raphael. ΠΠΎΠ΄Π΄Π΅ΡΠΆΠΈΠ²Π°Π΅ΡΡΡ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΠ΅ CSS-ΡΡΠ΅ΠΉΠΌΠ²ΠΎΡΠΊΠΎΠ² Bootstrap3, LESS ΠΈ SASS.
Executing Python code from blocks ΠΏΡΠΎΠΈΠ·Π²ΠΎΠ΄ΠΈΡΡΡ ΡΠ΅ΡΠ΅Π· ΠΏΡΠ΅Π΄Π²Π°ΡΠΈΡΠ΅Π»ΡΠ½ΡΡ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΡ ΡΡΠΎΠ³ΠΎ ΠΊΠΎΠ΄Π°, Π²ΡΠΏΠΎΠ»Π½ΡΠ΅ΠΌΡΡ ΠΎΠ±ΡΠ°Π±ΠΎΡΡΠΈΠΊΠΎΠΌ Brython ΠΏΠΎΡΠ»Π΅ Π·Π°Π³ΡΡΠ·ΠΊΠΈ ΡΡΡΠ°Π½ΠΈΡΡ. ΠΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΡ ΠΈΠ½ΠΈΡΠΈΠΈΡΡΠ΅ΡΡΡ ΠΏΡΠΈ ΠΏΠΎΠΌΠΎΡΠΈ Π²ΡΠ·ΠΎΠ²Π° ΡΡΠ½ΠΊΡΠΈΠΈ brython(), Π½Π°ΠΏΡΠΈΠΌΠ΅Ρ ΡΠ΅ΡΠ΅Π· Π΄ΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠ΅ «». ΠΠ° ΠΎΡΠ½ΠΎΠ²Π΅ Python-ΠΊΠΎΠ΄Π° ΡΠΎΡΠΌΠΈΡΡΠ΅ΡΡΡ ΠΏΡΠ΅Π΄ΡΡΠ°Π²Π»Π΅Π½ΠΈΠ΅ Π½Π° ΡΠ·ΡΠΊΠ΅ JavaScript, ΠΊΠΎΡΠΎΡΠΎΠ΅ Π·Π°ΡΠ΅ΠΌ Π²ΡΠΏΠΎΠ»Π½ΡΠ΅ΡΡΡ ΡΡΠ°ΡΠ½ΡΠΌ JavaScript-Π΄Π²ΠΈΠΆΠΊΠΎΠΌ Π±ΡΠ°ΡΠ·Π΅ΡΠ° (Π΄Π»Ρ ΡΡΠ°Π²Π½Π΅Π½ΠΈΡ, ΠΏΡΠΎΠ΅ΠΊΡ PyPy.js ΠΏΡΠ΅Π΄Π»Π°Π³Π°Π΅Ρ Π΄Π»Ρ Π²ΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΡ Python-ΠΊΠΎΠ΄Π° Π² Π±ΡΠ°ΡΠ·Π΅ΡΠ΅ ΡΠΊΠΎΠΌΠΏΠΈΠ»ΠΈΡΠΎΠ²Π°Π½Π½ΡΠΉ Π² asm.js ΠΈΠ½ΡΠ΅ΡΠΏΡΠ΅ΡΠ°ΡΠΎΡ CPython, Π° Skulpt ΡΠ΅Π°Π»ΠΈΠ·ΡΠ΅Ρ ΠΈΠ½ΡΠ΅ΡΠΏΡΠ΅ΡΠ°ΡΠΎΡ Π½Π° JavaScript).
The overall performance of most operations in Python scripts embedded in web pages is close to that of CPython. The delay occurs only at the compilation stage, but to eliminate it, the ability to load precompiled JavaScript code is provided, which is used to speed up the loading of the standard library (Brython provides a toolkit for creating JavaScript libraries based on Python modules).
The new release is notable for being compatible with Python 3.10, including support for pattern matching (match/case) operators. The new version also proposes an initial implementation of the Abstract Syntax Tree (AST, Abstract Syntax Tree) for the Python language, which can later be used to generate JavaScript code from the universal AST.
Source: opennet.ru