Outputs Interface
- Browsers:
CodePen
Stackblitz
JsFiddle
w3CTryIt
- Files:
Jupyter
JupyterLab
HTML page
HTML, JavaScript and CSS files
Web:
- class epyk.core.py.PyOuts.OutBrowsers(context)
- codepen(path: Optional[str] = None, target: str = '_blank', open_browser: bool = True)
Update the Html launcher and send the data to Codepen. URL used: https://codepen.io/pen/define/
Usage:
page = Report() page.ui.text("This is a text") page.outs.browser.codepen()
Related Pages:
- Parameters:
path – Optional. Output path in which the static files will be generated
target – Optional. Load the data in a new tab in the browser
open_browser – Optional. Flag to open the browser automatically
- Returns:
The output launcher full file name.
- stackblitz(path: Optional[str] = None, target: str = '_blank', open_browser: bool = True)
Create an output to be compatible with stackblitz.
Usage:
page = Report() page.ui.text("This is a text") page.outs.codepen()
Related Pages:
- Parameters:
path – Optional. Output path in which the static files will be generated
target – Optional. Not used. Load the data in a new tab in the browser
open_browser – Optional. Flag to open the browser automatically
- class epyk.core.py.PyOuts.PyOuts(page: Optional[PageModel] = None, options: Optional[dict] = None)
- property browser
This module will require the package web browser. It will allow outputs to be created directly in the web pages (without using intermediary text files.
- codepen(path: Optional[str] = None, name: Optional[str] = None)
Produce files which will be compatible with codepen.
Usage:
page = Report() page.ui.text("This is a text") page.outs.codepen()
Related Pages:
- Parameters:
path – Optional. The path in which the output files will be created
name – Optional. The filename without the extension
TODO Try to add the prefill https://blog.codepen.io/documentation/api/prefill/
- Returns:
The file path
- component(selector: str)
Return a standalone component like object for the different web framework.
- html()
Function to get the result HTML page fragments from all the HTML components.
Usage:
page = Report() page.ui.text("This is a text") page.outs.html()
- html_file(path: Optional[str] = None, name: Optional[str] = None, options: Optional[dict] = None, print_paths: bool = False, run_id: Union[bool, str] = True)
Function used to generate a static HTML page for the report.
Usage:
page = Report() page.ui.text("This is a text") page.outs.html_file() # To generate multiple files using local packages page.imports.static_url = "C:\epyks\statics" page.outs.html_file(name="test.html", options={"split": True, "minify": True, "static_path": page.imports.static_url})
- Parameters:
path – Optional. The path in which the output files will be created
name – Optional. The filename without the extension
print_paths – Optional. Print the page for the created file
options – Optional.
run_id – Optional.
- Returns:
The file full path.
- jsfiddle(path: Optional[str] = None, name: Optional[str] = None, framework: str = 'jsfiddle')
Produce files which can be copied directly to https://jsfiddle.net in order to test the results and perform changes.
The output is always in a sub-directory jsfiddle.
Usage:
page = Report() page.ui.text("This is a text") page.outs.codepen()
Related Pages:
- Parameters:
path – Optional. The path in which the output files will be created
name – Optional. The filename without the extension
framework – optional. The framework in which the result page will be used
- Returns:
The file path
- jupyter(verbose: bool = False, requireJs: Optional[dict] = None, closure: bool = True, requirejs_path: Optional[dict] = None, requirejs_func: Optional[dict] = None)
For a display of the report in Jupyter. Thanks to this function some packages will not be imported to not conflict with the existing ones.
Usage:
page = Report() page.ui.text("This is a text") page.outs.jupyter()
Related Pages:
- Parameters:
verbose – Optional. Get the excluded packages
requireJs – Optional. The requirements overrides from the apps property
closure – Optional.
requirejs_path – Optional.
requirejs_func – Optional.
- Returns:
The output object with the function _repr_html_
- jupyterlab()
For a display of the report in JupyterLab. Thanks to this function some packages will not be imported to not conflict with the existing ones.
Usage:
page = Report() page.ui.text("This is a text") page.outs.jupyterlab()
Related Pages:
- markdown_file(path: Optional[str] = None, name: Optional[str] = None)
Writes a Markdown file from the report object.
- Parameters:
path – The path in which the output files will be created.
name – The filename without the extension.
- Returns:
The file path
- publish(server: str, root_path: str, selector: str, alias: Optional[str] = None, target_folder: str = 'apps')
Publish the HTML page to a distant web server.
Usage:
:param server: Target web framework alias :param root_path: Root path for the web server :param selector: Component / Application internal selector (name) :param alias: The url endpoint for the new page :param target_folder: The applications sub folder (default apps)
- w3cTryIt(path: Optional[str] = None, name: Optional[str] = None)
This will produce everything in a single page which can be directly copied to the try editor in w3C website.
Usage:
page = Report() page.ui.text("This is a text") page.outs.w3cTryIt()
Related Pages:
- Parameters:
path – Optional. The path in which the output files will be created
name – Optional. The filename without the extension
- web() dict
Return the complete page structure to allow the various web framework to split the code accordingly. Fragments will then be used by the various framework to create the corresponding pages.