docker: add the AGPL-3.0 SPDX header to the new Python files

Every new .py this PR adds now carries the same two-line SPDX header the other
new files in the branch already use (docker/jupyter/unsloth_branding.py), with
the shebang kept first where present. Matches the licensing laid out in
docker/NOTICE: the image bundles Studio (AGPL-3.0) while Unsloth Core stays
Apache-2.0.
This commit is contained in:
Daniel Han 2026-07-16 04:57:43 +00:00
commit 4cfc63e74f
15 changed files with 45 additions and 22 deletions

View file

@ -1,3 +1,6 @@
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-Present the Unsloth team. See /studio/LICENSE.AGPL-3.0
"""Bake a pinned llama.cpp prebuilt into the Docker image, deterministically.
Why not studio/install_llama_prebuilt.py: that resolver selects a bundle for

View file

@ -1,4 +1,7 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-Present the Unsloth team. See /studio/LICENSE.AGPL-3.0
"""Install the Unsloth Studio sloth stickers for the JupyterLab login screen.
The branded login page (login.html) shows a different sloth sticker on each

View file

@ -1,3 +1,6 @@
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-Present the Unsloth team. See /studio/LICENSE.AGPL-3.0
"""
Smoke test for the unsloth-blackwell image.

View file

@ -1,3 +1,6 @@
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-Present the Unsloth team. See /studio/LICENSE.AGPL-3.0
"""Colab cell-magic compatibility for the Unsloth Docker notebooks.
Colab cells often look like:

View file

@ -1,3 +1,6 @@
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-Present the Unsloth team. See /studio/LICENSE.AGPL-3.0
"""Baked IPython startup hook (copied to the profile's startup/ dir).
Runs once per kernel. Registers a pre_run_cell event that activates the right

View file

@ -1,3 +1,6 @@
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-Present the Unsloth team. See /studio/LICENSE.AGPL-3.0
"""Per-notebook transformers version activation for the Unsloth Docker image.
Problem: unslothai/notebooks pin many different transformers versions in their

View file

@ -1,26 +1,7 @@
#!/usr/bin/env python3
# Compare the *content* of two Unsloth notebooks, ignoring the auto-generated
# top/bottom boilerplate that update_all_notebooks.py stamps on every notebook.
#
# Every generated notebook has the same shape:
# - a "top" of boilerplate: the "To run this, press Runtime" announcement, the
# "### News" / Unsloth Studio announcement cells, and the %%capture install
# cell. These churn constantly (new pip pins, new announcements, new links).
# - the "middle": the actual tutorial (data prep, train, inference, save).
# - a "bottom": the "And we're done ... licensed LGPL-3.0" footer cell.
#
# The boot-time notebook refresh uses this to avoid rewriting a user's notebook
# when only that boilerplate moved upstream. We hash ONLY the middle (the cells
# that are not install/announcement/footer) and compare. Outputs, execution
# counts, cell ids and metadata are ignored, so merely running a notebook never
# changes the signature.
#
# Usage:
# unsloth_nb_content_sig.py <a.ipynb> <b.ipynb> -> prints SAME | DIFF | ERR
# unsloth_nb_content_sig.py <a.ipynb> -> prints the middle digest
#
# Exit code is always 0; the decision is the printed word. On any parse problem
# we print ERR / nothing so the caller can fall back to its whole-file logic.
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-Present the Unsloth team. See /studio/LICENSE.AGPL-3.0
import hashlib
import json
import sys

View file

@ -1,3 +1,6 @@
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-Present the Unsloth team. See /studio/LICENSE.AGPL-3.0
"""Route notebook `%pip` / `%uv` / `python -m pip` installs through the shim.
The PATH shim (/opt/unsloth-nb/bin/{pip,pip3,uv} -> unsloth_pip_shim.py) only

View file

@ -1,4 +1,7 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-Present the Unsloth team. See /studio/LICENSE.AGPL-3.0
# Remove the Colab-only "how to run" sentence from Unsloth notebooks for Docker.
#
# Every generated notebook opens with a first markdown cell whose first line is a

View file

@ -1,4 +1,7 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-Present the Unsloth team. See /studio/LICENSE.AGPL-3.0
# Build a categorized, Colab-like folder VIEW of the Unsloth notebooks.
#
# The canonical notebooks live under DEST/nb/<file>.ipynb (a mirror of

View file

@ -1,4 +1,7 @@
#!/opt/unsloth-venv/bin/python
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-Present the Unsloth team. See /studio/LICENSE.AGPL-3.0
"""pip / uv shim for the Unsloth Docker notebook environment.
Installed earlier on PATH than the real tools so a notebook's `!pip install ...`

View file

@ -1,4 +1,7 @@
#!/opt/unsloth-venv/bin/python
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-Present the Unsloth team. See /studio/LICENSE.AGPL-3.0
"""unsloth-run: execute an unslothai/notebooks notebook unchanged, headless.
The robust driven path for the Docker image: it reads the notebook, figures out

View file

@ -1,3 +1,6 @@
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-Present the Unsloth team. See /studio/LICENSE.AGPL-3.0
"""Regression tests for docker/unsloth_nb_pip_magic.py.
The input transformer rewrites explicit `!<python> -m pip|uv ...` shell lines

View file

@ -1,3 +1,6 @@
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-Present the Unsloth team. See /studio/LICENSE.AGPL-3.0
"""Regression tests for docker/unsloth_pip_shim.py.
The shim sits ahead of the real pip/uv on PATH inside the Unsloth Docker

View file

@ -1,4 +1,7 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-Present the Unsloth team. See /studio/LICENSE.AGPL-3.0
"""Cross-platform validation of the Unsloth Docker JupyterLab/notebook features.
Runs WITHOUT Docker or a GPU, so it can execute on the Linux/macOS/Windows CI