Skip to content
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

Snap package #751

Closed
wants to merge 3 commits into from
Closed

Conversation

dmitry-lyfar
Copy link
Contributor

@dmitry-lyfar dmitry-lyfar commented Jan 23, 2024

Description

Adds snap package building and publishing.

  • The chosen confinement for the snap is 'classic' due to the issues that the 'strict' confinement has when a user works with files in $HOME. JupyterLab server creates temporary hidden files in the working directory. The strict confinement prohibits creating those in the home directory which results in a permission denied error when JLD attempts to (auto-)save.
  • GitHub workflows extended with steps that builds, uploads and publishes snap. There are two publish steps to allow publishing edge snaps built with the latest changes automatically and publishing stable releases to the latest/stable for the tagged commits. Publishing requires:
    • Registering a snap name (e.g. jupyterlab-desktop) in Snap Store.
    • Snap Store credentials that can be obtained as:
$ snapcraft export-login --snaps=jupyterlab-desktop \
      --acls package_access,package_push,package_update,package_release \
      exported.txt

@mbektas I have not registered a snap name as it should probably be done under Jupyter Project publisher. When registered, we can obtain the store credentials and have the publishing workflow working. Also, when done, we would need to apply for the classic snap approval as only the strict ones are allowed for automatic publishing (I can take care of that as well).

Contains additional properties to make the shell commands work from
within the strict confinement. JP Desktop uses the SHELL environment
variable to launch a shell command and if SHELL is different from what
is available in the snap's core (e.g. /usr/bin/zsh), the command would
fail. Thus, bash is ensured as the SHELL option
* The snap's confinement mode is switched to classic. Mostly because JL
Server creates hidden and temp files in a jupyter notebook directory it
has open (e.g. for checkpoints or when it saves the file). Thus, if a
user has a notebook stored in $HOME, JLD fails to save it with a
permission denied error. It cannot be resolved with the snap's
personal-files interface as the interface allows to specify existing
paths only.
Copy link

welcome bot commented Jan 23, 2024

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please make sure you followed the pull request template, as this will help us review your contribution more quickly.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@mbektas
Copy link
Member

mbektas commented Feb 15, 2024

@dmitry-lyfar I tested these changes locally (on a Ubuntu aarch64) and ran into the problems below. do you know of solutions for these by changing the snap configuration? or do we have to make changes to app code?

  1. double clicking the snap file didn't install. this seems to be related to classic confinement. I had to run this command on CLI to install: sudo snap install ./JupyterLab.snap --classic --dangerous
  2. The userData and home directories used by the app changed to subfolders in ~/snap/jupyterlab-desktop/x1/. this causes issues with restoring settings from previous debian installation. but more concerning issue is in #3 below
  3. Uninstalling the app also removed the settings and Python environment installation by the app because they got installed into paths in #2 and those got deleted.

@dmitry-lyfar
Copy link
Contributor Author

Hi @mbektas,

  1. double clicking the snap file didn't install. this seems to be related to classic confinement. I had to run this command on CLI to install: sudo snap install ./JupyterLab.snap --classic --dangerous

Yes, this is because snaps are not distributed as standalone archives. When we publish, a user would be able to do snap install jupyterlab-desktop --classic from the CLI or just click a button if they use a GUI Snap Store desktop app. No need to download anything.

  1. The userData and home directories used by the app changed to subfolders in ~/snap/jupyterlab-desktop/x1/. this causes issues with restoring settings from previous debian installation. but more concerning issue is in #3 below
  2. Uninstalling the app also removed the settings and Python environment installation by the app because they got installed into paths in #2 and those got deleted.
    Do you mean the bundled Python environment that is created and installed into ~/snap/jupyterlab-desktop/current/.config/?

By default, the data created within snap user directories is snapshotted and stored for, I believe, 30 days (see snap saved et al) if the snap is removed. The data is removed as well but can be recovered if snap is re-installed or via snap restore. If you prefer the bundled environment to be preserved even if JLD snap is removed, I can have a look into. But I suppose that the bundled environment is something that has a life-time of the application. If needed for longer, a user should point the application to the pre-existing environment?

@mbektas mbektas mentioned this pull request Feb 24, 2024
@mbektas mbektas closed this Feb 24, 2024
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

Successfully merging this pull request may close these issues.

2 participants