Skip to content

Suggested new section: Task based Guide (to supplement faq) #180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Neon22 opened this issue Apr 15, 2025 · 5 comments
Open

Suggested new section: Task based Guide (to supplement faq) #180

Neon22 opened this issue Apr 15, 2025 · 5 comments

Comments

@Neon22
Copy link
Contributor

Neon22 commented Apr 15, 2025

In some systems this might be the Faq and the current faq might be a series of guides or recipes.

Anyway the section might look like this:

Task based Guide:

Where do I begin
 - https://docs.pyscript.net/2025.3.1/user-guide/first-steps/

How do I configure pyscript to load packages, and local files
 - https://docs.pyscript.net/2025.3.1/user-guide/configuration/

How do I setup my local machine for pyscript development
 - https://www.pyscript.com/
 - https://docs.pyscript.net/2025.3.1/faq/#packaging-pointers

I've got an unexpected error
 - https://docs.pyscript.net/2025.3.1/faq/#common-errors

Dom Event code is not being called
 - https://docs.pyscript.net/2025.3.1/user-guide/ffi/#create_proxy
 - https://docs.pyscript.net/2025.3.1/faq/#common-errors

Using a javascript module from my python code
 - https://docs.pyscript.net/2025.3.1/user-guide/dom/#working-with-javascript

Direct dom manipulations from python
 - https://docs.pyscript.net/2025.3.1/user-guide/dom/#pyscriptweb
 - https://docs.pyscript.net/2025.3.1/api/#pyscriptweb
 - https://docs.pyscript.net/2025.3.1/api/#pyscriptwhen

Sending Javascript args from python to Javascript (and vice versa)
 - https://docs.pyscript.net/2025.3.1/user-guide/ffi/

Converting Python entities into Javascript args
 - https://docs.pyscript.net/2025.3.1/user-guide/ffi/

Saving and loading from the in-browser filesystem
 - https://docs.pyscript.net/2025.3.1/user-guide/filesystem/#the-in-browser-filesystem
 - https://docs.pyscript.net/2025.3.1/api/#pyscriptstorage

Saving and loading from the user's local filesystem (single or multiple)
 - https://docs.pyscript.net/2025.3.1/user-guide/filesystem/#the-devices-local-filesystem
 - https://docs.pyscript.net/2025.3.1/api/#pyscriptfs

Recipe for saving/loading a file to users file system
 - https://docs.pyscript.net/2025.3.1/faq/#upload

Fetching data from a remote URL
 - https://docs.pyscript.net/2025.3.1/api/#pyscriptfetch

Getting user input from the Terminal
 - https://docs.pyscript.net/2025.3.1/user-guide/terminal/
 - https://docs.pyscript.net/2025.3.1/user-guide/editor/

Getting user input from the Ltk UI toolkit
 - https://pyscript.github.io/ltk/?tab=2&runtime=mpy

Adjusting Terminal parameters (size, clearing, colors, etc)
 - https://docs.pyscript.net/2025.3.1/user-guide/terminal/#xterm-reference

Running code in an editor style interface
 - https://docs.pyscript.net/2025.3.1/user-guide/editor/

Getting access to media devices like Camera and Sound
 - https://docs.pyscript.net/2025.3.1/user-guide/media/
 - https://docs.pyscript.net/2025.3.1/api/#pyscriptmedia

Making a PWA and installing offline
 - https://pyscript.com/docs/pwa

How do I make Workers work for me
 - https://docs.pyscript.net/2025.3.1/user-guide/workers/
 - https://docs.pyscript.net/2025.3.1/api/#pyscriptcoredonkey
 - https://docs.pyscript.net/2025.3.1/faq/#possible-deadlock
 - https://docs.pyscript.net/2025.3.1/faq/#workers-via-javascript

How do I find events indicating when pyscript is loaded/done, etc
 - https://docs.pyscript.net/2025.3.1/faq/#pyscript-events
@WebReflection
Copy link
Contributor

I really like this approach and wondering if @ntoll shares the same feeling

@ntoll
Copy link
Member

ntoll commented Apr 15, 2025

Yup. Working on it.

@Neon22
Copy link
Contributor Author

Neon22 commented Apr 28, 2025

More:

Your worker only runs once.

  • you are probably missing an await before calling it, and/or an async on the calling function

@Neon22
Copy link
Contributor Author

Neon22 commented May 9, 2025

For workers we now appear to have a number of choices - the use cases of which are not exactly clear:

You want to load (fetch) a file from a remote url resource:
 - use a service worker
 - https://docs.pyscript.net/2025.3.1/user-guide/workers/#option-2-service-worker-attribute
 - example 

@Neon22
Copy link
Contributor Author

Neon22 commented May 12, 2025

Also:
localStorage and sessionStorage are referred to as "Web Storage" and are disabled by some browsers(e.g. Firefox) when setting "disable third party cookies".
localstorage and Sessionstorage are synchronous and so the code waits for them to be accessed.

An async mechanism that performs the same objective and is not blocked by "third party cookie" settings is the "IndexedDB" storage. This is also available in Workers. Pyscript accesses this under pyscript.storage
It is documented for pyscript here: https://docs.pyscript.net/2025.3.1/api/#pyscriptstorage
This interface is synchronous and does async internally. (A write can be awaited).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants