mopidy-debugrel
Mopidy extension that provides a Read-Eval loop over http, for debugging purpose.
Warning: enabling this extension leaves your server vulnerable, make sure mopidy is not exposed to the web when enabling it, and disable it when you are done.
Installation
Install by running:
python3 -m pip install mopidy-debugrel
See https://mopidy.com/ext/debugrel/ for alternative installation methods.
Configuration
This extension is disabled by default. To enable it, add the following to your mopidy configuration file:
[debugrel]
enabled = true
# Adapt enabled_until to your needs
enabled_until = 2025-05-01
Usage
Overview
This extension exposes a single API endpoint, that will execute the python code that you pass in your request. For example:
import requests
MOPIDY_HOST = "localhost"
MOPIDY_PORT = "6680"
code = """
logger.info("hello")
"""
requests.post(f"http://{MOPIDY_HOST}:{MOPIDY_PORT}/debugrel/debug", json={"source": code})
Running this trigger the execution of code in mopidy, resulting in the following logs:
mopidy[1771]: INFO 2025-02-23 14:39:29,689 [1771:HttpServer] mopidy_debugrel
mopidy[1771]: hello
In the context of execution, you can access mopidy config with self.config, and mopidy core with self.core
Examples
Some examples of code that you can use.
- Access the backends
code = """
logger.info(self.core.backends.get())
"""
requests.post(f"http://{MOPIDY_HOST}:{MOPIDY_PORT}/debugrel/debug", json={"source": code})
Logs:
mopidy[1771]: INFO 2025-02-23 14:55:59,966 [1771:HttpServer] mopidy_debugrel
mopidy[1771]: [<ActorProxy for FileBackend (urn:uuid:55234968-8840-4618-8bdb-f990c084fcac), attr_path=()>, <ActorProxy for M3UBackend (urn:uuid:eb60e9fe-5db9-4d8f-8444-d586aaae8573), attr_path=()>, <ActorProxy for StreamBackend (urn:uuid:1050cc10-6178-4820-aaf8-d4ab14cec939), attr_path=()>, <ActorProxy for BookmarksBackend (urn:uuid:ade7e4bd-2130-421e-9c98-aadeeaa77863), attr_path=()>, <ActorProxy for TidalBackend (urn:uuid:6cbdb63d-b5a5-4bc5-8ceb-7511457ac98a), attr_path=()>]
- Instantiate a tidal backend
code = """
from mopidy_tidal.backend import TidalBackend
backend = TidalBackend(self.config, None)
logger.info(backend)
"""
requests.post("http://gidouille.local:6680/debugrel/debug", json={"source": code}) ```
Logs:
mopidy[1771]: INFO 2025-02-23 14:54:53,030 [1771:HttpServer] mopidy_debugrel
mopidy[1771]: TidalBackend (urn:uuid:b496ce6c-d856-4e37-939f-f311d067892d)
- Print config entries:
code = """
for key, value in self.config.items():
logger.info(f"{key}: {value}")
"""
requests.post("http://gidouille.local:6680/debugrel/debug", json={"source": code}) ```
Project resources
Development
Set up development environment
Clone the repo using, e.g. using gh:
gh repo clone sapristi/mopidy-debugrel
Enter the directory, and install dependencies using uv:
cd mopidy-debugrel/
uv sync
Making a release
To make a release to PyPI, go to the project's GitHub releases page and click the "Draft a new release" button.
In the "choose a tag" dropdown, select the tag you want to release or create a
new tag, e.g. v0.1.0. Add a title, e.g. v0.1.0, and a description of the changes.
Decide if the release is a pre-release (alpha, beta, or release candidate) or should be marked as the latest release, and click "Publish release".
Once the releease is created, the release.yml GitHub Action will automatically
build and publish the release to
PyPI.
Credits
- Original author: Mathias Millet
- Current maintainer: Mathias Millet
- Contributors
Metadata
Release files for mopidy-debugrel 1.0.1
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 |
|---|---|---|---|---|
| mopidy_debugrel-1.0.1.tar.gz | 9.7 kB | With provenance | Details for mopidy_debugrel-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mopidy_debugrel-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for mopidy_debugrel-1.0.1-py3-none-any.whl |
Total release size: 18.5 kB
Release files / mopidy_debugrel-1.0.1.tar.gz
| Download URL | mopidy_debugrel-1.0.1.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
95b2b4f175ea378eafdae2089fe434ed9f7ef13df7caf0ea0670bdab320602a7
|
|
BLAKE2b-256 checksum How to use checksums |
7a41e348e20f6bb99acd273e826f7ce29cb43616715d561243cdc356eb51f020
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 26, 2025.
Transparency logRelease files / mopidy_debugrel-1.0.1-py3-none-any.whl
| Download URL | mopidy_debugrel-1.0.1-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78056719c620cb536df092215ec7155aad0cc04a2eee83646012262a5571d58d
|
|
BLAKE2b-256 checksum How to use checksums |
161c1aa9f15612d8936bb5aaa3bd0bf4cae17a0a1786b82d72f5a87ff2b1345d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 26, 2025.
Transparency logSecurity for mopidy-debugrel 1.0.1
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for mopidy_debugrel-1.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 26, 2025.
Transparency logA 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.