A Hello world metaflow card
Project description
Hello World Metaflow Card
This repository is an example hello world card.
You can install this card via :
pip install metaflow-card-helloworld
How to use a helloworld card
@card(type='helloworld',options={"attribute":"html"})
@step
def train(self):
...
...
self.html = some_html() # set some html to the self attribute
How to implement custom card module
The core namespace package name is metaflow_extensions
. Any new custom MetaflowCard should be present inside a folder with the following directory structure:
some_random_dir/ # the name of this dir doesn't matter
├ setup.py
├ metaflow_extensions/ # namespace package name
│ └ organizationA/ # NO __init__.py file as it is a namespace package.
│ └ plugins/ # NO __init__.py file
│ └ cards/ # NO __init__.py file # This is a namespace package.
│ └ my_card_module/ # Name of card_module
│ └ __init__.py. # This is the __init__.py is required to recoginize `my_card_module` as a package
│ └ somerandomfile.py. # Some file as a part of the package.
.
The __init__.py
of the metaflow_extensions.organizationA.plugins.cards.my_card_module
, requires a CARDS
attribute which needs to be a list
of objects inheriting MetaflowCard
class. For example, the below __init__.py
file exposes a MetaflowCard
of type
"y_card2".
from metaflow.cards import MetaflowCard
class YCard(MetaflowCard):
type = "y_card2"
ALLOW_USER_COMPONENTS = True
def __init__(self, options={}, components=[], graph=None):
self._components = components
def render(self, task):
return "I am Y card %s" % '\n'.join([comp for comp in self._components])
CARDS = [YCard]
Having this metaflow_extensions module present in the python path of your flow will make the cards usable within the flow.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file metaflow-card-1.0.0.tar.gz
.
File metadata
- Download URL: metaflow-card-1.0.0.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 712489ea9a2e93c0f0cbabf208e6e5f1e412b561795f7c26396755e9f2b1b6c3 |
|
MD5 | 17b71d2f11d6ec6e77155585755c62d9 |
|
BLAKE2b-256 | 0c48c418ab3cc25809d87e04c85c556f74b24171dd8d44cdea5fa0b8b19049be |
File details
Details for the file metaflow_card-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: metaflow_card-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30c81e011310c0dd5bbcff095c7f1bb7a80fcbc4d57001cfe90760100e5c7fa6 |
|
MD5 | b16251b3892bafff8c9a58126186b040 |
|
BLAKE2b-256 | 2c4e76214dca2b016be68eba216df1ecc19f86a0df1baeae58c1fca41bf4373b |