Skip to content

Commit

Permalink
Merge branch 'develop' into bug/#2023-trap-focus-out
Browse files Browse the repository at this point in the history
  • Loading branch information
FabienLelaquais authored Nov 15, 2024
2 parents 479a710 + 5b5e1d6 commit 9ac7bb1
Show file tree
Hide file tree
Showing 73 changed files with 4,255 additions and 3,465 deletions.
5 changes: 2 additions & 3 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ body:
attributes:
label: "Steps to Reproduce Issue"
description: If possible, please share the steps to reproduce the issue.
value: |
placeholder: |
1. A code fragment
2. And/or configuration files or code
3. And/or Taipy GUI Markdown or HTML files
Expand All @@ -50,8 +50,7 @@ body:
attributes:
label: "Screenshots"
description: If applicable, add screenshots to help explain your problem.
value: |
![DESCRIPTION](LINK.png)
placeholder: ![DESCRIPTION](LINK.png)
validations:
required: false

Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/cleanup-dev-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Cleanup Old Pre-Releases

on:
workflow_dispatch: # Allows manual triggering

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Cleanup old dev releases
id: cleanup
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sh tools/release/cleanup_dev_releases.sh
4 changes: 2 additions & 2 deletions .github/workflows/dependencies-management.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This workflow is used to manage the dependencies of the Taipy packages.
# - Runs each Sunday.
# - Runs every 2 weeks on Sundays.
# - For each Python version supported:
# - Call a custom script to align dependencies between Taipy packages.
# - Call a custom script to update dependencies (Pipfile and requirements.txt).
Expand All @@ -12,7 +12,7 @@ name: Dependencies management

on:
schedule:
# Run every 2 weeks on Sunday at mid day UTC
# Run every 2 weeks on Sunday at midday UTC
- cron: 00 12 */14 * 0

workflow_dispatch:
Expand Down
33 changes: 21 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ issue or PR if you're still interested in working on it.
### Python

Taipy's repositories follow the [PEP 8](https://www.python.org/dev/peps/pep-0008/) and
[PEP 484](https://www.python.org/dev/peps/pep-0484/) coding convention.
[PEP 484](https://www.python.org/dev/peps/pep-0484/) coding convention. Gui variables need to be `snake_case` to be correctly converted into the `camelCase`, used for typescript variables.
### TypeScript
Expand Down Expand Up @@ -255,17 +255,26 @@ npm run build:dev
This will preserve the debugging symbols, and you will be able to navigate in the TypeScript code
from your debugger.
!!!note "Web application location"
When you are developing front-end code for the Taipy GUI package, it may be cumbersome to have
to install the package over and over when you know that all that has changed is the JavaScript
bundle that makes the Taipy web app.
By default, the Taipy GUI application searches for the front-end code in the
`[taipy-gui-package-dir]/taipy/gui/webapp` directory.
You can, however, set the environment variable `TAIPY_GUI_WEBAPP_PATH` to the location of your
choice, and Taipy GUI will look for the web app in that directory.
If you set this variable to the location where you build the web app repeatedly, you will no
longer have to reinstall Taipy GUI before you try your code again.
#### 📝A note on "Web application location"
When you are developing front-end code for the Taipy GUI package, it may be cumbersome to have
to install the package over and over when you know that all that has changed is the JavaScript
bundle that makes the Taipy web app.
By default, the Taipy GUI application searches for the front-end code in the
`[taipy-gui-package-dir]/taipy/gui/webapp` directory.
You can, however, set the environment variable `TAIPY_GUI_WEBAPP_PATH` to the location of your
choice, and Taipy GUI will look for the web app in that directory.
If you set this variable to the location where you build the web app repeatedly, you will no
longer have to reinstall Taipy GUI before you try your code again.
In python, you can handle this with:
```python
import os
os.environ["TAIPY_GUI_WEBAPP_PATH"] = os.path.normpath( "/path/to/your/taipy/taipy/gui/webapp" )
```
or in bash with:
```bash
export TAIPY_GUI_WEBAPP_PATH="/path/to/your/taipy/taipy/gui/webapp"
```
### Running the tests
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ flask = "==3.0.0"
flask-cors = "==5.0.0"
flask-socketio = "==5.3.6"
Flask-RESTful = ">=0.3.9"
gevent = "==23.7.0"
gevent = "==24.11.1"
gevent-websocket = "==0.10.1"
gitignore-parser = "==0.1.1"
kthread = "==0.2.3"
Expand Down
52 changes: 41 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,47 @@
</picture>
</a>
</div>

</br>
<div align="center">
<img
src="https://img.shields.io/github/license/Avaiga/taipy?style=plastic&color=ff371a&labelColor=1f1f1f"
alt="GitHub License"
height="20px"
/>
<a target="_blank" href="https://github.com/Avaiga/taipy/releases">
<img
alt="GitHub Release"
height="20px"
src="https://img.shields.io/github/v/release/Avaiga/taipy?display_name=release&style=plastic&color=ff371a&labelColor=1f1f1f"
></a>
</div>
<div align="center">
<img
src="https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-ff371a?style=plastic&labelColor=1f1f1f"
alt="Python version needed: 3.9"
/>

</div>
<div align="center">
<a target="_blank" href="https://docs.taipy.io/en/latest/">
<img
src="https://img.shields.io/badge/docs-ff371a?style=plastic&labelColor=1f1f1f&label=Explore"
height="20px"
alt="Explore the docs"
></a>
<a target="_blank" href="https://docs.taipy.io/en/latest/gallery/">
<img
src="https://img.shields.io/badge/gallery-ff371a?style=plastic&labelColor=1f1f1f&label=Explore"
height="20px"
alt="Explore Gallery"
></a>
<a target="_blank" href="https://discord.com/invite/SJyz2VJGxV">
<img
src="https://img.shields.io/discord/1125797687476887563?style=plastic&labelColor=1f1f1f&logo=discord&logoColor=ff371a&label=Discord&color=ff371a"
height="20px"
alt="Discord support"
></a>
</div>
<h1 align="center">
Build Python Data & AI web applications
</h1>
Expand All @@ -22,16 +62,6 @@ No more compromises on performance, customization, and scalability.
<strong> Go beyond existing libraries </strong>
</div>

<p align="center"><h4>
<br />
<a href="https://docs.taipy.io/en/latest/"><strong>📚 Explore the Docs </strong></a>
<br />
<a href="https://discord.com/invite/SJyz2VJGxV"><strong> 🫱🏼‍🫲🏼 Discord Support </strong></a>
<br />
<a href="https://docs.taipy.io/en/latest/gallery/"><strong> 👀 Demos & Examples </strong></a>
</h4>
</p>

## Table of Contents

- [What's Taipy?](#%EF%B8%8F-whats-taipy)
Expand Down
1 change: 1 addition & 0 deletions doc/gui/examples/blocks/layout_fit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This file makes this directory a module on its own, mandatory for mypy.
27 changes: 27 additions & 0 deletions doc/gui/examples/blocks/layout_fit/builder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# -----------------------------------------------------------------------------------------
# To execute this script, make sure that the taipy-gui package is installed in your
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
import taipy.gui.builder as tgb
from taipy.gui import Gui

with tgb.Page() as page:
with tgb.layout("max-content max-content"): # type: ignore[attr-defined]
with tgb.part("card"): # type: ignore[attr-defined]
tgb.text("France") # type: ignore[attr-defined]
with tgb.part("card"): # type: ignore[attr-defined]
tgb.text("United States of America") # type: ignore[attr-defined]

if __name__ == "__main__":
Gui(page).run(title="Layout - Fit to content")
33 changes: 33 additions & 0 deletions doc/gui/examples/blocks/layout_fit/markdown.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# -----------------------------------------------------------------------------------------
# To execute this script, make sure that the taipy-gui package is installed in your
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui

page = """
<|layout|columns=max-content max-content|
<|card|part|
France
|>
<|card|part|
United States of America
|>
|>
"""

if __name__ == "__main__":
Gui(page).run(title="Layout - Fit to content")
83 changes: 83 additions & 0 deletions doc/gui/examples/charts/matplotlib/image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# -----------------------------------------------------------------------------------------
# To execute this script, make sure that the taipy-gui package is installed in your
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
import os

import matplotlib.pyplot as plt
from taipy.gui import Gui, Markdown

# Generate a scatter plot
x = [1, 2, 3, 4, 5] # x axis values
y = [10, 14, 12, 15, 18] # y axis values
sizes = [100, 100, 100, 100, 100] # Bubble sizes
colors = [30, 40, 50, 60, 70] # Bubble color values that will be mapped to shades of colormap (cmap)

# Scatter plot
# The `c` parameter uses the `colors` list to map values to the colormap (cmap)
# The `edgecolors` parameter sets the color of the edges around the bubbles
plt.scatter(x, y, s=sizes, c=colors, cmap='Greens', edgecolors='black', linewidths=1)
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('Matplotlib 2D Scatter Plot')

# Adding labels next to each point
for i in range(len(x)):
plt.text(x[i] + 0.1, y[i] - 0.1, f'Point {i+1}', fontsize=9, ha='left')

# Creating legend entries for each point
# Each entry corresponds to a point, with the color and label indicating the point's position.
# The `markerfacecolor` sets the fill color of the legend marker to match the point's color in the 'Greens' colormap.
# The `markeredgecolor` sets the edge color of the legend marker.
# The `markeredgewidth` sets the width of the edge.
handles = [
plt.Line2D(
[0], [0], marker='o', color='w',
markerfacecolor=plt.cm.Greens(color / max(colors)),
markersize=10, # Adjust the size for visibility
label=f'Point {i+1}',
markeredgewidth=1, # Thickness of the edge color
markeredgecolor='black' # Edge color to match the plot
) for i, color in enumerate(colors)
]

# Placing the legend on the left side of the chart
plt.legend(handles=handles, title="Points", loc="center left", bbox_to_anchor=(1, 0.5), frameon=True)

# Adjust the layout to ensure everything fits and nothing is clipped
plt.tight_layout(rect=[0, 0, 1, 1])

# Save the figure as a PNG image
output_dir = './images'
if not os.path.exists(output_dir):
os.makedirs(output_dir)
content = "./images/figure.png"
plt.savefig(content)

# Define Taipy page content
page_content = Markdown("""
# Matplotlib 2D Scatter Plot
<|{content}|image|class_name=scatter-plot|>
""", style={
".scatter-plot": {
"display": "block",
"margin": "auto",
"max-width": "100% !important",
"width": "max-content !important",
"height": "max-content !important"
}
})

if __name__ == "__main__":
Gui(page_content).run(title="Chart-Scatter-Matplotlib")
19 changes: 19 additions & 0 deletions doc/gui/examples/controls/datanode_viewer_json.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "Sample Data",
"type": "Example JSON",
"attributes": {
"id": 123,
"description": "A simple JSON structure for demonstration",
"values": [
1,
2,
3,
4,
5
],
"nested": {
"flag": true,
"count": 10
}
}
}
22 changes: 22 additions & 0 deletions doc/gui/examples/controls/datanode_viewer_json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import taipy as tp
import taipy.gui.builder as tgb
from taipy import Config, Orchestrator, Scope
from taipy.gui import Gui

json_config_node = Config.configure_json_data_node(
id="json_node",
default_path="./datanode_viewer_json.json",
scope=Scope.GLOBAL,
)

with tgb.Page() as data_node_viewer:
tgb.data_node(
data_node="{json_data_node}"
)

gui = Gui(page=data_node_viewer)

if __name__ == "__main__":
Orchestrator().run()
json_data_node = tp.create_global_data_node(json_config_node)
gui.run(title="Datanode Viewer - json support")
Loading

0 comments on commit 9ac7bb1

Please sign in to comment.