PyCheevos
PyCheevos is a set of tools to generate RetroAchievements achievement sets programmatically using Python.
Inspired by RATools and Cruncheevos, it allows you to leverage the full power of the Python ecosystem (loops, functions, classes) to build complex achievement logic with clean, readable code.
- Core: Handles condition parsing, memory addresses, arithmetic (
byte,word,delta) and logic helpers (reset_if,measured). Now supports logical operators (&,|,~) and f-strings for clean condition chaining and text formatting. - Models: Provides the structure for Sets, Achievements, Leaderboards, and Rich Presence (now supporting independent saving and tuple lookups).
- Utils: Contains the Smart Importer CLI that automatically maps Code Notes to Python variables, fetching data from local files or directly from the RetroAchievements server.
Installation
You can install PyCheevos directly from PyPI:
pip install pycheevos
Usage
Using this library assumes familiarity with the RetroAchievements workflow and memory inspection.
Quick Start with the Smart Importer
PyCheevos now includes a powerful CLI tool to scaffold your sets instantly.
Run the importer from any folder in your terminal:
pycheevos-import
Select Option 3 (Unified Import) to perform a "Smart Sync":
- Downloads Code Notes and generates a
notes.pyfile. - Downloads Achievements and generates an
achievements.pyfile. - Auto-Mapping: The generator automatically detects variable names from
notes.pyand uses them in your achievement logic (e.g.,health == 0x04instead ofbyte(0x1234) == value(4)).
Manual Scripting
Create a new .py file and import the library modules (models and core).
Run your script to generate an output folder containing your RA logic files ([ID]-User.txt).
You can change this output location by defining a path in the .save() function of AchievementSet.
Small Demo
from pycheevos.models.set import AchievementSet
from pycheevos.models.achievement import Achievement
from pycheevos.core.helpers import byte, prior, value, reset_if
from pycheevos.core.constants import AchievementType
# Initialize the set
game_set = AchievementSet(game_id=1, title="Sonic the Hedgehog")
# Define Memory Addresses
mem_rings = byte(0xFE20)
mem_zone = byte(0xFE10)
# Reusable Logic Function
def got_rings(amount):
"""Triggers when ring count increases to or past 'amount'."""
# Use '&' for AND, '|' for OR, '~' for NOT
# Use value() to wrap constant numbers safely (optional if comparing against memory)
return (mem_rings >= value(amount)) & (prior(mem_rings) < value(amount))
# Create Achievement
ach = Achievement(
title="Super Ring Collector",
description="Collect 1000 rings",
points=50,
id=111001,
type=AchievementType.PROGRESSION # Use Enum for safety
)
# Apply Logic
# New Syntax: You can chain logic directly using operators
ach.add_core(
got_rings(1000) & (mem_zone == 0) # Must be in Green Hill
)
# Add reset logic using the helper function
ach.add_core(
reset_if(mem_rings == 0)
)
game_set.add_achievement(ach)
# Generate the user file (1-User.txt)
game_set.save()
User Repositories
Contributing
You are welcome to report issues. If you run into errors generating the script, please include your Python version and the traceback.
You are welcome to request features. When doing so, please show how you would use the feature (pseudo-code) and what logic problem it solves.
The core library aims to be minimal. Complex logic specific to a single game should ideally be implemented in your own script using Python's flexibility, rather than hardcoded into the library core.
Pull Requests are welcome, especially for documentation improvements or type hinting fixes.
Metadata
Release files for pycheevos 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pycheevos-0.0.8.tar.gz | 33.5 kB | Without provenance | Details for pycheevos-0.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pycheevos-0.0.8-py3-none-any.whl | Python 3 | none | any | Details for pycheevos-0.0.8-py3-none-any.whl |
Total release size: 76.2 kB
Release files / pycheevos-0.0.8.tar.gz
| Download URL | pycheevos-0.0.8.tar.gz |
|---|---|
| Size | 33.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2aa98a1f860410ec050b1457d28f13297f0c79eb5f8f1b75191fb59ece898b72
|
|
BLAKE2b-256 checksum How to use checksums |
42f9cfdee3ed0d01e8a92cc0e3d66e2127976ae9475bd446f2165e597b87c5b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / pycheevos-0.0.8-py3-none-any.whl
| Download URL | pycheevos-0.0.8-py3-none-any.whl |
|---|---|
| Size | 42.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
539c89432ab1fdd9bd43c3be85a1ed0ce381d08eb0fefd5f4813019df320927b
|
|
BLAKE2b-256 checksum How to use checksums |
6a2507ec9ec13b2b6c15379e184a13010eb8d1057ffec85cf09d207030c634aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for pycheevos 0.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.