pygount
pygount copied to clipboard
Include iPython notebooks into calculations
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.
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.