Manim: Version Information subcommand `manim version`

Created on 13 Oct 2020  Â·  15Comments  Â·  Source: ManimCommunity/manim

Feature request

implement a manim version command.

What should the command do?

Tell you exactly which version of manim you are running. Either release number or commit-hash and date

Why?

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.

bug enhancement

Most helpful comment

@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.

All 15 comments

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 --version argument like most other software. So instead of manim version, it's manim --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:

  1. A regular user that is using the latest release wants to know the version. They can do manim --version and get the version number 0.1.
  2. A dev wants to know their version and/or commit. They can do manim --version OR query git somehow.
  3. A regular user that is NOT using the latest release. Unclear how they would do it. However, do we expect a lot of these? Let's not overcomplicate things for an edge case :upside_down_face:

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__.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nilaybhatia picture nilaybhatia  Â·  6Comments

ChristianCoenen picture ChristianCoenen  Â·  5Comments

naveen521kk picture naveen521kk  Â·  5Comments

huguesdevimeux picture huguesdevimeux  Â·  7Comments

qo4on picture qo4on  Â·  6Comments