anvil-works / anvil-runtime

The runtime engine for hosting Anvil web apps
https://anvil.works/open-source
Other
874 stars 116 forks source link

Show component attributes #58

Open meatballs opened 2 years ago

meatballs commented 2 years ago

Any chance of having the attributes of each class in https://github.com/anvil-works/anvil-runtime/blob/master/downlink/python/anvil/_components.py (or a corresponding .pyi file)?

When working offline, this would enable auto-completers to offer more than just the __init__ parameters for a component.

meatballs commented 2 years ago

More in hope than expectation, I tried running stubgen but just got:

from . import _server, server as server

class Component(_server.SerializeWithIdentity):
    def __init__(self, __ignore_property_exceptions: bool = ..., **props) -> None: ...
    def __deserialize__(self, data, global_data) -> None: ...
    def __serialize_once__(self, global_data): ...

class Container(Component):
    def __init__(self, __ignore_property_exceptions: bool = ..., **props) -> None: ...
    def add_component(self, c, **lp) -> None: ...

class ComponentTag: ...
class Button(Component): ...
class Canvas(Component): ...
class CheckBox(Component): ...
class ColumnPanel(Container): ...
class DataGrid(Container): ...
class DataRowPanel(Container): ...
class DatePicker(Component): ...
class DropDown(Component): ...
class FileLoader(Component): ...
class FlowPanel(Container): ...
class GoogleMap(Container): ...
class GridPanel(Container): ...
class HtmlTemplate(Container): ...
class Image(Component): ...
class Label(Component): ...
class LinearPanel(Container): ...
class Link(Container): ...
class Plot(Component): ...
class RadioButton(Component): ...
class RepeatingPanel(Component): ...
class RichText(Container): ...
class Spacer(Component): ...
class TextArea(Component): ...
class TextBox(Component): ...
class Timer(Component): ...
class XYPanel(Container): ...
class YouTubeVideo(Component): ...

which didn't really add anything new!

meatballs commented 2 years ago

If the only realistic wayto do this is to create a pyi file manually, I'll put a PR together.

But, given that the file says it's autogenerated, I wondered if there's some way to automate this.