MattIPv4 / MattIPv4/PyDMXControl
Consider allowing outside module names for light definitions
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 143
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
At present, its difficult to add light definitions without contributing directly to the project since the validate_item function assumes the PyDMXControl.profiles. module name being present. Perhaps the code could be modified si that if the module is not found you search the broader namespace for the module before failing.
I plan to hopefully contribute to this projects codebase on a few fronts after I get done with my own testing. 😄
In the meantime, I found a work around. If one defines a light in a file called MyLight with a class of MyAwesomeLight, they can add this to their executing class:
test.py
import sys
from PyDMXControl.controllers import OpenDMXController
import MyLight
sys.modules['PyDMXControl.profiles.MyLight'] = MyLight
dmx.json.load_config('light_config.json')
light_config.json
[
{
"type": "MyLight.MyAwesomeLight",
"args": [],
"name": "Light 1",
"start_channel": 1
},
{
"type": "MyLight.MyAwesomeLight",
"args": [],
"name": "Light 2",
"start_channel": 8
}
]
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing validate_item and the dmx.json.load_config entry point to see how the PyDMXControl.profiles. module is resolved. Define the fallback lookup behavior for externally defined modules, then verify that light_config.json entries such as MyLight.MyAwesomeLight load without the sys.modules workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100