Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code_sandboxes/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.11.2"
__version__ = "1.11.3"
4 changes: 4 additions & 0 deletions code_sandboxes/environments/adapters/datalayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ def _contract_user() -> list[str]:
f"else useradd -u {uid} -g {gid} -d {home} -s /bin/bash {user}; fi "
f"&& mkdir -p {home}/content {home}/.local/share/jupyter/runtime/external_kernels "
f"&& chown -R {uid}:{gid} {home}",
# The config comes from the base's channel, which may start a kernel
# elsewhere; conformance:2 reads the kernel's cwd.
f"RUN echo \"c.MappingKernelManager.root_dir = '{contract.workdir}'\" "
">> /usr/local/share/jupyter_config.py",
f"ENV HOME={home} LANG={contract.locale} LC_ALL={contract.locale} "
f"LANGUAGE={contract.locale} TZ=Etc/UTC PATH=$PATH:/opt/datalayer/bin",
'ENTRYPOINT ["/opt/datalayer/bin/tini", "-g", "--"]',
Expand Down
9 changes: 9 additions & 0 deletions tests/test_environment_foreign_contract_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,3 +500,12 @@ def test_the_doctor_of_an_older_base_finds_its_working_directory():
created = next(line for line in _contract_user() if "external_kernels" in line)
assert "/home/datalayer/content" in created
assert created.index("/home/datalayer/content") < created.index("chown -R")


def test_the_kernel_runs_in_the_contracts_working_directory():
"""`/usr/local/share/jupyter_config.py` is the channel's own, and a channel's
may start a kernel elsewhere: conformance:2 reads the kernel's cwd."""
from code_sandboxes.environments.adapters.datalayer import _contract_user

pinned = next(line for line in _contract_user() if "MappingKernelManager.root_dir" in line)
assert "/home/datalayer" in pinned and "/usr/local/share/jupyter_config.py" in pinned
Loading