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

File names with dot '.' #138

Closed
kiendang opened this issue Nov 30, 2018 · 4 comments
Closed

File names with dot '.' #138

kiendang opened this issue Nov 30, 2018 · 4 comments
Milestone

Comments

@kiendang
Copy link
Contributor

Sorry to trouble you again.
Currently file names with dot . with 3 or fewer characters after the dot will be truncated when displayed inside the notebook UI

e.g. file5.1.py
screen shot 2018-11-30 at 2 53 09 pm
will be displayed as file5 instead of file5.1
screen shot 2018-11-30 at 2 51 18 pm

Looking through the code and release notes #87 #96 (b6cc7f4) it looks like this behavior is intentional? May I know why it's intended that way and is it possible to change it?

@mwouts
Copy link
Owner

mwouts commented Nov 30, 2018

Hello Dang, thanks for reporting this. As you noticed we already had an issue with this behavior at #87, so it is indeed a good idea to see if we can improve that part of the program.

What happens is the following: Jupytext allows file extensions to be made of a prefix (made of at most three chars), plus the format extension. This allows to export a single document to multiple formats for a given extension - take for instance the demo world population notebook that is exported to all flavors of Python scripts.

I agree that the current implementation is not perfect. In your example, not only the displayed name is not right, but also you will find it difficult to pair the script to a notebook, as jupytext thinks you script has extension .1.py.

Do you see a better way to allow multiple flavors of scripts for a single notebook? Probably the easiest way to solve your example would be to only allow lgt, pct or spx prefixes. But do you deem that as a good solution? Another possibility would be to compute the name of the notebook based on the extension information, when available (it is stored in the text representation)... (I may give a try to the latter...)

mwouts added a commit that referenced this issue Dec 13, 2018
#87 #138 extension for file name with dot is simply the extension, unless the intermediate prefix is one of lgt/pct/spx/nb
Fixes #138
@mwouts
Copy link
Owner

mwouts commented Dec 13, 2018

Hello Dang, I've choosen the simplest approach. Jupytext 0.9.0 will use the full extension only if the extensions prefix is one of lgt/pct/spx or nb, so we should have no issues any more with file names with dots (unless they end with .nb.py, etc).

The fix is available now on branch 0.9.0.

mwouts added a commit that referenced this issue Jan 14, 2019
#87 #138 extension for file name with dot is simply the extension, unless the intermediate prefix is one of lgt/pct/spx/nb
Fixes #138
@mwouts mwouts added this to the v1.0.0 milestone Jan 15, 2019
@mwouts
Copy link
Owner

mwouts commented Jan 29, 2019

That has been a long pending subject! The next release introduces prefixes, suffixes, etc, and hopefully will fix this once for all... @kiendang , would you like to give a try to the RC?

pip install jupytext --pre --upgrade

Thanks!

@mwouts
Copy link
Owner

mwouts commented Feb 5, 2019

I expect this to be fixed in the RC (now at 1.0.0-rc2):

pip install jupytext --upgrade --pre

@kiendang, please reopen if you see any issue. Thanks.

@mwouts mwouts closed this as completed Feb 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants