A tool to automate the transformation of native python code to renpy code.
Project description
py2ren
A tool to automate the transformation of native python module to ren'py store module.
Requirements
- python >= 2.7
Installation
You can install with pip, pip install py2ren
Or you can download a py2ren release.
Usage
CLI usage
Located in the py2ren's parent folder, you can now use the command.
python -m py2ren path [options]
Positional argument:
- path: target transformation path.
Options:
- -o, --out: the output folder for the transformation result.
- -n, --name: the base module name, must not contain spaces.
- -il, --init-level: the init level for the init expression.
- -c, --config: path to the configuration file.
- -ad, --analyze-dependencies: flag to analyze internal modules on create config.
- -nks, --no-keep-structure: flag to disable keeping the module structure.
- -fc, --force-config: flag to force the creation of the configuration file.
- -h, --help: show the help message and exit
For example, if you have the following file:
def say_hello(name: str):
return "Hello, " + name + "."
And run the command
python -m py2ren sample.py -n sample_module
After the conversion, you will get:
init -1 python in sample_module:
def say_hello(name: str):
return "Hello, " + name + "."
py2ren does not remove type annotations, so if you want better compatibility with renpy projects, you should remove them.
Module usage
You can also use py2ren as a python module; and continuing with the previous example, you can obtain the same result by doing the following.
# this script is located in py2ren's parent folder
import py2ren
py2ren.convert("filename.py", ".", "sample_module")
Docs
You can read the docs here.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py2ren-1.1.0.tar.gz.
File metadata
- Download URL: py2ren-1.1.0.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5483207e9c0da19097114119e4a2f38c87f6eb16229163ccf688c5d4d127a6ef
|
|
| MD5 |
e1d9ae6fb8b10895857910d17f7ce6ca
|
|
| BLAKE2b-256 |
8b033015dc37a9dac4944e2fee7f24c6307d6248c04bb3a6dbeddfafbf7971da
|
File details
Details for the file py2ren-1.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: py2ren-1.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f47d8273890e1089d10791f7f0c7cb74d208b984e40d710826d2a4a7edda68ba
|
|
| MD5 |
c8a575bc0b54305e15c34c19e1deda08
|
|
| BLAKE2b-256 |
3a2d65bea6f1429381a2188987be0f1b6f1a9a1cd5f50d0caf4c82dcfcce19b1
|