Closed jraviotta closed 5 years ago
FYI: For the inevitable bug reports that will come from VS Code users, please note the following.
After adding the filters to my global .gitconfig
, nbstripout
works as expected on mac and from the cli in WSL. However, using the integrated .git
UI in Visual Studio Code does not work. The problem appears to be that VS Code is searching for the filters using Windows-style paths rather than the WSL-style paths such as /mnt/c/users/<user>/miniconda3/...
.
References: VS Code VCS and Git: Support WSL #9502
This solution fixed my problem using the insiders build of VS Code.
This is also helpful.
The system wide git config seems to reside in $(prefix)/etc/gitconfig
, and the global in ~/.gitconfig
, and the git repo local one within .git/config
. For more details see https://git-scm.com/docs/git-config.
So, if we add a --global
we may also want to add a --system
.
I wouldn't want to mess with the system wide config since those files are controlled by your system package manager and whenever those would be changed e.g. when the git-core
package is updated you'd end up with a conflict you need to resolve.
On top of that you'd need to run nbstripout
with sudo
, which is not something I'd advise doing.
I've added a --global
flag for --install
/--uninstall
which is already released in 0.3.6. Does this fit your needs @jraviotta ?
Thanks a bunch @kynan . I tested on one of my projects and it worked as I had hoped it would. The table in the documentation is especially helpful.
One side effect to note however:
When I executed nbstripout --uninstall --global --attributes=.gitattributes
, the entry in ~/.gitconfg
and .gitattributes
were deleted as expected. But I had some additional settings configured that were not re-installed with nbstripout --install --global --attributes=.gitattributes
. Dealing with that, may be out of the scope of the project. but wanted to raise the issue in case other users have similarly configured their filters.
Here's the filter that was clobbered by uninstalling/re-installing:
[filter "nbstripout"]
clean = \"/mnt/c/users/jravi/miniconda3/bin/python3.7\" \"/mnt/c/users/jravi/miniconda3/lib/python3.7/site-packages/nbstripout\"
smudge = cat
required = true
extrakeys = \n metadata.celltoolbar metadata.kernel_spec.display_name\n metadata.kernel_spec.name metadata.language_info.codemirror_mode.version\n metadata.language_info.pygments_lexer metadata.language_info.version\n metadata.toc metadata.notify_time metadata.varInspector\n cell.metadata.heading_collapsed cell.metadata.hidden\n cell.metadata.code_folding cell.metadata.tags cell.metadata.init_cell
The extrakeys
field refers to metadata added by jupyter extensions.
Thanks for implementing the feature request, it will be very helpful!
Tracked this in #102, thanks for flagging.
Presently,
nbstripout --install
modifies the repo.git/config
. This is less portable than saving the path tonbstripout
and the filters in the user's global.gitconfig
.It would be nice to have a command such as:
nbstripout --install --global --atributes .gitattributes
that created a.gitattributes
file in the current repo but saved the filters and path globally. Then, every repo with the.gitattributes
file would be stripped without needing to install nbstripout in every cloned repository.See conversation #7