devlog 2
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 ./start-readme
script to the notebook itself.
Instead I’ll run my watcher run-after-commit.sh
to make sure that the files are deleted after commits.
That may also work, you can use both as well.
I noticed cli-opts pass --no-system-config
etc by default. Let’s deal with this first.
I fixed that.
I’m testing whether we are in the directory that we should be with xvc.root("--absolute")
but it looks it’s not possible to pass a string argument to the command.
Let me take a look at this.
It looks there has been some changes in optional parameter handling in PyO3. You may need to deal with keyword arguments with decorators.
Now, let’s try xvc.file().track()
once more with dir-0001/
.
It seems to be working now. With an existing directory it doesn’t show an error.
What does xvc.file().list()
show?
It shows a single string with \n
in it. It looks we need to handle this in output thread.
I add a replace("\\n", "\n")
to output_str
at the end but it didn’t make a difference. I tested in the notebook with list_result.split{"\n")
and these \n
characters are indeed CRLF. So Jupyter shows CRLF in strings with \n
and this is not something we should try to fix I think.
You can search how to show \n characters in Jupyter notebook with CRLF
The output str should be fed into repr
as in:
# 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))
I tested this and GPT misleads. repr
is when you want to show \n
, not vice versa. When I print(list_result)
it prints the results properly.
It looks 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.