diff --git a/docker/unsloth_pip_shim.py b/docker/unsloth_pip_shim.py index 22c7eaf224..1a6ce4ab97 100644 --- a/docker/unsloth_pip_shim.py +++ b/docker/unsloth_pip_shim.py @@ -457,12 +457,7 @@ def main(): # `-r`-only cell no-ops (has_target stays False) and an attached # `-c`/`-e`/`-P` value bypasses _KEEP. Split the 2-char flag from its # value and reuse the separated-form handling. - if ( - len(tok) > 2 - and tok[0] == "-" - and tok[1] != "-" - and tok[:2] in _ATTACHED_SHORT_FLAGS - ): + if len(tok) > 2 and tok[0] == "-" and tok[1] != "-" and tok[:2] in _ATTACHED_SHORT_FLAGS: _sflag, _sval = tok[:2], tok[2:] if _sflag in _REQ_FILE_FLAGS: _req_path, _req_rec, _req_drp = _filter_requirements_file(_sval) diff --git a/tests/python/test_unsloth_pip_shim.py b/tests/python/test_unsloth_pip_shim.py index e99f26af00..0ea57373af 100644 --- a/tests/python/test_unsloth_pip_shim.py +++ b/tests/python/test_unsloth_pip_shim.py @@ -225,8 +225,7 @@ def test_index_url_value_flag_kept_verbatim(shim): def test_editable_protected_in_requirements_file_dropped(shim, tmp_path): req = tmp_path / "reqs.txt" req.write_text( - "-e git+https://github.com/unslothai/unsloth.git#egg=unsloth\n" - "snac==1.2.0\n", + "-e git+https://github.com/unslothai/unsloth.git#egg=unsloth\nsnac==1.2.0\n", encoding = "utf-8", ) execd, _ = _run(shim, "pip", ["-r", str(req)]) @@ -239,8 +238,7 @@ def test_editable_protected_in_requirements_file_dropped(shim, tmp_path): def test_editable_attached_protected_in_requirements_file_dropped(shim, tmp_path): req = tmp_path / "reqs.txt" req.write_text( - "-egit+https://github.com/unslothai/unsloth.git#egg=unsloth\n" - "snac==1.2.0\n", + "-egit+https://github.com/unslothai/unsloth.git#egg=unsloth\nsnac==1.2.0\n", encoding = "utf-8", ) execd, _ = _run(shim, "pip", ["-r", str(req)]) @@ -255,9 +253,7 @@ def test_editable_unprotected_in_requirements_file_kept(shim, tmp_path): # (torch dropped); only protected editables are stripped. req = tmp_path / "reqs.txt" req.write_text( - "-e ./localpkg\n" - "torch==2.11.0\n" - "snac==1.2.0\n", + "-e ./localpkg\ntorch==2.11.0\nsnac==1.2.0\n", encoding = "utf-8", ) execd, _ = _run(shim, "pip", ["-r", str(req)])