rasbt / watermark

An IPython magic extension for printing date and time stamps, version numbers, and hardware information
Other
887 stars 92 forks source link

cli version #60

Open jamesmyatt opened 3 years ago

jamesmyatt commented 3 years ago

I think it would be useful to have a CLI version for this for non-Python kernels and for Python kernels that don't support magics.

For example, in an R notebook, you could write:

system("watermark")

and get the same as %watermark in IPython.

The obvious problem being that it will show the versions of the relevant Python packages, like CPython and IPython, by default, but I think that's OK for a first iteration, and we can just recommend including some flags instead.

What do you think?

rasbt commented 3 years ago

I agree, adding CLI support sounds like a good idea to me.

Regarding RMardkown or R notebooks, I use RMarkdown occasionally for R, but I have no idea how to develop it, but I would welcome PRs.

jamesmyatt commented 3 years ago

I'll try to make a PR for this. It won't depend on R at all, but I am planning to use click: https://click.palletsprojects.com/en/7.x/

rasbt commented 3 years ago

Regarding click, is this still commonly used? I remember that some time ago some people recommended it over argparse but personally, I have never had any issues over argparse -- on the contrary, it's one fewer dependency. What are your thoughts about it?

jamesmyatt commented 3 years ago

I think click is quite widely used. But I can't remember some examples of the top of my head.

click will let you build more complex applications and has a more modern API than argparse but should still give you the same basic functionality. At least that's what I expect.

rasbt commented 3 years ago

Sounds good! I mainly never used it because from a user perspective, the command line use looks exactly like argparse so I thought why adding another dependency. But I am open to using it.