microsoft / microsoft/Qcodes

Docstrings for parameters

Open
#246 0 comments 0 reactions 0 assignees View on GitHub
discussion
Dominant language
Python
Stars
459
Forks
359
Avg merge
3d 6h
Merged PRs (30d)
73

Description

Given a situation like the following:

``` python
# foo driver,pseudo code
self.add_parameter('foo',
label='foo',
set_cmd='bar',
set_parser=self._set_input_config,
)

def _set_input_config(self, s):
if s in ['baz']:
self.foo.set_validator(self._VOLT_ENUM)
self._set_units('V')
else:
self.foo.set_validator(self._CURR_ENUM)
self._set_units('A')

```

The question is then how to document the parameter foo?

The same would be if one adds a foo{bar} parameter depending on some response of another parameter right ?

Two solutions not mutally exclusive:
- docstring that describe "dynamically" the parameters (may be not trivial to implement)
- describe all the possible behaviors of the parameter.

I can't come up with a docstring example for the latter case though.

Also we should just decide on what's the best, not what's doable at the moment with the current architecture.

@alexcjohnson @MerlinSmiles @Rubenknex @AdriaanRol write your opinions (tagged because you were part of the discussion in #139 .

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the parameter example in this issue and the earlier discussion in #139. Determine how dynamically changing parameters should be represented in docstrings, including dependent foo{bar} parameters, and establish an agreed documentation approach covering all possible behaviors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.