Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Improve documentation for cards #2054

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

romain-intel
Copy link
Contributor

Also removes dangerous default values

Also removes dangerous default values
metaflow/plugins/cards/card_modules/components.py Outdated Show resolved Hide resolved
@@ -179,18 +206,23 @@ def __init__(
@classmethod
def from_dataframe(
cls,
dataframe=None,
dataframe: Optional["pandas.DataFrame"] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dataframe: Optional["pandas.DataFrame"] = None,
dataframe:"pandas.DataFrame",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I applied it but this does change the current UX. I agree the None made no sense but just mentioning.

metaflow/plugins/cards/card_modules/components.py Outdated Show resolved Hide resolved
def __init__(self, src=None, label=None, disable_updates: bool = True):
def __init__(
self,
src: Optional[bytes] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
src: Optional[bytes] = None,
src: bytes,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

metaflow/plugins/cards/card_modules/components.py Outdated Show resolved Hide resolved
metaflow/plugins/cards/card_modules/components.py Outdated Show resolved Hide resolved
self._text = text

def __init__(self, text=None):
def __init__(self, text: Optional[str] = None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def __init__(self, text: Optional[str] = None):
def __init__(self, text: str):

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

@@ -770,19 +882,32 @@ class VegaChart(UserComponent):

REALTIME_UPDATABLE = True

def __init__(self, spec: dict, show_controls: bool = False):
def __init__(
self, spec: Union[Dict[Any, Any], "altair.Chart"], show_controls: bool = False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self, spec: Union[Dict[Any, Any], "altair.Chart"], show_controls: bool = False
self, spec: Dict[Any, Any], show_controls: bool = False

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit confused here. Can't it take an altair.Chart like the update method?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a class method for that.


Parameters
----------
spec : Union[Dict[Any, Any], altair.Chart]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
spec : Union[Dict[Any, Any], altair.Chart]
spec : Dict[Any, Any]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants