From 9e16bbb9431b87c077060e10aea2c4ca26ac4a7d Mon Sep 17 00:00:00 2001 From: Michael Weinold <23102087+michaelweinold@users.noreply.github.com> Date: Sat, 16 Sep 2023 11:39:45 +0200 Subject: [PATCH] updated docs --- docs/_templates/footer.html | 1 - docs/_templates/footer_center.html | 1 + docs/_templates/footer_end.html | 1 + docs/conf.py | 9 +++++--- docs/content/cheat_sheet.md | 23 +++++++++++++++++++ docs/content/limitations.md | 37 +++++++++++++++++++++++++++++- docs/content/use.md | 21 +++++++++++++++++ docs/index.md | 17 ++++++++++++-- 8 files changed, 103 insertions(+), 7 deletions(-) delete mode 100644 docs/_templates/footer.html create mode 100644 docs/_templates/footer_center.html create mode 100644 docs/_templates/footer_end.html create mode 100644 docs/content/cheat_sheet.md create mode 100644 docs/content/use.md diff --git a/docs/_templates/footer.html b/docs/_templates/footer.html deleted file mode 100644 index badbd27..0000000 --- a/docs/_templates/footer.html +++ /dev/null @@ -1 +0,0 @@ -

πŸŒΏπŸ› Found a bug? Something not working? Frustrated? Please report it!

\ No newline at end of file diff --git a/docs/_templates/footer_center.html b/docs/_templates/footer_center.html new file mode 100644 index 0000000..3e024aa --- /dev/null +++ b/docs/_templates/footer_center.html @@ -0,0 +1 @@ +

πŸ–– Live long and prosper!

\ No newline at end of file diff --git a/docs/_templates/footer_end.html b/docs/_templates/footer_end.html new file mode 100644 index 0000000..b643889 --- /dev/null +++ b/docs/_templates/footer_end.html @@ -0,0 +1 @@ +

πŸŒΏπŸ› Found a bug? Something not working? Frustrated? Please report it!

\ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 708d758..e11a0f3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -69,13 +69,16 @@ ], } +footcent = str('test') + html_theme_options = { - "announcement": "

Join the Discussion: πŸ’¬ Brightway Community Chat Rooms on Matrix

", + "announcement": "

⚠️ Brightway Live is in Public Beta ⚠️

", # 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 @@ -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" }, diff --git a/docs/content/cheat_sheet.md b/docs/content/cheat_sheet.md new file mode 100644 index 0000000..64796d4 --- /dev/null +++ b/docs/content/cheat_sheet.md @@ -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 +``` \ No newline at end of file diff --git a/docs/content/limitations.md b/docs/content/limitations.md index d817c64..c5d13a9 100644 --- a/docs/content/limitations.md +++ b/docs/content/limitations.md @@ -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). \ No newline at end of file diff --git a/docs/content/use.md b/docs/content/use.md new file mode 100644 index 0000000..e15de8c --- /dev/null +++ b/docs/content/use.md @@ -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 \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 9d84dff..70b5938 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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. + +Screenshot 2023-09-15 at 09 50 53 + +[^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 +content/cheat_sheet +content/limitations ```