Skip to main content

jupyterlite-pyodide-lock

Create pre-solved environments for jupyterlite-pyodide-kernel with pyodide-lock.

docs install build
docs install from pypi install from conda-forge build

View the full documentation on ReadTheDocs.

Installing

pip install jupyterlite-pyodide-lock

or:

mamba install -c conda-forge jupyterlite-pyodide-lock

Usage

Configure

Requirements

A number of ways to add requirements to the lock file are supported:

  • adding wheels in {lite_dir}/static/pyodide-lock
  • configuring specs as a list of PEP508 dependency specs
  • configuring packages as a list of
    • URLs to remote wheels that will be downloaded and cached
    • local paths relative to lite_dir of .whl files (or folders of wheels)
{
  "PyodideLockAddon": {
    "enabled": true,
    "specs": ["ipywidgets >=8.1,<8.2"],
    "packages": ["../dist/ipywidgets-8.1.2-py3-none-any.whl", "../dist"]
  }
}

Lockers

The Locker is responsible for starting a browser, executing micopip.install and micropip.freeze to try to get a viable lock file solution.

{
  "PyodideLockAddon": {
    "enabled": true,
    "locker": "browser"
  },
  "BrowserLocker": {
    "browser": "firefox",
    "headless": true,
    "private_mode": true,
    "temp_profile": true
  }
}

A convenience CLI options will show some information about detected browsers:

jupyter pyodide-lock browsers

Reproducible Locks

By configuring the lock date to a UNIX epoch timestamp, artifacts from a PyPI index newer than that date will be filtered out before a lock is attempted.

Combined with a fixed pyodide_url archive, this should prevent known packages and their dependencies from "drifting."

{
  "PyodideAddon":
    {
      "pyodide_url": f"https://github.com/pyodide/pyodide/releases/download/0.25.0/pyodide-core-0.25.0.tar.bz2",
    },
  "PyodideLockAddon": { "enabled": true, "lock_date_epoch": 1712980201 }
}

Alternately, this can be provided by environment variable:

JLPL_LOCK_DATE_EPOCH=$(date -u +%s) jupyter lite build
Getting a lock_date_epoch

As shown in the example above, date can provide this:

date -u +%s

Or python:

>>> from datetime import datetime, timezone
>>> int(datetime.now(tz=timezone.utc).timestamp())

... or git, for the last commit time of a file:

git log -1 --format=%ct requirements.txt

The latter approach, using version control metadata, is recommended, as it shifts the burden of bookkeeping to a verifiable source.

Metadata

Release files for jupyterlite-pyodide-lock 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jupyterlite-pyodide-lock 0.1.1
File Size Uploaded
jupyterlite_pyodide_lock-0.1.1.tar.gz 29.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jupyterlite-pyodide-lock 0.1.1
File Interpreter ABI Platform
jupyterlite_pyodide_lock-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 64.3 kB

Release files / jupyterlite_pyodide_lock-0.1.1.tar.gz

Download URL jupyterlite_pyodide_lock-0.1.1.tar.gz
Size 29.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a1dbd7c86a09a56e5decdb8bf8a210fd45bd1f32074ba406a1c28c995ce96809
BLAKE2b-256 checksum
How to use checksums
5be874ce6a0054e66788843ad9e3832449958e23bc1ceb16ed22466a1cc6bcaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / jupyterlite_pyodide_lock-0.1.1-py3-none-any.whl

Download URL jupyterlite_pyodide_lock-0.1.1-py3-none-any.whl
Size 34.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72ff81d6acaa66c7b1db3fd7a933140dd6a0dced8d2ec3513c258cdce14b2b88
BLAKE2b-256 checksum
How to use checksums
cd9e4ea48c6481aee097e1fd2628ac183146234944ac180b257cc3180bd87ae5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page