Skip to content

Commit 508f412

Browse files
committed
doc: add uv to installation instructions
1 parent 8700c03 commit 508f412

2 files changed

Lines changed: 48 additions & 29 deletions

File tree

README.md

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,34 @@ Plot.plot({
3636

3737
## Installation and usage
3838

39-
`pyobsplot` can be installed with `pip`:
39+
`pyobsplot` can be installed with `uv` or `pip`:
40+
41+
::: {.panel-tabset}
42+
43+
## uv
44+
45+
```sh
46+
uv add pyobsplot[typst]
47+
```
48+
49+
## pip
4050

4151
```sh
4252
pip install pyobsplot[typst]
4353
```
4454

55+
:::
56+
4557
To use `pyobsplot` in [JupyterLite](https://jupyter.org/try-jupyter/lab/) or [marimo](https://marimo.io) you must install it without the `typst` dependency, which is not yet compatible with [pyodide](https://pyodide.org/en/stable/):
4658

4759
```sh
4860
pip install pyobsplot
4961
```
5062

51-
5263
For usage instructions, see the [documentation website](https://juba.github.io/pyobsplot):
5364

54-
- See [getting started](https://juba.github.io/pyobsplot/getting_started.html) for a quick usage overview.
55-
- See [usage](https://juba.github.io/pyobsplot/usage.html) for more detailed usage instructions.
65+
- See [getting started](https://juba.github.io/pyobsplot/getting_started.html) for a quick usage overview.
66+
- See [usage](https://juba.github.io/pyobsplot/usage.html) for more detailed usage instructions.
5667

5768
If you just want to try this package without installing it on your computer, you can open an introduction notebook in Google Colab:
5869

@@ -62,25 +73,25 @@ If you just want to try this package without installing it on your computer, you
6273

6374
**Features:**
6475

65-
- Syntax as close as possible to the JavaScript one
66-
- Plots can be generated as Jupyter widgets, or as SVG, HTML or PNG outputs (via typst)
67-
- Plots can be saved to Widget HTML, static HTML, SVG, PNG or PDF files
68-
- [Pandas](https://pandas.pydata.org) and [polars](https://pola.rs) DataFrame and Series objects are serialized using [Arrow](https://arrow.apache.org) IPC format for improved speed and better data type conversions
69-
- Works with Jupyter, JupyterLite and Marimo notebooks as well as in Quarto documents
70-
- Works offline, no iframe or dependency to Observable runtime
71-
- Caching mechanism of data objects if they are used several times in the same plot
72-
- Custom JavaScript code can be passed as strings with the `js` method
73-
- Python `date` and `datetime` objects are automatically converted to JavaScript `Date` objects
76+
- Syntax as close as possible to the JavaScript one
77+
- Plots can be generated as Jupyter widgets, or as SVG, HTML or PNG outputs (via typst)
78+
- Plots can be saved to Widget HTML, static HTML, SVG, PNG or PDF files
79+
- [Pandas](https://pandas.pydata.org) and [polars](https://pola.rs) DataFrame and Series objects are serialized using [Arrow](https://arrow.apache.org) IPC format for improved speed and better data type conversions
80+
- Works with Jupyter, JupyterLite and Marimo notebooks as well as in Quarto documents
81+
- Works offline, no iframe or dependency to Observable runtime
82+
- Caching mechanism of data objects if they are used several times in the same plot
83+
- Custom JavaScript code can be passed as strings with the `js` method
84+
- Python `date` and `datetime` objects are automatically converted to JavaScript `Date` objects
7485

7586
**Limitations:**
7687

77-
- Plot interactions (tooltips, crosshair...) are only available with the "widget" format (<https://github.com/juba/pyobsplot/issues/16>).
78-
- Very limited integration with IDE (documentation and autocompletion) for Plot methods. (<https://github.com/juba/pyobsplot/issues/13>)
88+
- Plot interactions (tooltips, crosshair...) are only available with the "widget" format (<https://github.com/juba/pyobsplot/issues/16>).
89+
- Very limited integration with IDE (documentation and autocompletion) for Plot methods. (<https://github.com/juba/pyobsplot/issues/13>)
7990

8091
## Credits
8192

82-
- [Observable Plot](https://observablehq.com/@observablehq/plot?collection=@observablehq/plot), developed by [Mike Bostock](https://observablehq.com/@mbostock) and [Philippe Rivière](https://observablehq.com/@fil) among others.
83-
- The widget is developed thanks to the [anywidget](https://anywidget.dev) framework.
84-
- [typst](https://typst.app) is used to convert HTML figures to PNG, SVG or PDF.
85-
- Some code from the `jsdom` renderer has been adapted from [altair_saver](https://github.com/altair-viz/altair_saver).
86-
- The documentation website is generated by [Quarto](https://quarto.org).
93+
- [Observable Plot](https://observablehq.com/@observablehq/plot?collection=@observablehq/plot), developed by [Mike Bostock](https://observablehq.com/@mbostock) and [Philippe Rivière](https://observablehq.com/@fil) among others.
94+
- The widget is developed thanks to the [anywidget](https://anywidget.dev) framework.
95+
- [typst](https://typst.app) is used to convert HTML figures to PNG, SVG or PDF.
96+
- Some code from the `jsdom` renderer has been adapted from [altair_saver](https://github.com/altair-viz/altair_saver).
97+
- The documentation website is generated by [Quarto](https://quarto.org).

doc/getting_started.qmd

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,24 @@ title: "Getting started"
66

77
## Installation
88

9-
`pyobsplot` can be installed with `pip`:
9+
`pyobsplot` can be installed with `uv` or `pip`:
10+
11+
::: {.panel-tabset}
12+
13+
## uv
14+
15+
```sh
16+
uv add pyobsplot[typst]
17+
```
18+
19+
## pip
1020

1121
```sh
1222
pip install pyobsplot[typst]
1323
```
1424

25+
:::
26+
1527
If you want to use output formats like PNG or SVG, you must have a working installation of [node.js](https://nodejs.org/en) and you must install the `pyobsplot` npm package globally or locally:
1628

1729
```sh
@@ -27,7 +39,6 @@ To use `pyobsplot` in [jupyter lite](https://jupyter.org/try-jupyter/lab/) or [m
2739
pip install pyobsplot
2840
```
2941

30-
3142
## Creating a plot
3243

3344
To use `pyobsplot`, you must import its `Plot` object with:
@@ -55,12 +66,10 @@ data = pl.DataFrame(
5566
If your JavaScript plot function looks like this:
5667

5768
```javascript
58-
Plot.plot(
59-
{
60-
grid: true,
61-
marks: [Plot.dot(data, {x: "x", y: "y", fill: "type", r: 5})]
62-
}
63-
)
69+
Plot.plot({
70+
grid: true,
71+
marks: [Plot.dot(data, { x: "x", y: "y", fill: "type", r: 5 })],
72+
})
6473
```
6574

6675
Then you can reproduce the plot with:
@@ -117,7 +126,6 @@ Plot.plot(Plot.auto(penguins, {"x": "flipper_length_mm"}), path="plot.svg")
117126
With the "widget" format, export can only be done to HTML files.
118127
:::
119128

120-
121129
## Learn more
122130

123131
To go further, see the [usage](usage.qmd) page.

0 commit comments

Comments
 (0)