Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

reapy

reapy is a nice pythonic wrapper around the quite unpythonic ReaScript Python API for REAPER.

Contents

  1. Installation
  2. Usage
  3. Contributing
  4. Author
  5. License

Installation

  1. First install from pip:
pip install python-reapy
  1. Run:
python -m reapy

Paths to your Python DLL and to reapy configuration scripts get printed.

  1. If you haven't enabled Python in REAPER yet, go to Options > Preferences... > Plug-ins > ReaScript. Check Enable Python for use with ReaScript, and fill Custom path to Python dll directory and Force ReaScript to use specific Python .dll with the directory path and the file name of the Python DLL.

  2. Enable reapy dist API by running the corresponding ReaScript (Actions > Show action list > Reascript : Load... and browse for the script path).

You're all set! You can now import reapy from inside or outside REAPER as any standard Python module.

Instead of creating a new ReaScript containing:

from reaper_python import *
RPR_ShowConsoleMsg("Hello world!")

you can open your usual Python shell and type:

>>> import reapy
>>> reapy.print("Hello world!")

Usage

ReaScript API

All ReaScript API functions are available in reapy in the sub-module reapy.reascript_api. Note that in ReaScript Python API, all function names start with "RPR_". That unnecessary pseudo-namespace has been removed in reapy. Thus, you shall call reapy.reascript_api.GetCursorPosition in order to trigger reaper_python.RPR_GetCursorPosition. See example below.

>>> from reapy import reascript_api as RPR
>>> RPR.GetCursorPosition()
0.0
>>> RPR.SetEditCurPos(1, True, True)
>>> RPR.GetCursorPosition()
1.0

reapy API

The purpose of reapy is to provide a more pythonic API as a substitute for ReaScript API. Below is the reapy way of executing the example above.

>>> import reapy
>>> project = reapy.Project() # Current project
>>> project.cursor_position
0.0
>>> project.cursor_position = 1
>>> project.cursor_position
1.0

The translation table matches ReaScript functions with their reapy counterparts.

Performance

When used from inside REAPER, reapy has almost identical performance than native ReaScript API. Yet when it is used from the outside, the performance is quite worse. More precisely, since external API calls are processed in a defer loop inside REAPER, there can only be around 30 to 60 of them per second. In a time-critical context, you should make use of the reapy.inside_reaper context manager.

>>> import reapy
>>> project = reapy.Project() # Current project
>>> # Unefficient (and useless) call
>>> bpms = [project.bpm for _ in range(1000)] # Takes at least 30 seconds...
>>> # Efficient call
>>> with reapy.inside_reaper():
...     bpms = [project.bpm for _ in range(1000)]
...
>>> # Takes only 0.1 second!

More

Check the documentation and especially the API guide for more information.

Contributing

For now, about a third of ReaScript API has a reapy counterpart, the docs are far from great, and many bugs are waiting to be found. Feel free to improve the project by checking the contribution guide!

Author

Roméo Després - RomeoDespres

License

This project is licensed under the MIT License - see the LICENSE.txt file for details.

Metadata

Release files for python-reapy 0.1.0.dev5

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

Source distribution (sdist)

Source distribution for python-reapy 0.1.0.dev5
File Size Uploaded
python-reapy-0.1.0.dev5.tar.gz 27.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-reapy 0.1.0.dev5
File Interpreter ABI Platform
python_reapy-0.1.0.dev5-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 68.7 kB

Release files / python-reapy-0.1.0.dev5.tar.gz

Download URL python-reapy-0.1.0.dev5.tar.gz
Size 27.7 kB
Tags Source
SHA-256 checksum
How to use checksums
01569eac9d9173ca4d87b2230b5c706fbb17effd9ab83a3087f7108d9a86353e
BLAKE2b-256 checksum
How to use checksums
478c3ebe91b6fdbd30d71c873b6fbbe4cbd1efcd5bb48388b447861a88fa017a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / python_reapy-0.1.0.dev5-py2.py3-none-any.whl

Download URL python_reapy-0.1.0.dev5-py2.py3-none-any.whl
Size 41.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e285e1feb7ae5b60f83c86dcfeb751db9bff274ddea93ec709d9f8ebc7479859
BLAKE2b-256 checksum
How to use checksums
2c92a29cbc6f063bf1e22173b1ec1f0bbac5254e390d3966296b30a9d0f6d6fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
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