Skip to content

Commit aca027f

Browse files
committed
Restructure project directories and files; turn into installable package; turn into PyPI compatible package; allow importing; Update README.md
1 parent dc7325a commit aca027f

15 files changed

Lines changed: 252 additions & 66 deletions

File tree

.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

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Write simple Python in Urdu.
99
## How to Install
1010
1. Download this repo as a ZIP, or clone it via Git.
1111
2. Open the repo's folder in your Terminal.
12-
3. Run ```pip install -r requirements.txt```
12+
3. Run ```pip install -e .```
1313

1414
## How to Use
1515
1. Create a new file in a folder.
@@ -71,9 +71,9 @@ would be
7171
```
7272

7373
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>```
74+
4. Run the code in one command: ```urdupython <NAME_OF_YOUR_FILE>```
7575

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

7878
## Guide
7979
### For macOS
@@ -85,3 +85,4 @@ Download and install Notepad++. Right click and activate RTL (Right-to-left).
8585
## Tests
8686
### Platform(s) tested on
8787
macOS Big Sur 11.1
88+
Termux (Android)

samples/hi/सशर्त.hi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
अन्यथाअगर कुछ == २:
88
लिखो ("दुनिया")
99
अन्यथा:
10-
लिखो ("मुझे समझ नहीं आया...")
10+
लिखो ("मुझे समझ नहीं आया...")

setup.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# References:
2+
# - https://stackoverflow.com/questions/27494758/how-do-i-make-a-python-script-executable
3+
4+
from setuptools import setup
5+
setup(
6+
name='urdupython',
7+
version='0.0.2',
8+
author='Saad Bazaz',
9+
author_email='saadbazaz@hotmail.com',
10+
url='https://github.com/saadbazaz/UrduPython',
11+
packages=['urdupython'],
12+
13+
entry_points={
14+
'console_scripts': [
15+
'urdupython=urdupython.urdu_python:main',
16+
'اردوپایتھان=urdupython.urdu_python:main'
17+
'اردوپای=urdupython.urdu_python:main'
18+
]
19+
}
20+
)

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)

urdu_python.py

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

urdupython/__init__.py

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

urdupython/filters/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)