Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
Refactor Builder API before documentation (#977)
Browse files Browse the repository at this point in the history
- Refactor Builder API
- Added doc
- Fix circular dependency
  • Loading branch information
FabienLelaquais authored Oct 18, 2023
1 parent e9c792a commit b7f4363
Show file tree
Hide file tree
Showing 59 changed files with 300 additions and 215 deletions.
5 changes: 3 additions & 2 deletions doc/examples/broadcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
# The text of the button that starts or stops the thread is updated on every client's browser
# using a direct assignment of the state property because the variable is declared 'shared'.
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui, State, broadcast_callback
from threading import Thread, Event
from threading import Event, Thread
from time import sleep

from taipy.gui import Gui, State, broadcast_callback

counter = 0

# Thread management
Expand Down
6 changes: 4 additions & 2 deletions doc/examples/charts/advanced-selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import numpy
import random

import numpy

from taipy.gui import Gui

# x = [0..20]
x = list(range(0, 21))

Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/bar-facing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
# python <script>
# -----------------------------------------------------------------------------------------
# Face-to-face bar charts example
from taipy.gui import Gui
import numpy

from taipy.gui import Gui

n_years = 10

proportions_female = numpy.zeros(n_years)
Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/bar-multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
# python <script>
# -----------------------------------------------------------------------------------------
# Two data sets as a bar chart
from taipy.gui import Gui
import pandas

from taipy.gui import Gui

# Source https://en.wikipedia.org/wiki/List_of_United_States_presidential_elections_by_popular_vote_margin
percentages = [
(1852, 50.83),
Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/bar-simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import pandas

from taipy.gui import Gui

# Source https://en.wikipedia.org/wiki/List_of_United_States_presidential_elections_by_popular_vote_margin
percentages = [
(1852, 50.83),
Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/bar-stacked.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import pandas

from taipy.gui import Gui

# Source https://en.wikipedia.org/wiki/List_of_United_States_presidential_elections_by_popular_vote_margin
percentages = [
(1852, 50.83),
Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/basics-timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import numpy
import pandas

from taipy.gui import Gui

# Generate a random value for every hour on a given day
data = {"Date": pandas.date_range("2023-01-04", periods=24, freq="H"), "Value": pandas.Series(numpy.random.randn(24))}

Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/candlestick-simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
# python <script>
# You may need to install the yfinance package as well.
# -----------------------------------------------------------------------------------------
from taipy import Gui
import yfinance

from taipy import Gui

# Extraction of a month of stock data for AAPL using the
# yfinance package (see https://pypi.org/project/yfinance/).
ticker = yfinance.Ticker("AAPL")
Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/candlestick-styling.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
# python <script>
# You may need to install the yfinance package as well.
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import yfinance

from taipy.gui import Gui

# Extraction of a few days of stock historical data for AAPL using
# the yfinance package (see https://pypi.org/project/yfinance/).
# The returned value is a Pandas DataFrame.
Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/candlestick-timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import datetime

from taipy.gui import Gui

# Retrieved history:
# (Open, Close, Low, High)
stock_history = [
Expand Down
4 changes: 3 additions & 1 deletion doc/examples/charts/continuous-error-multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import datetime

import dateutil.relativedelta

from taipy.gui import Gui

# Data is collected from January 1st, 2010, every month
start_date = datetime.datetime(year=2010, month=1, day=1)
period = dateutil.relativedelta.relativedelta(months=1)
Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/continuous-error-simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import random

from taipy.gui import Gui

# Common axis for all data: [1..10]
x = list(range(1, 11))
# Sample data
Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/error-bars-asymmetric.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import random

from taipy.gui import Gui

# Number of samples
n_samples = 10
# y values: [0..n_samples-1]
Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/error-bars-simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import math
import random

from taipy.gui import Gui

# Number of samples
max_x = 20
# x values: [0..max_x-1]
Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/gantt-simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import datetime

from taipy.gui import Gui

# Tasks definitions
tasks = ["Plan", "Research", "Design", "Implement", "Test", "Deliver"]
# Task durations, in days
Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/heatmap-drawing-on-top.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import numpy

from taipy.gui import Gui


# Return the x and y coordinates of the spiral for the given angle
def spiral(th):
Expand Down
6 changes: 4 additions & 2 deletions doc/examples/charts/heatmap-unequal-cell-sizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import numpy as np
from itertools import accumulate

import numpy as np

from taipy.gui import Gui

grid_size = 10
data = [
{
Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/histogram-cumulative.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import random

from taipy.gui import Gui

# Random data set
data = [random.random() for i in range(500)]

Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/histogram-horizontal.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import random

from taipy.gui import Gui

# Random data set
data = {"Count": [random.random() for i in range(100)]}

Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/histogram-nbins.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import random

from taipy.gui import Gui

# Random set of 100 samples
samples = {"x": [random.gauss() for i in range(100)]}

Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/histogram-normalized.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import random

from taipy.gui import Gui

# Random data set
data = [random.random() for i in range(100)]

Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/histogram-overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import random

from taipy.gui import Gui

# Data set made of two series of random numbers
data = [{"x": [random.random() + 1 for i in range(100)]}, {"x": [random.random() + 1.1 for i in range(100)]}]

Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/histogram-simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy import Gui
import random

from taipy import Gui

# Random data set
data = [random.gauss(0, 5) for i in range(1000)]

Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/histogram-stacked.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import random

from taipy.gui import Gui

# Data set made of two series of random numbers
data = {"A": [random.random() for i in range(200)], "B": [random.random() for i in range(200)]}

Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/line-style.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import pandas

from taipy.gui import Gui

dates = pandas.date_range("2023-01-01", periods=365, freq="D")
temp = [
-11.33333333,
Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/line-texts.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import numpy
import pandas

from taipy.gui import Gui

dates = pandas.date_range("2023-01-01", periods=365, freq="D")
temp = [
-11.33333333,
Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/map-bubbles.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import numpy
import pandas

from taipy.gui import Gui

# Largest cities: name, location and population
# Source: https://simplemaps.com/data/world-cities
cities = [
Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/polar-area.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import math

from taipy.gui import Gui

# One data point for each degree
theta = range(0, 360)

Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/polar-multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import math

from taipy.gui import Gui

# One data point for each degree
theta = range(0, 360)

Expand Down
3 changes: 2 additions & 1 deletion doc/examples/charts/polar-simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
import math

from taipy.gui import Gui

# One data point for each degree
theta = range(0, 360)

Expand Down
4 changes: 3 additions & 1 deletion doc/examples/charts/polar-tick-texts.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui
from datetime import datetime

import numpy

from taipy.gui import Gui


def generate_hand_shapes():
# Retrieve and store the current, local time
Expand Down
Loading

0 comments on commit b7f4363

Please sign in to comment.