Access kernel environment variables from a JupyterLab extension - jupyter-lab

I have a button extension for JupyterLab.
This extension gives the option to run tools with one click.
I want to show a value from the kernel ENV, let's say 'JOB_NAME' for the opened notebook.
How can I access this ENV variable from the extension TypeScript Code?

Related

How do I set logo and launchers in Jupyterlab and Jupyterhub?

I'm trying to customize Jupyterhub and Jupyterlab my goal is to remove/change Logos and Launchers.
Questions are:
For Jupyterhub I'm trying to remove the logo setting c.Jupyterhub.logo_file to none, that's an option on jupyterhub_config.py near spawner_class. Is it possible?
How do I remove Jupyterlab Launcher? I already tryed to remove this feature using jupyter labextension disable #jupyterlab/launcher-extension while building the image but it didn't worked.
For the logo, I am not sure about JupyterHub-specific solutions, but you could see how Elyra does that for their JupyterLab distribution with Elyra theme extension here (under Apache License, so it should not be pasted in here). In short they first locate the icon in the "top" area of JupyterFrontEnd.shell (which implements IShell interface) using IShell.widgets and then write their own icon into the located container.
For the replacing the initial animation, you would want to swap the #jupyterlab/apputils-extension:splash plugin, not the launcher extension. Launcher is what allows users to start new notebooks from the main area widget.

How to create a SnoreToast start menu shortcut with a Working Directory to a .BAT file?

Using node-notifier#7.0.0's SnoreToast on NodeJS v13.13.0, I am trying to create a Start Menu shortcut to use as appID for SnoreToast's notifications, I have a .BAT file that runs the command node "src\index.js", and I'm assigning this .BAT file as the target application of the SnoreToast shortcut as seen below:
"..\node_modules\node-notifier\vendor\snoreToast\snoreToast-x64.exe" -install "SomeAppName\SomeAppName" "c:\Users\Redacted\Desktop\proj\start.bat" "app.someappname"
The shortcut is successfully installed on the Start Menu in a folder named SomeAppName and the shortcut itself named SomeAppName aswell, and when I open the shortcut, it targets the correct start.bat file, but the start.bat is unable to fullfill it's purpose due to the shortcut opening it on C:/WINDOWS/System32 and ultimately wrongly targets C:/WINDOWS/System32/src/index.js, causing it to fail.
By manually editing the shortcut's "Start in" option on the Properties dialog in File Explorer to the correct path of my project (C:/Users/Redacted/Desktop/proj) and saving, it runs perfectly, but obviously I don't want to make my users have to manually do this work + the application should be portable and runnable anywhere it's stored on the FS, so how would I edit the "Start in" (aka Working Directory) of a SnoreToast shortcut on creation? I've already tried to Google it but all the results are unrelated and SnoreToast's documentation doesn't address this issue either.
A solution that does not require any additional npm packages would be preferred, but one that uses an npm package is acceptable aswell. All help is appreciated.

Sharing Virtual Environments With Other Developers

I have made a virtual environment using python3.
virtualenv -p python3 py36
In a folder named environments within a project folder.
When activated, and I run which python3 the output is:
(py36) ur#comp:~/Desktop/project$ which python3
/home/ur/Desktop/project/environments/py36/bin/python3
My question is, how can another developer use the same virtual environment if they were to pull from a cloud repository?
What we found is that when they active the environment, it would use the path above; which isn't correct for his machine, thus he is not able to use the env.
We temporarily fixed the problem by changing the path above, to the their machine's path, wherever it appeared in the files within the env. However, I will have the same problem if I pull the project after he modifies.
We would like to know if there is a way to share the virtual env, in a way that we don't have to change each path.
Thank you for your time.
Virtual environments aren't relocatable. Developers has to create their own environments.

Run Chrome Extensions using command prompt

Is it possible to run a chrome extension from command line?
I need to automate the process for my software, and my software will need to run that extension with a particular parameter.
I am using a Chrome Extension 'APK Downloader' by Yogi. The Extension works like this:-
"If a page contains any .apk file link, then when I click on the extension's icon on the address bar, it starts direct download of that .apk file"
Now, I have my software that needs some .apk file to download [The software will have the package name of the .apk file to be downloaded, which is used by the extension to generate a download link]. It will be an automatic process. So, I need to know if it is possible to pass a parameter to the extension automatically, and make the extension to work without clicking on it.
Is it possible to do so??
Unpacked extension can be loaded using the --load-extension= flag.
What I usually do is chromium --user-data-dir=/tmp/someuniquedirname --load-extension=path/to/extension --no-first-run.
The --user-data-dir= flag is used to specify a non-default user data directory, to minimize conflicts between your existing browser profile and the test directory. You can omit this flag if you want to use your default user profile.
The --no-first-runflag prevents the first run UI from showing up (e.g. the bubble that explains how to use the omnibox, and a "Getting Started" page that opens in a new tab).
You can load multiple extensions by separating the paths by commas, e.g. chromium --load-extension=path/to/one/extension,path/to/another/extension.
I have published some shell scripts and a convenience extension to speed up (manual) testing of Chrome extensions. Take a look at https://github.com/Rob--W/extension-dev-tools/tree/master/chrome.
it helps to open extension normally and after that hit F12 (dev tools) to see actual url...
having that i can, for example load "Selenium IDE" chrome extension as
(run from command prompt)
"C:\Program Files (x86)\Google\Chrome\Application\new_chrome.exe" chrome-extension://mooikfkahbdckldjjndioackbalphokd/index.html
on a mac:
osascript <<EOD
set theURL to "chrome://extensions/"
tell application "Google Chrome"
if windows = {} then
make new window
set URL of (active tab of window 1) to theURL
else
make new tab at the end of window 1 with properties {URL:theURL}
end if
activate
end tell
EOD
Question answered here:
https://superuser.com/a/979678

Chrome external extension not shown in extension list

I'm trying to install a Chrome external extension using a visual studio setup project and following the instructions listed in http://code.google.com/chrome/extensions/external_extensions.html#registry, I did the following to add an external extension to Google chrome:
Packed the extension and moved the resulting .crx file to a folder C:\Hafez\Grid_Bootstrapper
I've added a registry sub key named fnfnbeppfinmnjnjhedifcfllpcfgeea under the following path: HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\Extensions\ with the next two values:
1.path with a value of "C:\Hafez\Grid_Bootstrapper\fnfnbeppfinmnjnjhedifcfllpcfgeea.crx" and
2.version with a value of "1.0.0.1"
which are, by the way, the exact values but unfortunately when I start Chrome the extension is not listed.
BTW, I'm doing this in a installer custom action and it writes the values exactly the way I want them.
I can't find what is wrong because I do the exact steps listed in the link.
May you discover what have I done wrong?

Resources