holoviz / holoviz/param

Proposed improvements to script_repr

Open
#297 0 comments 1 reaction 0 assignees View on GitHub
component: "serialization" type-feature
Dominant language
Python
Stars
521
Forks
86
Avg merge
1d 13h
Merged PRs (30d)
35

Description

There are a few warts in how `script_repr` works that I think are due to its history starting with where it started in Topographica.

* Firstly, the only example of a toplevel entry point to generate a script that I have found so far is the one on [Simulation](https://github.com/ioam/topographica/blob/master/topo/base/simulation.py#L357). Param could offer a user friendly entry point that can add the import text at the top.

* Secondly, the `script_repr` method seems to skip the toplevel import and not fully qualified (e.g `"from %s import %s"` form is being used when historically we could have just done `import topo`). A fully qualified import is the safest thing in the general case.

* Thirdly, it looks like it is up to the downstream classes from param to append to the `imports` list appropriately. Can't the logic in [this branch](https://github.com/ioam/topographica/blob/master/topo/base/simulation.py#L366) be extended to support classes and objects (by looking up the corresponding class) in a general way that can be supported at the param level?

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.