<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>emre şahin's digital garden 🍃 - Jupyter</title>
    <link>https://emresahin.net/tags/jupyter/</link>
    <description>Posts in the Jupyter tag</description>
    <language>en</language>
    <managingEditor>contact@emresahin.net (Emre Şahin)</managingEditor>
    <lastBuildDate>Tue, 15 Sep 2026 19:46:32 +0000</lastBuildDate>
    <atom:link href="https://emresahin.net/tags/jupyter/rss.xml" rel="self" type="application/rss+xml"/>
    <item>
      <title>devlog 5</title>
      <published>2024-07-08T20:35:24+00:00</published>
      <updated>2024-07-08T20:35:24+00:00</updated>
      <author>Emre Şahin</author>
      <pubDate>Mon, 08 Jul 2024 20:35:24 +0000</pubDate>
      <link>https://emresahin.net/devlog-5/</link>
      <guid isPermaLink="true">https://emresahin.net/devlog-5/</guid>
      <description>While writing Xvc tests for Python, I hit an error caused by the ECS single-load protection. The single-loader allows only one instance of Xvc to be run in a single process. This is no problem for the shell, but it looks like it won’t be possible to use multiple Xvc instances in a single Python p...</description>
      <category>devlog</category>
      <category>Xvc</category>
      <category>devlog</category>
      <category>multiprocessing</category>
      <category>Jupyter</category>
      <category>python</category>
      <category>ecs</category>
      <category>testing</category>
      <content:encoded><![CDATA[<p>While writing Xvc tests for Python, I hit an error caused by the ECS single-load protection.</p>
<p>The single-loader allows only one instance of Xvc to be run in a single process. This is no problem for the shell, but it looks like it won’t be possible to use multiple Xvc instances in a single Python process.</p>
<p>It’s possible to overcome this with an elaborate multiprocessing setup in the wrapper, but I won’t bother with it for now.</p>]]></content:encoded>
    </item>
    <item>
      <title>devlog 3</title>
      <published>2024-06-04T10:07:01+00:00</published>
      <updated>2024-06-04T10:07:01+00:00</updated>
      <author>Emre Şahin</author>
      <pubDate>Tue, 04 Jun 2024 10:07:01 +0000</pubDate>
      <link>https://emresahin.net/devlog-3/</link>
      <guid isPermaLink="true">https://emresahin.net/devlog-3/</guid>
      <description>Let’s begin this session by removing debug statements from both the Xvc library and the Python bindings. Another issue is the restart script. The if in that script that restarts the server doesn’t work; it always restarts the notebook server. I removed some println! statements from xvc.py . There...</description>
      <category>XVC</category>
      <category>Development</category>
      <category>Rust</category>
      <category>Python</category>
      <category>clippy</category>
      <category>Jupyter</category>
      <category>bug-fix</category>
      <category>notebook</category>
      <content:encoded><![CDATA[<p>Let’s begin this session by removing debug statements from both the Xvc library and the Python bindings.</p>
<p>Another issue is the restart script. The <code>if</code> in that script that restarts the server doesn’t work; it always restarts the notebook server.</p>
<p>I removed some <code>println!</code> statements from <code>xvc.py</code>. There doesn’t seem to be anything in the library related to outputs.</p>
<p>Let’s search for how to check if a <code>jupyter-lab</code> command with the port 7979 runs in the background.</p>
<p>It looks like the bug is in the condition; it’s not <code>-s</code>, it’s <code>-z</code>.</p>
<p>Oops, yeah.</p>
<p>Let’s do a bit of tidying and check if the script is fixed.</p>
<p>I have a <code>clippy</code> warning with a <code>new</code> function that says these usually don’t take <code>self</code> as a parameter. This is for the <code>pipeline new</code> command, and it receives a <code>self</code> as an <code>XvcPipeline</code> object. It seems best to turn off the <code>clippy</code> warning for this.</p>
<p>I allowed two <code>clippy</code> warnings, and the script seems to work fine.</p>
<p>Let’s go on to copying the content from the Xvc <code>README</code> to the notebook.</p>
<p>There is an issue with the <code>run-after-commit</code> script. When Xvc commits the changes, the command we give is run again.</p>
<p>The issue is that <code>git</code> initializes the directory in the <code>test-data/</code> directory, while <code>xvc</code> works in the current directory. I think we can either <code>git init</code> in the current directory or <code>xvc init</code> in <code>test-data</code>.</p>
<p>We’re already deleting <code>.git</code> and <code>.xvc</code> directories in the <code>start-readme</code> script. I think it may be easier to update <code>git init</code> to just initialize in the current directory.</p>
<p>Yep, let’s do it that way.</p>
<p>I see there are still extra outputs from the commands. We need to deal with this first.</p>
<p>I removed them, but there are still pink outputs. These are from <code>dbg!</code> statements, it looks like, or we’re initializing the output thread incorrectly.</p>
<p>Fixed those as well. I wrote up the <code>xvc file list</code> command examples as well. Now we have issues with <code>xvc storage new s3</code> not running, and not even showing any debug output. We’ll deal with it in the next devlog, though.</p>]]></content:encoded>
    </item>
    <item>
      <title>devlog 2</title>
      <published>2024-05-26T17:29:09+00:00</published>
      <updated>2024-05-26T17:29:09+00:00</updated>
      <author>Emre Şahin</author>
      <pubDate>Sun, 26 May 2024 17:29:09 +0000</pubDate>
      <link>https://emresahin.net/devlog-2/</link>
      <guid isPermaLink="true">https://emresahin.net/devlog-2/</guid>
      <description>We were debugging Python bindings for Xvc. xvc.file.track enters an infinite loop when given a non-existent path. To make debugging easier, we can add file deletions in the ./start-readme script to the notebook itself. Instead, I’ll run my watcher run-after-commit.sh to ensure that the files are ...</description>
      <category>devlog</category>
      <category>xvc</category>
      <category>xvc</category>
      <category>jupyter</category>
      <category>xvc-config</category>
      <category>xvc-file</category>
      <category>repr</category>
      <category>python-bindings</category>
      <category>debugging</category>
      <content:encoded><![CDATA[<p>We were debugging Python bindings for Xvc. <code>xvc.file.track</code> enters an infinite
loop when given a non-existent path.</p>
<p>To make debugging easier, we can add file deletions in the <code>./start-readme</code> script
to the notebook itself.</p>
<p>Instead, I’ll run my watcher <code>run-after-commit.sh</code> to ensure that the files
are deleted after commits.</p>
<p>That may also work; you can use both as well.</p>
<p>I noticed cli-opts pass <code>--no-system-config</code> etc. by default. Let’s deal with
this first.</p>
<p>I fixed that.</p>
<p>I’m testing whether we are in the directory that we should be in with
<code>xvc.root("--absolute")</code>, but it looks like it’s not possible to pass a string
argument to the command.</p>
<p>Let me take a look at this.</p>
<p>It looks like there have been some changes in optional parameter handling in PyO3.
You may need to deal with keyword arguments with decorators.</p>
<p>Now, let’s try <code>xvc.file().track()</code> once more with <code>dir-0001/</code>.</p>
<p>It seems to be working now. With an existing directory, it doesn’t show an
error.</p>
<p>What does <code>xvc.file().list()</code> show?</p>
<p>It shows a single string with <code>\n</code> in it. It looks like we need to handle this in
the output thread.</p>
<p>I added a <code>replace("\\n", "\n")</code> to <code>output_str</code> at the end, but it didn’t make a
difference. I tested in the notebook with <code>list_result.split("\n")</code>, and these
<code>\n</code> characters are indeed CRLF. So Jupyter shows CRLF in strings with <code>\n</code>, and
this is not something we should try to fix, I think.</p>
<p>You can search how to show <code>\n</code> characters in a Jupyter notebook with CRLF.</p>
<p>The output string should be fed into <code>repr</code>, as in:</p>
<pre><code class="language-python"># Define a string with CRLF characters
text_crlf = "Hello\r\nWorld\r\nThis is a test string."

# Use repr to show the \r\n characters explicitly
print(repr(text_crlf))
</code></pre>
<p>I tested this, and GPT misleads. <code>repr</code> is when you <em>want</em> to show <code>\n</code>, not
vice versa. When I <code>print(list_result)</code>, it prints the results properly.</p>
<p>It looks like we don’t need to make this a priority now. We can tell the user in the
notebook that the commands are intentionally returning strings, and they can
process or print them however they want.</p>]]></content:encoded>
    </item>
  </channel>
</rss>
