generated from jupyterlite/xeus-python-demo
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
62c815f
commit 9e16bbb
Showing
8 changed files
with
103 additions
and
7 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<p>🖖 <a href="https://en.wikipedia.org/wiki/Vulcan_salute">Live long and prosper!</a></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<p>🌿🐛 Found a bug? Something not working? Frustrated? <a href="https://github.com/brightway-lca/brightway-live/issues">Please report it!</a></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Cheat Sheet | ||
|
||
## Reset the JupyterLite Environment | ||
|
||
Currently, the interface of the JupiterLite environment does not provide a way to reset the environment. | ||
|
||
Related Issues: | ||
|
||
- [jupyterlite/jupyterlite#9](https://github.com/jupyterlite/jupyterlite/issues/9) | ||
- | ||
This means that the environment must be reset manually. Usually, all data is stored in the browser's IndexedDB. You can reset the environment in your browser by following these steps: | ||
|
||
Google Chrome: | ||
|
||
``` | ||
Developer > Developer Tools > Application > Storage > Indexed DB > JupyterLite Storage > Delete Database | ||
``` | ||
|
||
Mozilla Firefox: | ||
|
||
``` | ||
Tools > Page Info > Permissions > Maintain Offline Storage > Clear Storage | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,37 @@ | ||
# Brightway Live Limitation | ||
# Limitations | ||
|
||
Currently, an error is raised when trying to query a SQLite database in JupyterLite. This affects the use of Brightway, which stores data in sqlite databases through the `peewee` Python library. For instance, this simple test of the `peewee` library: | ||
|
||
```python | ||
from peewee import * | ||
|
||
# Define a database object | ||
db = SqliteDatabase('my_database.db') | ||
|
||
# Define a model class | ||
class Person(Model): | ||
name = CharField() | ||
age = IntegerField() | ||
|
||
class Meta: | ||
database = db | ||
|
||
# Create the table in the database | ||
db.connect() | ||
db.create_tables([Person]) | ||
|
||
person1 = Person(name='Alice', age=25) | ||
person1.save() | ||
``` | ||
|
||
raises the following error: | ||
|
||
``` | ||
DatabaseError: database disk image is malformed | ||
``` | ||
|
||
The current workaround is documented here: | ||
|
||
- https://github.com/brightway-lca/brightway-live/issues/10 | ||
|
||
Instead of the default storage location a different location at `/tmp/` must be specified for the database. This is done [by setting the `BRIGHTWAY_DIR` environment variable](https://docs.brightway.dev/en/latest/content/faq/data_management.html#how-do-i-change-my-data-directory). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Use | ||
|
||
## Reset the JupyterLite Environment | ||
|
||
### Delete the JupyterLite Storage | ||
|
||
Currently, the interface of the JupiterLite environment does not provide a way to reset the environment. | ||
|
||
##### Related Issues: | ||
|
||
- https://github.com/jupyterlite/jupyterlite/issues/9 | ||
|
||
This means that the environment must be reset manually. [Usually](https://jupyterlite.readthedocs.io/en/latest/howto/configure/storage.html), all data is stored in the browser's `IndexedDB`. You can reset the environment in your browser by following these steps: | ||
|
||
- [Google Chrome](https://github.com/jupyterlite/jupyterlite/issues/9#issuecomment-875870620): | ||
|
||
> Developer > Developer Tools > Application > Storage > Indexed DB > JupyterLite Storage > Delete Database | ||
- Mozilla Firefox: | ||
|
||
> Tools > Page Info > Permissions > Maintain Offline Storage > Clear Storage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
# Brightway Live 🖖 | ||
# Brightway Live | ||
|
||
## What is Brightway Live? | ||
|
||
This is an excellent question! | ||
Brightway Live is a Python-based development environment [^1] that runs entirely in the browser. This means that it is independent of the hardware, the operating system or the local Python environment of the user. It is powered by WebAssembly [^2] and JupyterLite [^3]. It was built by [Michael Weinold](https://github.com/michaelweinold) after learning about the possibilities of Python in WebAssembly at the EuroSciPy conference in Basel in 2022. | ||
|
||
## What can I do with Brightway Live? | ||
|
||
At the moment, you can play around with it. You can load brightway packages (eg. `bw2io`, `bw2calc`, `bw2data` and `bw2analyzer`) and use them in a Jupyter Notebook or in a Python console. In the long run, you will be able to use this to teach life-cycle assessment with Brightway at scale. You will not need to worry about installation or setup of the software. You will not need to worry about the different hardware and operating systems that your students bring to class. You will not need to worry about setting up a JupyterHub server and the associated overhead. | ||
|
||
<img width="525" alt="Screenshot 2023-09-15 at 09 50 53" src="https://github.com/brightway-lca/brightway-hub/assets/23102087/f2fa252b-bc73-4577-9f63-77e2526fc8cd"> | ||
|
||
[^1]: A development environment is the collection of processes and tools that are used to develop the source code for a program or software product. | ||
[^2]: [WebAssembly](https://en.wikipedia.org/wiki/WebAssembly) (often abbreviated "WASM") is _a binary instruction format and a runtime environment_. This means it acts as a "virtual machine for the web. Unlike high-level programming languages like JavaScript or Python, which are typically interpreted by a runtime environment, WebAssembly code is compiled to a binary format. This binary code is the same regardless of the user's device or operating system. | ||
[^3]: [JupyterLite](https://jupyterlite.readthedocs.io) is a version of [JupyterLab](https://jupyter.org), which is optimized for the browser. | ||
|
||
```{toctree} | ||
--- | ||
hidden: | ||
maxdepth: 1 | ||
--- | ||
Go Live <https://live.brightway.dev/> | ||
content/cheat_sheet | ||
content/limitations | ||
``` |