Last active
April 5, 2024 16:04
-
-
Save goerz/bb2f1589d2aa523ffa8ccd4d0addcd86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
channels: | |
- conda-forge | |
dependencies: | |
- ipykernel=6.26.0 | |
- ipython=8.17.2 | |
- pip=24.0 | |
- python=3.10 | |
- ipympl=0.9.3 | |
- ipywidgets=8.1.2 | |
- jupyterlab=4.0.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"id": "303f30e9-c78e-44c1-8c59-3d8bacda5999", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2024-04-04T17:07:10.225", | |
"iopub.status.busy": "2024-04-04T17:07:10", | |
"iopub.status.idle": "2024-04-04T17:07:10.446", | |
"shell.execute_reply": "2024-04-04T17:07:10.421" | |
} | |
}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"\u001b[32m\u001b[1m Activating\u001b[22m\u001b[39m new project at `/var/folders/mm/rr6dgkzj0l5_j_ntxcg_hlth0000gn/T/jl_GJknNc`\n" | |
] | |
} | |
], | |
"source": [ | |
"using Pkg\n", | |
"Pkg.activate(temp=true)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"id": "7aaa06c9-cfee-4fd4-9718-dfd5cb179cba", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2024-04-04T17:07:10.446", | |
"iopub.status.busy": "2024-04-04T17:07:10.446", | |
"iopub.status.idle": "2024-04-04T17:07:18.041", | |
"shell.execute_reply": "2024-04-04T17:07:18.041" | |
} | |
}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"\u001b[32m\u001b[1m Resolving\u001b[22m\u001b[39m package versions...\n", | |
"\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m `/private/var/folders/mm/rr6dgkzj0l5_j_ntxcg_hlth0000gn/T/jl_GJknNc/Project.toml`\n", | |
" \u001b[90m[0b91fe84] \u001b[39m\u001b[92m+ DisplayAs v0.1.6\u001b[39m\n", | |
"\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m `/private/var/folders/mm/rr6dgkzj0l5_j_ntxcg_hlth0000gn/T/jl_GJknNc/Manifest.toml`\n", | |
" \u001b[90m[0b91fe84] \u001b[39m\u001b[92m+ DisplayAs v0.1.6\u001b[39m\n" | |
] | |
} | |
], | |
"source": [ | |
"# We're not installing IJulia: it is assumed you have this running in Jupyter\n", | |
"Pkg.add(\"DisplayAs\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"id": "87e415dc-2f15-4905-a9fd-d00153b17c94", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2024-04-04T17:07:18.041", | |
"iopub.status.busy": "2024-04-04T17:07:18.041", | |
"iopub.status.idle": "2024-04-04T17:07:18.041", | |
"shell.execute_reply": "2024-04-04T17:07:18.041" | |
} | |
}, | |
"outputs": [], | |
"source": [ | |
"import IJulia" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"id": "30116c3a-939e-4d69-9909-a701e93588ac", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2024-04-04T17:07:18.042", | |
"iopub.status.busy": "2024-04-04T17:07:18.042", | |
"iopub.status.idle": "2024-04-04T17:07:18.248", | |
"shell.execute_reply": "2024-04-04T17:07:18.248" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"v\"1.24.2\"" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"pkgversion(IJulia)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"id": "02c6bae1-a24a-4d10-af66-daf4f721ac07", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2024-04-04T17:07:18.249", | |
"iopub.status.busy": "2024-04-04T17:07:18.249", | |
"iopub.status.idle": "2024-04-04T17:07:18.438", | |
"shell.execute_reply": "2024-04-04T17:07:18.437" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"\\begin{verbatim}\n", | |
"gate_concurrence(U) = gate_concurrence(weyl_chamber_coordinates(U)...)\n", | |
"\\end{verbatim}\n" | |
], | |
"text/markdown": [ | |
"```julia\n", | |
"gate_concurrence(U) = gate_concurrence(weyl_chamber_coordinates(U)...)\n", | |
"```\n" | |
], | |
"text/plain": [ | |
"\u001b[36m gate_concurrence(U) = gate_concurrence(weyl_chamber_coordinates(U)...)\u001b[39m" | |
] | |
}, | |
"execution_count": 5, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"using Markdown: Markdown, MD\n", | |
"\n", | |
"md = MD(Markdown.Code(\"julia\", \"gate_concurrence(U) = gate_concurrence(weyl_chamber_coordinates(U)...)\"))" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "92166169-589d-4e16-a32e-d9a6108ecad5", | |
"metadata": {}, | |
"source": [ | |
"**This is missing a trailing `)`!!!!**" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"id": "7dfa162e-f291-458a-a9ee-a230f0c2c30a", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2024-04-04T17:07:18.438", | |
"iopub.status.busy": "2024-04-04T17:07:18.438", | |
"iopub.status.idle": "2024-04-04T17:07:18.675", | |
"shell.execute_reply": "2024-04-04T17:07:18.675" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"IJulia.InlineDisplay()" | |
] | |
}, | |
"execution_count": 6, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"ijd = IJulia.InlineDisplay()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"id": "19b60900-e181-4343-9808-c634f4543dbd", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2024-04-04T17:07:18.675", | |
"iopub.status.busy": "2024-04-04T17:07:18.675", | |
"iopub.status.idle": "2024-04-04T17:07:18.809", | |
"shell.execute_reply": "2024-04-04T17:07:18.809" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"\\begin{verbatim}\n", | |
"gate_concurrence(U) = gate_concurrence(weyl_chamber_coordinates(U)...)\n", | |
"\\end{verbatim}\n" | |
], | |
"text/markdown": [ | |
"```julia\n", | |
"gate_concurrence(U) = gate_concurrence(weyl_chamber_coordinates(U)...)\n", | |
"```\n" | |
], | |
"text/plain": [ | |
"\u001b[36m gate_concurrence(U) = gate_concurrence(weyl_chamber_coordinates(U)...)\u001b[39m" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"display(ijd, md)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"id": "e26d8b35-0191-411e-9f25-da9239a25497", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2024-04-04T17:07:18.809", | |
"iopub.status.busy": "2024-04-04T17:07:18.809", | |
"iopub.status.idle": "2024-04-04T17:07:19.103", | |
"shell.execute_reply": "2024-04-04T17:07:19.102" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"Dict{String, Union{String, JSON.Writer.JSONText}} with 3 entries:\n", | |
" \"text/plain\" => \"\\e[36m gate_concurrence(U) = gate_concurrence(weyl_chamb…\n", | |
" \"text/markdown\" => \"```julia\\ngate_concurrence(U) = gate_concurrence(weyl_cha…\n", | |
" \"text/latex\" => \"\\\\begin{verbatim}\\ngate_concurrence(U) = gate_concurrence…" | |
] | |
}, | |
"execution_count": 8, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"reprs = IJulia.display_dict(md)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"id": "97801c18-123e-4ab2-a9cc-82502a7eae6b", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2024-04-04T17:07:19.103", | |
"iopub.status.busy": "2024-04-04T17:07:19.103", | |
"iopub.status.idle": "2024-04-04T17:07:19.273", | |
"shell.execute_reply": "2024-04-04T17:07:19.273" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"\"\\e[36m gate_concurrence(U) = gate_concurrence(weyl_chamber_coordinates(U)...)\\e[39m\"" | |
] | |
}, | |
"execution_count": 9, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"reprs[\"text/plain\"]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"id": "fa885644-e6b2-4dca-a9d8-6ea1a9ac1642", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2024-04-04T17:07:19.273", | |
"iopub.status.busy": "2024-04-04T17:07:19.273", | |
"iopub.status.idle": "2024-04-04T17:07:19.274", | |
"shell.execute_reply": "2024-04-04T17:07:19.274" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"\"```julia\\ngate_concurrence(U) = gate_concurrence(weyl_chamber_coordinates(U)...)\\n```\\n\"" | |
] | |
}, | |
"execution_count": 10, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"reprs[\"text/markdown\"]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 11, | |
"id": "301770fb-2a3e-4aba-9ace-aa1890c9e54b", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2024-04-04T17:07:19.274", | |
"iopub.status.busy": "2024-04-04T17:07:19.274", | |
"iopub.status.idle": "2024-04-04T17:07:19.292", | |
"shell.execute_reply": "2024-04-04T17:07:19.291" | |
} | |
}, | |
"outputs": [], | |
"source": [ | |
"using DisplayAs" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"id": "8a607fd3-4cc9-47d6-b94c-9d7e89644531", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2024-04-04T17:07:19.335", | |
"iopub.status.busy": "2024-04-04T17:07:19.292", | |
"iopub.status.idle": "2024-04-04T17:07:19.409", | |
"shell.execute_reply": "2024-04-04T17:07:19.409" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"\u001b[36m gate_concurrence(U) = gate_concurrence(weyl_chamber_coordinates(U)...)\u001b[39m" | |
] | |
}, | |
"execution_count": 12, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"md |> DisplayAs.Text" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 13, | |
"id": "94066562-f89a-413d-b365-92c3eb9bff28", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2024-04-04T17:07:19.409", | |
"iopub.status.busy": "2024-04-04T17:07:19.409", | |
"iopub.status.idle": "2024-04-04T17:07:19.520", | |
"shell.execute_reply": "2024-04-04T17:07:19.519" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/markdown": [ | |
"```julia\n", | |
"gate_concurrence(U) = gate_concurrence(weyl_chamber_coordinates(U)...)\n", | |
"```\n" | |
], | |
"text/plain": [ | |
"DisplayAs.Showable{MIME{Symbol(\"text/markdown\")}}(```julia\n", | |
"gate_concurrence(U) = gate_concurrence(weyl_chamber_coordinates(U)...)\n", | |
"```\n", | |
", NamedTuple())" | |
] | |
}, | |
"execution_count": 13, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"md |> DisplayAs.MD" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 14, | |
"id": "d0d03bb1-fefa-46fc-a071-999fa6bed03b", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2024-04-04T17:07:19.520", | |
"iopub.status.busy": "2024-04-04T17:07:19.520", | |
"iopub.status.idle": "2024-04-04T17:07:19.681", | |
"shell.execute_reply": "2024-04-04T17:07:19.681" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"IPython Msg [ idents 6412941e-9f88-4142-a891-120ceb1cf62e ] {\n", | |
" parent_header = Dict{String, Any}(),\n", | |
" header = Dict{String, Any}(\"msg_id\" => \"83faa727-5939-48c1-8446-c3a674a3b5eb\", \"msg_type\" => \"execute_request\", \"username\" => \"\", \"date\" => \"2024-04-04T21:07:08.759Z\", \"version\" => \"5.2\", \"session\" => \"6412941e-9f88-4142-a891-120ceb1cf62e\"),\n", | |
" metadata = Dict{String, Any}(\"trusted\" => true, \"cellId\" => \"d0d03bb1-fefa-46fc-a071-999fa6bed03b\", \"recordTiming\" => true, \"deletedCells\" => Any[], \"execution\" => Dict{String, Any}(\"iopub.status.idle\" => \"2024-04-04T17:06:28.468\", \"iopub.status.busy\" => \"2024-04-04T17:06:28.319\", \"iopub.execute_input\" => \"2024-04-04T17:06:28.319\", \"shell.execute_reply\" => \"2024-04-04T17:06:28.468\")),\n", | |
" content = Dict{String, Any}(\"store_history\" => true, \"user_expressions\" => Dict{String, Any}(), \"allow_stdin\" => true, \"code\" => \"IJulia.execute_msg\", \"silent\" => false, \"stop_on_error\" => true)\n", | |
"}" | |
] | |
}, | |
"execution_count": 14, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"IJulia.execute_msg" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 15, | |
"id": "4d29549f-06e8-4701-86ac-219f16c8b321", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2024-04-04T17:07:19.682", | |
"iopub.status.busy": "2024-04-04T17:07:19.681", | |
"iopub.status.idle": "2024-04-04T17:07:19.791", | |
"shell.execute_reply": "2024-04-04T17:07:19.791" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"ZMQ.Socket(Ptr{Nothing} @0x0000000107a3c800, FileWatching._FDWatcher(Ptr{Nothing} @0x0000600002065c20, 28, (1, 0), Base.GenericCondition{Base.Threads.SpinLock}(Base.IntrusiveLinkedList{Task}(nothing, nothing), Base.Threads.SpinLock(0)), 0, (false, false)))" | |
] | |
}, | |
"execution_count": 15, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"IJulia.publish[]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 16, | |
"id": "c025b2ce-0b33-4e0a-9c7d-7e10da182616", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2024-04-04T17:07:19.791", | |
"iopub.status.busy": "2024-04-04T17:07:19.791", | |
"iopub.status.idle": "2024-04-04T17:07:19.832", | |
"shell.execute_reply": "2024-04-04T17:07:19.832" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/markdown": [ | |
"```julia\n", | |
"gate_concurrence(U) = gate_concurrence(weyl_chamber_coordinates(U)...)\n", | |
"```\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"IJulia.send_ipython(\n", | |
" IJulia.publish[],\n", | |
" IJulia.msg_pub(\n", | |
" IJulia.execute_msg, # m\n", | |
" \"display_data\", # msg_type\n", | |
" Dict( # content\n", | |
" \"metadata\" => Dict(),\n", | |
" \"data\" => Dict(\"text/markdown\" => reprs[\"text/markdown\"])\n", | |
" ),\n", | |
" )\n", | |
")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 17, | |
"id": "e220424f-0bfb-45b6-a75a-636e37aeabf6", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2024-04-04T17:07:19.832", | |
"iopub.status.busy": "2024-04-04T17:07:19.832", | |
"iopub.status.idle": "2024-04-04T17:07:19.833", | |
"shell.execute_reply": "2024-04-04T17:07:19.833" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/markdown": [ | |
"```julia\n", | |
"gate_concurrence(U) = gate_concurrence(weyl_chamber_coordinates(U)...)\n", | |
"```\n", | |
"\n", | |
"This is some *extra* text\n" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"IJulia.send_ipython(\n", | |
" IJulia.publish[],\n", | |
" IJulia.msg_pub(\n", | |
" IJulia.execute_msg, # m\n", | |
" \"display_data\", # msg_type\n", | |
" Dict( # content\n", | |
" \"metadata\" => Dict(),\n", | |
" \"data\" => Dict(\"text/markdown\" => reprs[\"text/markdown\"] * \"\\nThis is some *extra* text\\n\")\n", | |
" ),\n", | |
" )\n", | |
")" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Julia 1.10.2", | |
"language": "julia", | |
"name": "julia-1.10" | |
}, | |
"language_info": { | |
"file_extension": ".jl", | |
"mimetype": "application/julia", | |
"name": "julia", | |
"version": "1.10.2" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Adding a space in front of the parenthesis, i.e.,
md = MD(Markdown.Code("julia", "gate_concurrence(U) = gate_concurrence(weyl_chamber_coordinates(U)... )"))
also displays properly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reported as jupyterlab/jupyterlab#16112 and JuliaLang/IJulia.jl#1111