Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
szarnyasg committed Oct 2, 2024
1 parent f428267 commit a8c6d1e
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions _posts/2024-10-04-pyodide.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ thumb: "/images/blog/thumbs/241004.svg"
excerpt: "Run DuckDB in an in-browser Python environment to enable simple querying on remote files, interactive documentation, and easy to use training materials."
---

## Time to "Hello World"
## Time to Hello World

The first time that you are using a new library, the most important thing is how quickly you can get to "Hello World".
The first time that you are using a new library, the most important thing is how quickly you can get to Hello World.

> Note Want to see "Hello World"?
> Note Want to see Hello World?
> [Jump to the examples!]({% post_url 2024-10-04-pyodide %}#pyscript-editor)
Likewise, if someone is visiting any documentation you have written, you want them to quickly and easily get your tool up and running.
If you want to try "expert mode", try leading an entire conference room of people through those setup steps!
If you want to try expert mode, try leading an entire conference room of people through those setup steps!
The classroom or conference workshop environment makes it far more critical that installation be bulletproof.

Python is one of our favorite ways to use DuckDB, but Python is notoriously difficult to set up – doubly so for a novice programmer.
Expand Down Expand Up @@ -72,7 +72,6 @@ There is no need to work 1:1 with the 15% of folks in the audience with some qui
Everyone will get this to work on the first try, in seconds, so you can get to the content you want to teach.
Plus, it is free, with no signup required of any kind!


## Pyodide Examples

We will cover multiple ways to embed Pyodide-powered-Python directly into your site, so your users can try out your new DuckDB-backed tool with a single click!
Expand Down Expand Up @@ -166,21 +165,21 @@ The Pyodide team has added DuckDB to their hosted repository of libraries, and e
That is what enables JupyterLite to simply run `%pip install duckdb`, and PyScript to specify DuckDB as a package in the `py-editor config` parameter or in the `<py-config>` tag.
Pyodide then downloads the Wasm-compiled version of the DuckDB library from Pyodide's repository.
We want to send a big thank you to the Pyodide team, including [Hood Chatham](https://github.com/hoodmane) and [Gyeongjae Choi](https://github.com/ryanking13), as well as the Voltron Data team including [Phillip Cloud](https://github.com/cpcloud) for leading the effort to get this to work.
Thanks to [Carlo](https://github.com/carlopi) here at DuckDB Labs as well!
Thanks to [Carlo](https://github.com/carlopi) at DuckDB Labs as well!

### Limitations

Running in the browser is a more restrictive environment (for security purposes), so there are some limitations when using DuckDB in Pyodide.
There is no free lunch!

* Single threaded
* Single-threaded
* Wasm does not have the concept of threads, yet!
* A few extra steps to query remote files
* Remote files can't be accessed by DuckDB directly
* Instead, pull the files locally with Pyodide first
* DuckDB Wasm has custom enhancements to make this possible, but these are not present in DuckDB's Python client
* DuckDB-Wasm has custom enhancements to make this possible, but these are not present in DuckDB's Python client
* No runtime-loaded extensions
* Several extensions are automatically included like parquet, icu, and json
* Several extensions are automatically included like `parquet`, `icu`, and `json`

## Conclusion

Expand All @@ -190,7 +189,7 @@ It is also an approach that scales to an arbitrary number of users because Pyodi
We have seen how to embed Pyodide in a static site in multiple ways, as well as how to read remote files.

If you are excited about DuckDB in Pyodide, feel free to join us on Discord.
We have a show-and-tell section where you can share what you build with the community.
We have a `#show-and-tell` channel where you can share what you build with the community.
We would also really love some help with enabling runtime-loaded extensions – please reach out if you can help!

Happy quacking about!

0 comments on commit a8c6d1e

Please sign in to comment.