Skip to main content

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.

Metadata

Release files for py2ren 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py2ren 1.1.0
File Size Uploaded
py2ren-1.1.0.tar.gz 19.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py2ren 1.1.0
File Interpreter ABI Platform
py2ren-1.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 43.6 kB

Release files / py2ren-1.1.0.tar.gz

Download URL py2ren-1.1.0.tar.gz
Size 19.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5483207e9c0da19097114119e4a2f38c87f6eb16229163ccf688c5d4d127a6ef
BLAKE2b-256 checksum
How to use checksums
8b033015dc37a9dac4944e2fee7f24c6307d6248c04bb3a6dbeddfafbf7971da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.2

Release files / py2ren-1.1.0-py2.py3-none-any.whl

Download URL py2ren-1.1.0-py2.py3-none-any.whl
Size 24.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
f47d8273890e1089d10791f7f0c7cb74d208b984e40d710826d2a4a7edda68ba
BLAKE2b-256 checksum
How to use checksums
3a2d65bea6f1429381a2188987be0f1b6f1a9a1cd5f50d0caf4c82dcfcce19b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.2

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page