Skip to main content

Python in Hindi

Project description

python_hindi

python_hindi is a Python library (with command-line utilities) for programming Python in Hindi. (Haan, Bhai possible hai!)

python_hindi runs in Python 3.6+

After downloading this library, you can write a script like:

# if-else

sankhya = poornank(niwesh("Ek sankhya daalein: "))
yadi (sankhya % 2) == 0:
    bol("{0} sam hai".format(sankhya))
anyatha:
    bol("{0} visam hai".format(sankhya))
# while loop

num = 0
jabtak num < 10:
    num += 1
    yadi (num % 2) == 0:
        jaari
    bol(num)
#for loop

languages = ['Swift', 'Python', 'Go', 'JavaScript']
pratyek language mein languages:
    bol(language)

Name the file kuchbhi.pyhi and run it with pyhi kuchbhi.pyhi.

You can also import other .pyhi and .py files from the main file:

aayat kuchbhi

Installing

To install with pip, type in the terminal:

and for non-errors support :

pip install python-hindi

This will create the command-line script: pyhi

Usage

You can run pyhi files with pyhi <file>

You can start the Hindi Python console with just pyhi

Example:

pyhi file.pyhi

.pyhi file syntax

.pyhi file supports Hindi Python syntax (syntax with keywords like aayat (import)
and functions like bol (print)) in addition to normal Python syntax.

Use from normal Python file/repl

You can use it as a library:

To import .pyhi files into your .py file:

from python_hindi import create_hook
create_hook(run_module=False, console=False) # without running the main module or starting the repl
import pyhi_module # now you can import .pyhi files

Or to start the REPL from the normal REPL:

from python_hindi import create_hook
create_hook(run_module=True, console=True) # *with* starting the repl

jupyter/ipython

python-hindi supports jupyter and ipython interactive console by IPython extension. To use:

Install Jupyter Notebook by: pip install notebook
Start Jupyter Notebook by: jupyter notebook. Then create a new Python 3 by the new button.

In the first cell, enter the text %load_ext python_hindi and press Ctrl + Enter.

Now you can write Hindi Python in the entire notebook.

Dependencies

python-hindi depends on the Python libraries:

  • friendly - for more friendly Hinglish(hindi in roman script) traceback

  • ideas - most of this library is built on this project. It supports easy creation of import hooks and it has a simple example for replacing keywords with French keywords

  • [rich] - rich is a Python library for rich text and beautiful formatting in the terminal.

Contribute

For all errors, problems, or suggestions, please open a GitHub issue

Author

Karan Singh

License

This project is licensed under the BSD-4 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_hindi-0.1.2.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

python_hindi-0.1.2-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file python_hindi-0.1.2.tar.gz.

File metadata

  • Download URL: python_hindi-0.1.2.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.5 Windows/10

File hashes

Hashes for python_hindi-0.1.2.tar.gz
Algorithm Hash digest
SHA256 99620ab6a05c5d7293037592ff2f7609b841ff0959dac363ee328c7674127e49
MD5 4bfcce410a0fbeff7d223e4b594452b8
BLAKE2b-256 1b9ec066a1aee104de9b7224746225b6195cbd97510273780a503e2fa7c36fc8

See more details on using hashes here.

File details

Details for the file python_hindi-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: python_hindi-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.5 Windows/10

File hashes

Hashes for python_hindi-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 77ad7e22cca1e7f519f4a177a13007a4b8b09361f97ab77f2e421f678871ae45
MD5 a6f580a1a09b40287b9fbb0e8b242a7e
BLAKE2b-256 180eb948e54d897112ba9745e54a2e5f127170a657fc007bd509f84df2846b7e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page