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

Include iPython notebooks into calculations #19

Open
felixSchober opened this issue Apr 26, 2019 · 1 comment
Open

Include iPython notebooks into calculations #19

felixSchober opened this issue Apr 26, 2019 · 1 comment

Comments

@felixSchober
Copy link

Currently, the ipynb extension is flagged as unknown and it's contents are not counted. Since ipython notebooks are just JSON files, it should be easy to count loc. One could even include markdown cells as documentation.

Is there interest in this? If yes I might make a PR.

@roskakori
Copy link
Owner

roskakori commented Apr 26, 2019

Sounds interesting.

Mapping them to JSON (resp. JavaScript) should be simply, just add them to pygount.analysis._SUFFIX_TO_FALLBACK_LEXER_MAP.

Parsing them properly would take more effort as you pointed out. One would have to consider "cell_type": "code" and use the language defined in kernel_info as notebooks aren't limited to Python. Not sure if this can be done in a reasonably simple way given the current reliance on pygment lexers. If you see a way to do this in a somewhat clean way without reorganizing large parts of the code, feel free to give it a stab. Otherwise I think for the time being it's better to go with the mapping to JSON and keep things clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants