question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[DOC] User paths in tutorial notebooks (tool suggestion)

See original GitHub issue

Describe the issue linked to the documentation

I noticed there are some user paths in the tutorial notebooks. Example: https://www.sktime.org/en/latest/examples/feature_extraction_with_tsfresh.html

/Users/mloning/Documents/Research/software/sktime/sktime/sktime/transformations/panel/tsfresh.py:164: UserWarning: tsfresh requires a unique index, but found non-unique. To avoid this warning, please make sure the index of X contains only unique values.
  "tsfresh requires a unique index, but found "
Feature Extraction: 100%|██████████| 5/5 [00:11<00:00,  2.32s/it]

Suggest a potential alternative/fix

I recently created a (very beta) tool that strips user paths from Jupyter notebook output cells. It can be used with a pre-commit hook. https://github.com/bdice/nb-strip-paths

Here is an example of the behavior:

# When executing from a repository "my_awesome_code", this text in a Jupyter cell output...
/home/bdice/my_awesome_code/some_directory/file.txt
# becomes...
some_directory/file.txt

Here is an example pre-commit hook configuration: https://github.com/glotzerlab/signac-examples/blob/5478bb68517789fdd5b2831059059f062e46153a/.pre-commit-config.yaml#L51-L54

I don’t have time to contribute a PR at the moment but I hope this is useful.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
aiwaltercommented, Mar 17, 2021

@bdice sry as well, I was off a few days.

  1. file-name-only (1 above)
  2. strip-site-packages-prefix (2 above)
  3. strip-repo-root-prefix (the current behavior)
  4. strip-username (3 above)

This sounds very cool and would be nice to have all those four options as argument each and a short description, if possible.

In this case, would you expect that the output of the cell below would be empty after stripping the username? Or would you suggest a replacement such as the literal string $USER?

I would prefer replacement with USER

You could also use something like os.path.exists to verify if it’s really a path on the current system before stripping/truncating. What do you think of that?

That would be very smart and cool to have!

Let me know once you have this implemented, so I can test it again and then add it to sktime 😃


Martin Walter martin_friedrich.walter@daimler.com, Mercedes-Benz AG on behalf of Daimler TSS GmbH. https://github.com/Daimler/daimler-foss/blob/master/LEGAL_IMPRINT.md

1reaction
bdicecommented, Mar 17, 2021

@aiwalter Cool! I appreciate your input. I’ll follow up when I have a chance to add these features.

Read more comments on GitHub >

github_iconTop Results From Across the Web

28 Jupyter Notebook Tips, Tricks, and Shortcuts - Dataquest
Jupyter Notebook is a powerful tool for data analysis. Here are 28 tips, tricks, and shortcuts to turn you into a Jupyter notebooks...
Read more >
How to enable auto-completion in Jupyter Notebook
Enter: enter edit mode · Shift+Enter: run cell, select below · Shift+Tab: signature autocompletion · Y: to code · M: to markdown ·...
Read more >
A simple kit to use computational notebooks for more ... - NCBI
jl creates a.jl file (A) with a brief tutorial on the Markdown syntax, paths to the most relevant folders, and suggestions of use....
Read more >
Introduction to Jupyter Notebooks - set-up, user-guide, and ...
This tutorial contains video-lessons at the end of each section; The Jupyter Notebook version can be found in my GitHub here. IDEs: Integrated ......
Read more >
Understanding and improving the quality and reproducibility of ...
We use the terms Notebook or Jupyter Notebook interchangeably to refer to the literate programming document. A notebook is composed of cells, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found