Metadata-Version: 2.4
Name: renpy-reindexer
Version: 1.0.0
Summary: Renumber Ren'Py save files after changing the slots-per-page layout.
Author-email: Your Name <you@example.com>
License: MIT
Project-URL: Homepage, https://github.com/yourusername/renpy-reindexer
Project-URL: Issues, https://github.com/yourusername/renpy-reindexer/issues
Keywords: renpy,visual-novel,save-files,cli
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Games/Entertainment
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Ren'Py Save Reindexer

Renumbers Ren'Py save files (`page-slot.save`, e.g. `2-4.save`) after you
change how many save slots fit on a page. Works on a save folder directly
or on a ZIP file containing a `saves/` folder.

## Build / install

From this folder:

```bash
pip install .
```

This installs the `renpy-reindex` command onto your PATH.

For local development without reinstalling on every change, use an editable
install instead:

```bash
pip install -e .
```

### Building a standalone executable (optional)

If you want a single `.exe`/binary you can hand to someone without Python
installed:

```bash
pip install pyinstaller
pyinstaller --onefile --name renpy-reindex -m renpy_reindexer.cli
```

The binary will show up under `dist/`.

## Usage

```bash
renpy-reindex <path> --old-slots <N> --new-slots <N> [options]
```

| Argument | Description |
|---|---|
| `input_path` | Save folder, or a ZIP containing a `saves/` folder |
| `-o, --old-slots N` | Slots per page under the old layout (required) |
| `-n, --new-slots N` | Slots per page under the new layout (required) |
| `--dry-run` | Preview renames only; nothing is written |
| `--no-backup` | Skip creating a `<dir>_backup` copy first |
| `-y, --yes` | Skip the confirmation prompt |
| `--version` | Print the version and exit |

### Examples

Preview what would change, going from 6 slots/page to 10:

```bash
renpy-reindex ./saves --old-slots 6 --new-slots 10 --dry-run
```

Actually do it, from a ZIP export, skipping the confirmation prompt:

```bash
renpy-reindex ./MyGameSaves.zip -o 6 -n 10 -y
```

## Publishing to PyPI

The name `renpy-reindexer` is currently available on PyPI. Before publishing,
open `pyproject.toml` and fill in your real name/email under `authors`, and
your GitHub repo URL under `[project.urls]` (or delete that section if you
don't have one).

1. **Create accounts** (skip any you already have):
   - https://pypi.org/account/register/
   - https://test.pypi.org/account/register/ (a sandbox — recommended for a
     first dry run so a mistake doesn't burn your real release)

2. **Create an API token** (don't use your account password directly):
   - PyPI: https://pypi.org/manage/account/token/ → scope it to this project
     once the name is registered, or "entire account" for the very first upload
   - TestPyPI has its own separate token page

3. **Build the distribution** (already done for you in `dist/`, but if you
   change the code, rebuild with):
   ```bash
   pip install build twine
   python -m build
   twine check dist/*
   ```

4. **Upload to TestPyPI first**:
   ```bash
   twine upload --repository testpypi dist/*
   ```
   You'll be prompted for a username and password — use `__token__` as the
   username and paste the full API token (starting `pypi-`) as the password.
   Then sanity-check the install from the sandbox:
   ```bash
   pip install --index-url https://test.pypi.org/simple/ renpy-reindexer
   ```

5. **Upload to the real PyPI**:
   ```bash
   twine upload dist/*
   ```
   Same `__token__` / API-token login, just against the real index.

6. **Install it anywhere**:
   ```bash
   pip install renpy-reindexer
   ```

To save credentials so you're not prompted every time, create `~/.pypirc`:
```ini
[pypi]
username = __token__
password = pypi-YOUR-TOKEN-HERE

[testpypi]
username = __token__
password = pypi-YOUR-TEST-TOKEN-HERE
```

**Releasing a new version later:** bump `version` in `pyproject.toml` (PyPI
rejects re-uploading the same version number), then repeat steps 3 and 5.

## Safety

By default, a full backup of the save directory is made (as
`<directory>_backup`) before anything is renamed. Renames happen in two
passes (old name → temp name → new name) so that slot numbers never
collide mid-run, and any failure partway through rolls back the temp
renames it already made.
