From 4cfc63e74f91ac9129ad8831e37ce08f7ec4e6ac Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Thu, 16 Jul 2026 04:57:43 +0000 Subject: [PATCH] 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. --- docker/fetch_llama_prebuilt.py | 3 +++ docker/jupyter/install_sloth_stickers.py | 3 +++ docker/smoke_test.py | 3 +++ docker/unsloth_colab_compat.py | 3 +++ docker/unsloth_ipython_startup.py | 3 +++ docker/unsloth_nb_compat.py | 3 +++ docker/unsloth_nb_content_sig.py | 25 +++-------------------- docker/unsloth_nb_pip_magic.py | 3 +++ docker/unsloth_nb_strip_colab.py | 3 +++ docker/unsloth_nb_view.py | 3 +++ docker/unsloth_pip_shim.py | 3 +++ docker/unsloth_run.py | 3 +++ tests/python/test_unsloth_nb_pip_magic.py | 3 +++ tests/python/test_unsloth_pip_shim.py | 3 +++ tests/validate_studio_features.py | 3 +++ 15 files changed, 45 insertions(+), 22 deletions(-) diff --git a/docker/fetch_llama_prebuilt.py b/docker/fetch_llama_prebuilt.py index 6e4c61c01c..4511057e64 100644 --- a/docker/fetch_llama_prebuilt.py +++ b/docker/fetch_llama_prebuilt.py @@ -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 diff --git a/docker/jupyter/install_sloth_stickers.py b/docker/jupyter/install_sloth_stickers.py index 12c1125bc0..4289eb432b 100644 --- a/docker/jupyter/install_sloth_stickers.py +++ b/docker/jupyter/install_sloth_stickers.py @@ -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 diff --git a/docker/smoke_test.py b/docker/smoke_test.py index 19da83f8bc..b44f70f7d3 100644 --- a/docker/smoke_test.py +++ b/docker/smoke_test.py @@ -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. diff --git a/docker/unsloth_colab_compat.py b/docker/unsloth_colab_compat.py index b01833bee8..a4b3d9b7a5 100644 --- a/docker/unsloth_colab_compat.py +++ b/docker/unsloth_colab_compat.py @@ -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: diff --git a/docker/unsloth_ipython_startup.py b/docker/unsloth_ipython_startup.py index a3d8b2cb2b..cd5ac44365 100644 --- a/docker/unsloth_ipython_startup.py +++ b/docker/unsloth_ipython_startup.py @@ -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 diff --git a/docker/unsloth_nb_compat.py b/docker/unsloth_nb_compat.py index 621a7ba4cd..59ff2bc770 100644 --- a/docker/unsloth_nb_compat.py +++ b/docker/unsloth_nb_compat.py @@ -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 diff --git a/docker/unsloth_nb_content_sig.py b/docker/unsloth_nb_content_sig.py index d3dfcb738d..03640e262d 100644 --- a/docker/unsloth_nb_content_sig.py +++ b/docker/unsloth_nb_content_sig.py @@ -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 -> prints SAME | DIFF | ERR -# unsloth_nb_content_sig.py -> 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 diff --git a/docker/unsloth_nb_pip_magic.py b/docker/unsloth_nb_pip_magic.py index 78ddb36995..a33dc64015 100644 --- a/docker/unsloth_nb_pip_magic.py +++ b/docker/unsloth_nb_pip_magic.py @@ -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 diff --git a/docker/unsloth_nb_strip_colab.py b/docker/unsloth_nb_strip_colab.py index 4e4e457307..a5364a7b50 100644 --- a/docker/unsloth_nb_strip_colab.py +++ b/docker/unsloth_nb_strip_colab.py @@ -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 diff --git a/docker/unsloth_nb_view.py b/docker/unsloth_nb_view.py index 89dd8c7b8d..3c6e2f8c3d 100644 --- a/docker/unsloth_nb_view.py +++ b/docker/unsloth_nb_view.py @@ -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/.ipynb (a mirror of diff --git a/docker/unsloth_pip_shim.py b/docker/unsloth_pip_shim.py index 0aef89328a..454bf28303 100644 --- a/docker/unsloth_pip_shim.py +++ b/docker/unsloth_pip_shim.py @@ -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 ...` diff --git a/docker/unsloth_run.py b/docker/unsloth_run.py index 4c8c0d51ac..93800e3ebe 100644 --- a/docker/unsloth_run.py +++ b/docker/unsloth_run.py @@ -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 diff --git a/tests/python/test_unsloth_nb_pip_magic.py b/tests/python/test_unsloth_nb_pip_magic.py index 3e6b3b975a..adbab11f2b 100644 --- a/tests/python/test_unsloth_nb_pip_magic.py +++ b/tests/python/test_unsloth_nb_pip_magic.py @@ -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 `! -m pip|uv ...` shell lines diff --git a/tests/python/test_unsloth_pip_shim.py b/tests/python/test_unsloth_pip_shim.py index 639afafaaf..3dd002e707 100644 --- a/tests/python/test_unsloth_pip_shim.py +++ b/tests/python/test_unsloth_pip_shim.py @@ -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 diff --git a/tests/validate_studio_features.py b/tests/validate_studio_features.py index 85e3310001..4f4c2cdd82 100644 --- a/tests/validate_studio_features.py +++ b/tests/validate_studio_features.py @@ -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