Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting the spreadsheat to other file endings #18

Open
SKDoily opened this issue Sep 13, 2019 · 6 comments
Open

Connecting the spreadsheat to other file endings #18

SKDoily opened this issue Sep 13, 2019 · 6 comments
Labels
enhancement New feature or request

Comments

@SKDoily
Copy link

SKDoily commented Sep 13, 2019

Could spreadsheet be assigned to other file endings as well.
I have a couple of files with endings (*.acq, *.att, *.ats, *.atr) which are in fact csv-files internally.
Renaming them to *.csv I get the spreadsheat as an entry in the context menu and I can open it successfully.
Would it be possible to assign other filetypes to be opened e.g. via some settings?

Or would that be a feature for the jupyterlab file browser in general?
jupyterlab/jupyterlab#7099 (comment)

@quigleyj97
Copy link
Owner

It's fairly easy to do, but there's some ongoing work on filetype associations as you note and given the nature of vendor-specific extensions, it seems better as a user-configurable setting. I've pinged the JupyterLab maintainers, and I'll let you know what comes of that.

If you'd like, I could add this in anyway and then remove it when something lands in JupyterLab. That would get you a usable stop-gap if this is an active bottleneck for you.

@quigleyj97 quigleyj97 added the enhancement New feature or request label Sep 13, 2019
@SKDoily
Copy link
Author

SKDoily commented Sep 23, 2019

I think I have seen it mentioned somewhere, that it has been implemented in jupyterlab 1.1.4. But I can't find it anymore.

@SKDoily
Copy link
Author

SKDoily commented Sep 23, 2019

Finding the following: jupyterlab/jupyterlab#6813
I was able to set the Spreadsheet as the default Viewer for csv.
But I can't use it to open acq-files for example, since it is not a valid filetype.

@quigleyj97
Copy link
Owner

Yup, internally JupyterLab has two layers of indirection between files and viewers:

  • Filetypes (maps an extension to a MIME type)
  • DocumentRegistry (maps a MIME type to a viewer)

jupyterlab/jupyterlab#6813 lets you map additional MIME types to viewers, but it’s missing that first component (file extensions to MIME types). When I get some free time I’ll spike an extension that does that, should be pretty quick to do. That way you can specify mappings between file types and existing MIME types, like .acq -> text/csv. Viewer plugins like JupyterLab-Spreadsheet can pick it up from there.

@TermeHansen
Copy link

Any news on how to link from extension to mimetype?

@quigleyj97
Copy link
Owner

I'd actually almost gotten about halfway there by implementing support for the JupyterLab Data Registry- as long as a file could be recognized by the Data Registry it could then be opened in this extension. (The extension in turn would offer support for converting worksheets to CSVs). This made it into mainline in #17, but I had to retract it prior to the JLab 2.0 release since the Data Registry hadn't been updated yet.

Separately I had made an earlier stab at this in https://github.com/quigleyj97/jupyterlab-file-glue, but honestly I forget why I abandoned that effort- it might've been that extensions have to explicitly register the filetypes they support (cf. here), thus requiring changes to this extension as well.

I'll mull over this a bit but in the meantime you can semi-hackishly work around this with a symlink:

ln -s my-file.acq my-link.csv

That should allow JupyterLab to recognize the file as a CSV, but only works on *nix systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants