holoviz / holoviz/param

Code completion when a parameterized class implements an __init__ method

Open
#1,068 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
521
Forks
86
Avg merge
1d 13h
Merged PRs (30d)
35

Description

#### Is your feature request related to a problem? Please describe.

I'm opening this issue/future request as suggested [in this post](https://discourse.holoviz.org/t/code-completion-with-param-when-a-class-implements-the-init-method/8877/2).

I am implementing a class which requires the `__init__` method to accept some arguments. The only issue is that by implementing it, I lose the code completion capability (at least in Jupyter Notebook, where I do have code completion turned on). Here is an example:

```py
import param
class Test(param.Parameterized):
first_param = param.Integer(default=2, doc="first")
second_param = param.Dict(default={}, doc="second")
third_param = param.Selector(default="a", objects=["a", "b", "c"], doc="third")

def __init__(self, *args, **kwargs):
super().__init__(**kwargs)
```

If you type `Test(first_` in a new cell, no completion is shown. If you comment out the `__init__` method, code completion works fine.

#### Describe the solution you'd like

Regardless of the arguments written in the `__init__` method, I would like to be able to use code completion on parameters that are created with `param`.

#### Describe alternatives you've considered

None, because I am attempting to refactor an existing module and I would like to maintain back-compatibility for as much as possible.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.