Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelweinold committed Sep 16, 2023
1 parent 62c815f commit 9e16bbb
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 7 deletions.
1 change: 0 additions & 1 deletion docs/_templates/footer.html

This file was deleted.

1 change: 1 addition & 0 deletions docs/_templates/footer_center.html
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>
1 change: 1 addition & 0 deletions docs/_templates/footer_end.html
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>
9 changes: 6 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,16 @@
],
}

footcent = str('test')

html_theme_options = {
"announcement": "<p>Join the Discussion: 💬 <a href='https://matrix.to/#/#brightway:matrix.org'>Brightway Community Chat Rooms on Matrix</a></p>",
"announcement": "<p>⚠️ Brightway Live is in Public Beta ⚠️</p>",
# page elements
"navbar_start": ["navbar-logo"],
"navbar_end": ["navbar-icon-links.html"],
"footer_start": ["copyright"],
"footer_end": ["footer"],
"footer_center": ["footer_center"],
"footer_end": ["footer_end"],
"secondary_sidebar_items": ["page-toc"],
"header_links_before_dropdown": 7,
# page elements content
Expand All @@ -97,7 +100,7 @@
"use_edit_page_button": True,
"navigation_with_keys": True,
"logo": {
"text": "Brightway",
"text": "Brightway Live",
"image_light": "BW_all_black_transparent_landscape.svg",
"image_dark": "BW_all_white_transparent_landscape.svg"
},
Expand Down
23 changes: 23 additions & 0 deletions docs/content/cheat_sheet.md
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
```
37 changes: 36 additions & 1 deletion docs/content/limitations.md
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).
21 changes: 21 additions & 0 deletions docs/content/use.md
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
17 changes: 15 additions & 2 deletions docs/index.md
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
```

0 comments on commit 9e16bbb

Please sign in to comment.