Metadata-Version: 2.4
Name: noythp
Version: 0.2.1
Summary: 🔄 NOYTHP — Python 倒着写
Author: NOYTHP 设计委员会
Author-email: noreply@noythp.dev
License: MIT
Project-URL: Homepage, https://github.com/noythp/noythp
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Interpreters
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Dynamic: author-email
Dynamic: requires-python

# 🔄 NOYTHP

> Python 倒着写。

每个关键字都反转：`print` → `tnirp`，`def` → `fed`，`return` → `nruter`。

```
tnirp("llehs emosewA")
tnirp("nohtyp esrever si NOYTHP")
```

## 安装

```bash
pip install noythp
```

## 用法

### 方式一：写 .noythp 文件

`hello.noythp`：

```python
# 所有关键字倒着写！
fed mooT(name):
    tnirp("olleH, " + name)
    nruter name
```

在 Python 里 import：

```python
import noythp      # 加载运行时
import hello       # 自动找 hello.noythp

hello.mooT("world")  # → "olleH, world"
```

### 方式二：直接转译

```python
import noythp

code = noythp.transpile('tnirp("!nohtyp esrever")')
exec(code)
```

### 方式三：命令行

```bash
python -m noythp hello.noythp
```

## 关键字映射

```
Python     →  NOYTHP
───────        ──────
def            fed
return         nruter
if             fi
else           esle
elif           fi-ekorb  # cool points
for            rof
in             ni
while          elihw
True           eurT
False          eslaF
None           enoN
class          ssalc
self           fles
try            yrt
except         tpecex
finally        yllanif
raise          esiar
continue       enituoc
break          kaerb
import         tropmi
from           morf
as             sa
and            dna
or             ro
not            ton
is             si
pass           ssap
with           htiw
yield          dleiy
global         labolg
lambda         adbmal
```

## 内置函数映射

```
print    →  tnirp
range    →  egnar
len      →  nel
int      →  tni
float    →  taolf
str      →  rts
list     →  tsil
dict     →  tcid
input    →  tupni
sorted   →  detros
max      →  xam
min      →  nim
sum      →  mus
abs      →  sba
append   →  dneppa
```

## 完整示例

```python
# 猜数字游戏
fed ssaGuG():
    tupni("rebmun a ssaGuG :")
    tropmi mhtirogla
    tegGuG = tni(tupni())
    fi tegGuG == 42:
        tnirp("!tcerroC")
        kaerb
    esle:
        tnirp("!gnorW")
```

## 注意

- 变量名不要用反转关键字（`ni`、`ton`、`ro`、`si` 等会被转译）
- 字符串内容正常写，不受影响
- 扩展名：`.noythp`、`.phty`

## 原理

Import Hook 拦截模块加载 → 反转关键字替换 → 生成标准 Python → 执行。纯 Python，零依赖。
