Skip to content

Commit 381219b

Browse files
committed
Merge branch 'مرکز' of https://github.com/SaadBazaz/UrduPython into مرکز
2 parents 20db2c7 + 4336cf3 commit 381219b

38 files changed

Lines changed: 435 additions & 75 deletions

.gitignore

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,92 @@
1+
2+
# Repo specific
3+
/dist/
4+
/build/
5+
/MANIFEST
6+
7+
__pycache__/
8+
.DS_Store
9+
node_modules
10+
11+
# local env files
12+
.env.local
13+
.env.*.local
14+
15+
.env
16+
17+
# Log files
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*
21+
pnpm-debug.log*
22+
23+
24+
# Python compiled files
25+
*.save
26+
*.pyc
27+
*.py~
28+
/__pycache__
29+
**/*.pyc
30+
31+
# compiled output
32+
/target
33+
34+
# dependencies
35+
/node_modules
36+
37+
# profiling files
38+
chrome-profiler-events*.json
39+
speed-measure-plugin*.json
40+
41+
# IDEs and editors
42+
/.idea
43+
.project
44+
.classpath
45+
.c9/
46+
*.launch
47+
.settings/
48+
*.sublime-workspace
49+
50+
# IDE - VSCode
51+
.vscode/*
52+
!.vscode/settings.json
53+
!.vscode/tasks.json
54+
!.vscode/launch.json
55+
!.vscode/extensions.json
56+
.history/*
57+
58+
# misc
59+
/.sass-cache
60+
/connect.lock
61+
/.coverage
62+
/libpeerconnection.log
63+
npm-debug.log
64+
yarn-error.log
65+
testem.log
66+
/typings
67+
68+
# System Files
69+
.DS_Store
70+
Thumbs.db
71+
72+
# Cached files? Came up while working on ssh in VS Code
73+
._*
74+
/*/._*
75+
**/._*
76+
77+
178
*/.DS_Store
279
*/__pycache__
380

481
__pycache__
582
.DS_Store
683

7-
compiled.en.py
84+
*.pem
85+
mycert.pem
86+
87+
compiled.en.py
88+
89+
/results
90+
91+
*.egg-info
92+
*.egg

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include urdupython/languages/*/*.yaml

README.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
# UrduPython
2-
Write simple Python in Urdu.
2+
> Ever had that random thought of programming in Urdu? Well, you're at the right place.
3+
4+
Programming Language in Urdu, based on Python - اردو میں کوڈ لکھیں
35

46
## Pre-requisites
57
- Python 3+
68
- Pip
79
- (optional but recommended) Virtual environment, like ```conda``` or ```virtualenv```
810

911
## How to Install
12+
### Pip
13+
If you've installed ```pip```, you can install UrduPython from [Test PyPI](https://test.pypi.org/project/urdupython/) using the following command:
14+
```
15+
pip install -i https://test.pypi.org/pypi/ --extra-index-url https://pypi.org/simple urdupython
16+
```
17+
18+
### Source
1019
1. Download this repo as a ZIP, or clone it via Git.
1120
2. Open the repo's folder in your Terminal.
12-
3. Run ```pip install -r requirements.txt```
21+
3. Run ```pip install -e .```
1322

1423
## How to Use
1524
1. Create a new file in a folder.
@@ -69,19 +78,25 @@ would be
6978
```
7079
لکھو ("Hello world!")
7180
```
81+
There are many more sample codes available [here](./urdupython/samples)
7282

7383
3. Open a Terminal in the folder of this file.
74-
4. Run the code in one command: ```python urdu_python__ply.py <NAME_OF_YOUR_FILE>```
84+
4. Run the code in one command: ```urdupython <NAME_OF_YOUR_FILE>```
7585

76-
For more help, run ```python urdu_python__ply.py --help```. For better understanding, do run the sample code files in the "samples" folder.
86+
For more help, run ```urdupython --help```. For better understanding, do run the sample code files in the "samples" folder.
7787

7888
## Guide
7989
### For macOS
8090
Use TextEdit (default text editor) to write Urdu code. Activate right-to-left typing through Menu: Format->Text->Writing Direction->Right-to-Left
8191

82-
### For Linux/Windows
92+
### For Windows
8393
Download and install Notepad++. Right click and activate RTL (Right-to-left).
8494

95+
### For Linux
96+
Open gEdit (or any similar text-editing program), and start coding right away.
97+
8598
## Tests
8699
### Platform(s) tested on
87-
macOS Big Sur 11.1
100+
- macOS Big Sur 11.1
101+
- Termux (Android)
102+
- Ubuntu 20.04.3 LTS

setup.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# References:
2+
# - https://stackoverflow.com/questions/27494758/how-do-i-make-a-python-script-executable
3+
4+
import os
5+
from setuptools import setup, find_packages
6+
7+
files = ["samples/*/*", "languages/*/*.yaml"]
8+
9+
10+
with open('requirements.txt') as f:
11+
required = f.read().splitlines()
12+
13+
setup(
14+
name='urdupython',
15+
version='0.0.9',
16+
author='Saad Bazaz',
17+
author_email='saadbazaz@hotmail.com',
18+
url='https://github.com/saadbazaz/UrduPython',
19+
20+
install_requires=required,
21+
# packages=['urdupython', 'modes', 'filters', 'languages'],
22+
packages=find_packages(),
23+
package_data = {'urdupython' : files },
24+
25+
entry_points={
26+
'console_scripts': [
27+
'urdupython=urdupython.urdu_python:main',
28+
'اردوپایتھان=urdupython.urdu_python:main',
29+
'اردوپای=urdupython.urdu_python:main'
30+
]
31+
}
32+
)

test/test_input.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
input("Enter anything")

test/test_pkg.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# -*- coding: utf-8 -*-
2+
from urdupython import run_module
3+
4+
print ("Imported successfully.")
5+
6+
import os
7+
8+
code = r"""
9+
10+
کچھ = ۱
11+
لکھو("سلام دنیا")
12+
13+
"""
14+
15+
compiled_code = run_module(
16+
mode = "lex",
17+
code = code,
18+
args = {
19+
'translate': False,
20+
'dictionary': '../languages/ur/ur_native.lang.yaml',
21+
'reverse': False,
22+
'keep': False,
23+
'keep_only': False,
24+
'return': True,
25+
},
26+
)
27+
print ("Original code is:\n", code)
28+
print ('--------------------------------')
29+
print ("Compiled code is:\n", compiled_code)

test/test_shell.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# # client.py
2+
# # import socket
3+
4+
# import subprocess
5+
6+
# from threading import Thread
7+
# from time import sleep
8+
9+
10+
# # s = socket.socket()
11+
# # s.connect(('localhost', 1337))
12+
# popen = None
13+
14+
# def execute(cmd):
15+
# print ("im here")
16+
# popen = subprocess.Popen(cmd,
17+
# stdin=subprocess.PIPE,
18+
# stdout=subprocess.PIPE, universal_newlines=True)
19+
# for stdout_line in iter(popen.stdout.readline, ""):
20+
# yield stdout_line
21+
# popen.stdout.close()
22+
# return_code = popen.wait()
23+
# if return_code:
24+
# raise subprocess.CalledProcessError(return_code, cmd)
25+
26+
# # Example
27+
28+
# def output_loop():
29+
# for path in execute(["python"]):
30+
# print(path, end="")
31+
32+
# # Example
33+
# # await execute("python")
34+
# # print(path, end="")
35+
36+
# if __name__ == "__main__":
37+
38+
# input ("First input")
39+
40+
# thread = Thread(target = output_loop)
41+
42+
43+
# thread.start()
44+
# thread.join()
45+
46+
# sleep(2)
47+
# # popen.communicate(str(input("I am here")).encode('utf-8'))
48+
# popen.stdin.write(str(input("I am here").encode('utf-8')))
49+
# sleep(2)
50+
51+
# print("thread finished...exiting")
52+
53+
54+
# # popen = subprocess.Popen(['python',], stdout=subprocess.PIPE, universal_newlines=True)
55+
# # for stdout_line in iter(popen.stdout.readline, ""):
56+
# # yield stdout_line
57+
# # popen.communicate(str(input()).encode('utf-8'))
58+
# # popen.stdout.close()
59+
60+
# # while (process.wait()):
61+
# # process.communicate(str(input()).encode('utf-8'))
62+
63+
64+
65+
#from subprocess import Popen, PIPE
66+
67+
#p1 = Popen(['python'],stdin=PIPE, stdout=PIPE)
68+
# # p2 = Popen(['sed', '/^$/d'], stdin=p1.stdout, stdout=PIPE)
69+
# # p3 = Popen(['awk', 'NR > 1 { print $2 }'], stdin=p2.stdout, stdout=PIPE)
70+
71+
#p1.stdin.write("print('hello world!')".encode('utf-8'))
72+
73+
#p1.wait()
74+
# stdout, _ = p1.communicate()
75+
76+
77+
78+
79+
80+
#!/usr/bin/env python3
81+
import time
82+
#from subprocess import Popen, PIPE
83+
import subprocess
84+
85+
proc = subprocess.Popen("python", stdin=subprocess.PIPE)
86+
#while (proc.poll() is None):
87+
proc.stdin.write("print('hello world!!')".encode('utf-8')) # etc
88+
#time.sleep(4)

urdu_python.py

Lines changed: 0 additions & 49 deletions
This file was deleted.

urdupython/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env python
2+
"""
3+
UrduPython.
4+
5+
Python, but in Urdu.
6+
"""
7+
8+
__author__ = 'Saad Bazaz'
9+
__credits__ = 'Grayhat'
10+
__url__ = 'https://github.com/saadbazaz/UrduPython'
11+
12+
from .urdu_python import *

urdupython/filters/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)