deathbeds / importnb

notebook files as source

Home Page:https://importnb.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Version not easily accessible

bollwyvl opened this issue Β· comments

The version of the package is not easy to test from the outside with the CLI ...

importnb --version

or at runtime...

import importnb
assert importnb.__version__ == '0.8.0'

Having one of these would be helpful for downstreams 😍

This works:

python -c "v = __import__('importnb._version')._version.__version__; print(v); assert v == '{{ version }}'"

Not doing the _version import yielded some complaints, as it doesn't seem the * import of _version "sticks".

As a further smoke test, tried run -c:

importnb run -c 'v = __import__('\''importnb._version'\'')._version.__version__; print(v); assert v == '\''0.8.0'\'''

Saw:

Traceback (most recent call last):
  File "/tmp/env/bin/importnb", line 10, in <module>
    sys.exit(main())
  File "/tmp/env/lib/python3.10/site-packages/importnb/__main__.py", line 7, in main
    Notebook.load_argv(argv)
  File "/tmp/env/lib/python3.10/site-packages/importnb/loader.py", line 294, in load_argv
    raise ValueError(f"Expected one file to execute, but received {L}.")
ValueError: Expected one file to execute, but received 3.