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

PoC: PyScript IDE Component #358

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion _sources/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ Contenidos:
:maxdepth: 1

index_es
index_en
index_en
pycomponent
8 changes: 8 additions & 0 deletions _sources/pycomponent.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
==================
PyScript Component
==================

This is a demo implementation of a PyScript component. It is a simple component that takes a Python script as input and executes it. This component also has support for Pandas library.

.. raw:: html
:file: ../pyscript.html
1 change: 1 addition & 0 deletions build_info
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
unknown-0-0
53 changes: 53 additions & 0 deletions pyscript.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<div>
<iframe height="600px" width="100%" srcdoc='
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
<style>
.py-repl-run-button{opacity: 1;}
.py-repl-output{margin-top: 1rem;background-color: #000;color: #fff;font-family: monospace;padding: 0.5rem;min-height: 10em;overflow: auto;}
</style>
</head>
<body>
<py-config>
terminal = false
packages = ["pandas", "matplotlib", "numpy"]
</py-config>
<py-repl id="code">
</py-repl>

</body>
</html>'
style="border: 8px solid #ccc;border-radius: 10px;"
>
</iframe>
</div>

<!-- import pandas as pd

# Create a dictionary of data
data = {'Name': ['Alice', 'Bob', 'Charlie', 'David'],
'Age': [25, 30, 35, 40],
'City': ['New York', 'Los Angeles', 'Chicago', 'Houston']}

# Create a DataFrame from the dictionary
df = pd.DataFrame(data)

# Print the DataFrame
print("Original DataFrame:")
print(df)
print()

# Add a new column
df['Salary'] = [50000, 60000, 70000, 80000]

# Print the modified DataFrame
print("DataFrame with Salary column added:")
print(df)
print()

# Calculate the average age
average_age = df['Age'].mean()
print("Average age:", average_age) -->
Loading