Skip to content

Commit

Permalink
feat: Add /docs used to deploy documentation to GitHub Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
thomass-dev committed Oct 23, 2024
1 parent 8df3ea3 commit 7c7f456
Show file tree
Hide file tree
Showing 11 changed files with 622 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,7 @@ tramp
.\#*

# Sphinx documentation
doc/_build/
doc/auto_examples/
sphinx/build/
sphinx/auto_examples/
sphinx/generated/
sphinx/sg_execution_times.rst
8 changes: 6 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
exclude: |
(?x)
(fixtures/)|
(^sphinx/)|
(^docs/)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
Expand Down Expand Up @@ -52,5 +58,3 @@ repos:
name: Use stylelint to lint CSS.
entry: bash -c "cd skore-ui && npm run style-lint"
files: ^skore-ui/

exclude: fixtures/
Empty file added docs/.nojekyll
Empty file.
3 changes: 3 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<head>
<meta http-equiv="refresh" content="0;latest/index.html">
</head>
6 changes: 6 additions & 0 deletions examples/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. _auto_examples:

Examples
========

Below is a gallery of examples on how to use ``skore``.
124 changes: 124 additions & 0 deletions examples/plot_01_getting_started.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
"""
=================================
1) Getting started with ``skore``
=================================
This example runs the :ref:`getting_started` guide.
``skore`` UI
------------
This section provides a quick start to the ``skore`` UI, an open-source package that aims to enable data scientists to:
#. Store objects of different types from their Python code: python lists, ``scikit-learn`` fitted pipelines, ``plotly`` figures, and more.
#. Track and visualize these stored objects on a user-friendly dashboard.
#. Export the dashboard to a HTML file.
Initialize a Project and launch the UI
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
From your shell, initialize a skore project, here named ``my_project_gs``, that
will be in your current working directory:
"""

# %%
import subprocess

# remove the project if it already exists
subprocess.run("rm -rf my_project_gs.skore".split())

# create the project
subprocess.run("python3 -m skore create my_project_gs".split())

# %%
# This will create a ``skore`` project directory named ``my_project_gs`` in the
# current directory.
#
# From your shell (in the same directory), start the UI locally:
#
# .. code:: console
#
# python -m skore launch "my_project_gs"
#
# This will automatically open a browser at the UI's location.
#
# Now that the project file exists, we can load it in our notebook so that we can
# read from and write to it:

# %%
from skore import load

my_project_gs = load("my_project_gs.skore")

# %%
# Storing some items
# ^^^^^^^^^^^^^^^^^^
#
# Storing an integer:

# %%
my_project_gs.put("my_int", 3)

# %%
# Here, the name of my stored item is ``my_int`` and the integer value is 3.

# %%
my_project_gs.get("my_int")

# %%
# For a ``pandas`` data frame:

# %%
import numpy as np
import pandas as pd

my_df = pd.DataFrame(np.random.randn(3, 3))

my_project_gs.put("my_df", my_df)

# %%
my_project_gs.get("my_df")

# %%
# For a ``matplotlib`` figure:

# %%
import matplotlib.pyplot as plt

x = [0, 1, 2, 3, 4, 5]
fig, ax = plt.subplots(figsize=(5, 3), layout="constrained")
_ = ax.plot(x)

my_project_gs.put("my_figure", fig)

# %%
# For a ``scikit-learn`` fitted pipeline:

# %%
from sklearn.datasets import load_diabetes
from sklearn.linear_model import Lasso
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler

diabetes = load_diabetes()
X = diabetes.data[:150]
y = diabetes.target[:150]
my_pipeline = Pipeline(
[("standard_scaler", StandardScaler()), ("lasso", Lasso(alpha=2))]
)
my_pipeline.fit(X, y)

my_project_gs.put("my_fitted_pipeline", my_pipeline)

# %%
my_project_gs.get("my_fitted_pipeline")

# %%
# Back to the dashboard
# ^^^^^^^^^^^^^^^^^^^^^
#
# #. On the top left, create a new ``View``.
# #. From the ``Elements`` section on the bottom left, you can add stored items to this view, either by double-cliking on them or by doing drag-and-drop.
#
# .. image:: https://raw.githubusercontent.com/sylvaincom/sylvaincom.github.io/master/files/probabl/skore/2024_10_14_skore_demo.gif
# :alt: Getting started with ``skore`` demo
Loading

0 comments on commit 7c7f456

Please sign in to comment.