-
Notifications
You must be signed in to change notification settings - Fork 7
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
Update for webr v0.4.x & expose baseUrl
/repoUrl
in configuration
#8
Comments
Yes. I do plan to upgrade the kernel to webR 0.4.x in the near future, but it is low priority right now as other needs are currently taking my attention.
For the moment, does using a pre-built version of webR and setting the following option at start up serve your needs?
Interesting! It looks like the build fails because |
The package load via ![]() I'm aiming for a completely self-contained version of JupyterLite that can be published from a single trusted domain. Re: the build, I managed to build the latest version v.0.4.x ok. Should I be able to just drop that in here or are there breaking changes 0.3.x.-> 0.4.x that will impact here? |
Gotcha, you might also be able to override the base URL and repo URL in Change this: jupyterlite-webr-kernel/src/webr_kernel.ts Lines 22 to 26 in 3c22ad5
To something like this: this.#webRConsole = new Console({
stdout: (line: string) => console.log(line),
stderr: (line: string) => console.error(line),
prompt: (prompt: string) => this.inputRequest({ prompt, password: false }),
},{
baseUrl: "https://some-other-base-url/subdir/",
repoUrl: "https://some-other-repo-url/subdir/",
REnv: {
R_HOME: '/usr/lib/R',
FONTCONFIG_PATH: '/etc/fonts',
R_ENABLE_JIT: '0',
}); Ideally we would make this available to the kernel user as a parameter without needing to hack the source like this. For this to work, the base Url assets will need to match the version of webR installed in node. |
Ah, thanks v. much, will try that. |
That seems to throw a UPDATE: my eyes are shot today! Missing |
Re: strategies for making this user configurable, jupyterlite offers three file configuration options; the |
Yes, |
baseUrl
/repoUrl
in configuration
Ah, yes, webR < 0.4.1 does not support compressed filesystem images. So the issue will be solved once we upgrade webR here. Are you using r-wasm/actions? If so you should be able to set
If you are using the
|
In passing, to allow me to read CSV files that are shipped with a distribution as content into local browser storage, and which are exposed via the JuptyerLite URL on the function getFormattedUrl(url: string = window.location.href): string {
try {
const urlObj = new URL(url);
// Get protocol (includes the trailing ':')
const protocol = urlObj.protocol;
// Get domain (hostname includes subdomains)
const domain = urlObj.hostname;
// Get port if it exists
const port = urlObj.port ? `:${urlObj.port}` : '';
// Get path and remove any file names (like index.html)
let path = urlObj.pathname;
path = path.replace(/\/[^\/]+\.[^\/]+$/, '/');
// Strip the /lab path element
path = path.replace(/\/lab\/?$/, '/');
// Ensure path ends with trailing slash
if (!path.endsWith('/')) {
path += '/';
}
return `${protocol}//${domain}${port}${path}`;
} catch (e) {
// Return empty string or throw error based on your needs
return '';
}
}
async setupEnvironment(): Promise<void> {
...
// Try to set the path
const currentUrl = getFormattedUrl();
await this.webR.evalRVoid(`JUPYTERLITE_PATH <- "${currentUrl}"`);
....
|
Is the migration to WebR 4 simply a case of updating packages, or does webR behave differently and require rather deeper plumbing changes here? And where would be a good place to start looking for the relevant v3->v4 diffs in the webr code? |
As far as I can remember, there should not be significant API changes between webR 0.3.x and 0.4.x for this use case. It should simply be a matter of updating the packages. There are some changes, but I don't think they affect the code used in this kernel - though I could be wrong. A good first step would be to:
|
Thanks. Will give it a try when I get a chance. So presumably the node updates (I'm not an npm user..) are:
|
Looks like there is also:
|
EDIT: Scratch that, this project uses the Anyway, try:
|
Hi
Are there any plans to upgrade the kernel to webr 0.4.x?
I'm trying to build a custom distribution that requires a custom built webr with a different built in webr repo path. Trying to build a v0.3.x webr dropin (albeit v0.3.3 rather than 0.3.0) is failing for me (requires py 3.11; build fails with broken cflags?) whereas I had success building latest webr build.
The text was updated successfully, but these errors were encountered: