question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FEATURE] Multiple py-envs in a single html file

See original GitHub issue

Assuming it’s possible, having multiple, different, simultaneously available py-envs could be very useful. As an easy example, consider two interactive demonstrations of different major versions of the same library, illustrating a new feature or breaking change. Or different versions of Python showing performance improvements with runnable tests.

There could be a one-to-many relationship between <py-env> tags and other py-script tags that use them. The one-to-one case would still be the most common, so existing html files could work as-is. For the others, we could allow an optional id to connect the tags. E.g. <py-env id="foo"> could be used by name with both <py-script py-env="foo"> and <py-repl py-env="foo"> being present in the same html file, along with any additional groups like id="bar".

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
fpligercommented, May 24, 2022

It sounds that different options could serve different use cases. Would be good to understand the need for the many use cases, the actual effort in each option, and rough benchmark (to understand how much we actually get with each one) to help prioritize

1reaction
rthcommented, May 24, 2022

I was definitely hoping that the loading time addition would have been only from new packages since the packages shared by environments would have run already.

So there could be different ways to approach this,

  1. creating a new Pyodide instance is similar in spirit to creating to launching separate VMs. One would get a separate Emscripten virtual filesystem, a separate Python but it’s indeed more expensive to setup. We need to benchmark how much is the overhead exactly (and it likely depends how good is the browser at caching).
  2. taking the virtualenv analogy, it should be possible to keep a single Emscripten virtual filesystem, a single Python but install packages into a separate prefix/folder in the file system. This would require some work, as in particular the venv stdlib module is not available, and unlike with virtualenv it’s not possible to have multiple Python executables in this use case. Still, I imagine it should be possible and it would be lighter than option 1.
  3. Finally, it’s possible to have a single set of packages, but different globals objects and different states, which would be even faster, but then you can’t indeed have the multiple versions of the same library installed, so it would likely not address this issue.
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to manage multiple Python versions and virtual ...
Let's explore the use cases for: venv / pyvenv; pyenv; pyenv-virtualenv. If you are using a single version of Python ...
Read more >
Managing Multiple Python Versions With pyenv
In this step-by-step tutorial, you'll learn how to install multiple Python versions and switch between them with ease, including project-specific virtual ...
Read more >
How To Use Python Version Management with Pyenv
But thankfully, in reality, it's very easy to do. You can manage multiple Python versions with relative ease using pyenv.
Read more >
Managing Version, Virtual Environments and Dependencies ...
There are several options, but let's focus on two: pyenv manages different versions of Python on the same machine; poetry manages virtual ...
Read more >
How to use pyenv to run multiple versions of Python on a Mac
Note that I used single quotes with echo so it does not evaluate and expand the commands. The .zshrc file only manages zsh...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found