google-deepmind / google-deepmind/mujoco
Python bindings do not work well with type checkers
- Dominant language
- C++
- Stars
- 15.2k
- Forks
- 1.8k
- Avg merge
- 10d 16h
- Merged PRs (30d)
- 25
Description
Hello,
### Problem
in the [intro page of python bindings](https://mujoco.readthedocs.io/en/latest/python.html#minimal-example), example has following code:
`model = mujoco.MjModel.from_xml_string(XML, ASSETS)`
It triggers a warning in pycharm type checker: "Parameter 'assets' unfilled", because as of mujoco 2.1.5 the type hint for `from_xml_string` thinks it's not a static method:
```python
def from_xml_string(self, xml, assets, Dict=None, p_str=None, bytes=None, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__
"""
from_xml_string(xml: str, assets: Optional[Dict[str, bytes]] = None) -> mujoco._structs.MjModel
Loads an MjModel from an XML string and an optional assets dictionary.
"""
pass
```
### Motivation for fixing this
To avoid bugs in the code, I want to use type checkers with mujoco python bindings.
----
Is there a way to ship correct signatures?
Contributor guide
Assessment
This issue has not been assessed yet.