Add exceptions to modules
Open
Nobody has claimed this yet.
1.0-candidate
Good First Issue
needs-design
- Dominant language
- Rust
- Stars
- 16.2k
- Forks
- 1k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 66
Description
After creating a new exception using:
create_exception!(my_module, MyException, ExceptionClass);
It is natural that I would want to make it available as an import within my python module:
from my_module import MyException
However, in order to do this, I had to do some deep Kung Foo action:
#[pymodule]
fn my_module(py: Python, m: PyModule) {
m.add("MyException", py.get_type::<MyException>())?;
}
It would be nice to have an easier API for this:
#[pymodule]
fn my_module(_py: Python, m: PyModule) {
m.add_exception::<MyException>()?;
}
Contributor guide
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 reading the create_exception! macro and the #[pymodule] API shown in the issue to understand how exception types are currently exposed. Implement an add_exception API that supports the demonstrated import, then verify that MyException can be imported from my_module and that existing exception creation remains functional.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100