Support file-path syntax (path/to/module.py:config) as alternative to dotpath in pconfigs.run
- Dominant language
- Python
- Stars
- 1
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
**Summary**
Add support for file-path syntax in `pconfigs.run`, allowing users to specify configs as `path/to/module.py:config_name` in addition to the existing dotpath syntax `path.to.module.config_name`.
**Motivation**
Code editors make it trivial to copy the file path to a module (e.g., via "Copy Relative Path"), but converting that path to a dotpath requires manual effort: replacing `/` with `.`, stripping the `.py` extension, and prepending the repo package root. This friction is a daily papercut when iterating on experiments. The file-path syntax would let users copy a path directly from their editor and paste it into the run command without any transformation.
**Proposed behavior**
The runner accepts a colon-delimited file path and config name:
```bash
# New syntax — file path with colon-separated config name
python -m pconfigs.run path/to/pconfig/module.py:config
# Existing syntax — unchanged
python -m pconfigs.run path.to.pconfig.module.config
```
The runner detects which form is being used by checking whether the argument contains a `/` or ends in `.py` (before the `:`). If the file-path form is detected, the runner imports the module from the given path and looks up the named attribute (`config` in the example above). If no `:name` is given, the runner could default to `config` (the conventional instance name) or raise a clear error asking the user to specify one.
**Current workaround**
Manually convert the file path to a dotpath before running:
```bash
# File path from editor: genrg/pconfig/foo/bar.py
# Must be converted to:
python -m pconfigs.run genrg.pconfig.foo.bar.config
```
Contributor guide
Research direction
Start at the pconfigs.run command entry point and read how the existing dotpath argument is parsed and imported. Add support for path/to/module.py:config while preserving dotpath behavior, then verify that the runner imports the file and resolves the named attribute; decide from the project's conventions how a missing :name should be reported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 67/100