ni / ni/nimi-python

Implementation of __repr__ for custom types should be updated to use `__module__` and `__qualname__`

Open
#1,443 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

source-breaker
Dominant language
Python
Stars
128
Forks
110
Avg merge
5d 14h
Merged PRs (30d)
10

Description

Description of issue

Best practice for implementing __repr__ for custom types is to use
__module__ and __qualname__.

By including __module__ in __repr__, eval(repr(CustomType()))
can be called by importing nimi-python module as import nixyz; which is
consistent with recommended import style of nimi-python.

Related issue for making similar change in nifake: #1444.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the custom-type repr implementations across the nimi-python source and identify whether the same pattern is repeated across instrument APIs. Update the representations to use module and qualname, then verify that eval(repr(CustomType())) works when the module is imported as nixyz.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.