esperanto-python is a Python library (with command line utities) for programming Python in Esperanto.
esperanto-python runs in Python 3.7+.
With this library you can write a script like:
el random importi random, randint
se teksto(randint(1800,2100)) en aro(["1887", "2023"]):
presi("saluton")
alse estasklaso(rondigi(random()) == 0, bulea): # ĉiam Vera
presi("mondo")
alie:
altigi RultempoEraro("io misfunkciis")
Name the file my_file.eopy
and run it with eopy my_file.eopy
.
You can also import other .eopy
and .py
files from the main file:
importi my_file
To install with pip, run the following command:
pip install "esperanto-python[errors]"
and for non-errors support (without friendly-traceback):
pip install esperanto-python
This will create the command line script:eopy
You can run eopy files with eopy <file>
You can start Esperanto Python console with just eopy
.eopy
file supports esperanto python syntax (syntax with keywords like importi
(import) and functions like presi
(print)) in additional to normal Python syntax.
To import .eopy
files into your .py
file:
from esperanto_python import create_hook
create_hook(run_module=False, console=False) # without running main module or starting repl
import my_file # now you can import .eopy files
or to start eopy repl from normal repl:
from esperanto_python import create_hook
create_hook(run_module=True, console=True) # *with* starting repl
esperanto-python
supports jupyter and ipython intercative console by ipython extension.
To use it, install jupyter-notebook with pip install notebook
and start with jupyter notebook
.
In the first cell enter the text %load_ext esperanto_python
and press Ctrl+Enter and then you can use esperanto-python in the notebook.
esperanto-python depends on the python libraries:
- friendly - for more friendly english traceback
- ideas - most of this library is built on this project. It support easy creation of import hooks and it has a simple example for replacing keywords to French keywords
On all errors, problems or suggestions please open a github issue
JolonB forked from matan-h/hebrew-python
This project is licensed under the BSD-4 License.