implement a manim version command.
Tell you exactly which version of manim you are running. Either release number or commit-hash and date
It makes it easier to help people with their problems.
It makes it easier to catch error arising due to multiple versions being installed locally.
Instead of a whole subcommand, I think it'd be better to use a simple --version argument like most other software. So instead of manim version, it's manim --version.
Complelty agree with this. Is there a way to automatocally update the commit number displayed ?
I don't think it is possible, as displaying the commit number would mean changing the commit ……
So why is it possible with other programs? Is it because they are compiled and the compiler adds this info?
As an alternative, could we have CI create some unique version-id string with date?
On every packaged release we have to include a version number. On a version that is not packaged (i.e. it has been installed by cloning the repo), you can just print the latest commit by asking git. No need to hard-code the commit hash.
OR we should investigate how "nightly" python packages do this.
Instead of a whole subcommand, I think it'd be better to use a simple
--versionargument like most other software. So instead ofmanim version, it'smanim --version.
Many programs use just version, especially if they have other subcommands.
For example I had been thinking of another command "new":
manim new <name>
which would create a new file <name>.py that contains the basic scaffolding (from manim import *, class <name>(Scene): def construct .... and all that), along with a <name>.cfg manim config file.
Then you would have
manim version
manim new
manim help
and maybe
manim compile
for compiling a scene?
but maybe changing CLI UX is all a discussion for another day...
@cobordism, the manim new you propose is already proposed and discussed #244. The wider issue of subcommands and the CLI interface is related to #452. The only subcommand we currently have is manim cfg, which already exports a user-wide cfg file.
So let's keep this issue for discussing the version functionality. I am neutral as to whether this should be implemented as manim version or manim --version, though TBH the latter sounds more natural to me.
Update : It is possible to get the last commit id with subprocess. See here.
So, it should be a fairly easy PR :)
The version should appear in the logs when --DEBUG is passed as well, I think.
What if the user does ?
pip install https://github.com/ManimCommunity/manim/archive/master.zip
It will create weird errors. Also, btw chocolatey packages does so to install on windows. @huguesdevimeux
Of course, I'm an idiot.
But, is there like a bot or something to automatically dump into a file the last commit id ? It would be cool
Something like setuptools-scm can be used I think. But I don't how well it will work.
So here are the use cases I can think of for this:
manim --version and get the version number 0.1.manim --version OR query git somehow.However, do we expect a lot of these?
As soon as we have actual releases as well as a development branch, it is important to know where a user is at. "Latest" can then refer to at least 2 different states.
Also, it still happens often enough that someone has 3b1b manim installed and is actually calling that version (sometimes without knowing it)
If someone has questions, we can tell them to run manim --version. If that command fails - we know they're not running our release even if they think they are :)
Fair. How do we do it? For release versions, we can hard-code the version number (and in fact this is required for pypi I think).
Hardcoding is the best way while release because other alternatives like importlib.metadata sometimes can result in problems and many libraries do hardcode it. It should be ideally in the file __version__.py and version should be checked by running manim.__version__.
Most helpful comment
@cobordism, the
manim newyou propose is already proposed and discussed #244. The wider issue of subcommands and the CLI interface is related to #452. The only subcommand we currently have ismanim cfg, which already exports a user-widecfgfile.So let's keep this issue for discussing the
versionfunctionality. I am neutral as to whether this should be implemented asmanim versionormanim --version, though TBH the latter sounds more natural to me.