Skip to content

Version Information subcommand manim version #541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cobordism opened this issue Oct 13, 2020 · 15 comments
Closed

Version Information subcommand manim version #541

cobordism opened this issue Oct 13, 2020 · 15 comments
Labels
enhancement Additions and improvements in general pr:bugfix Bug fix for use in PRs solving a specific issue:bug

Comments

@cobordism
Copy link
Member

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.

@cobordism cobordism added the pr:bugfix Bug fix for use in PRs solving a specific issue:bug label Oct 13, 2020
@kilacoda-old kilacoda-old added the enhancement Additions and improvements in general label Oct 13, 2020
@kilacoda-old
Copy link
Contributor

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.

@huguesdevimeux
Copy link
Member

Complelty agree with this. Is there a way to automatocally update the commit number displayed ?

@MysaaJava
Copy link
Contributor

I don't think it is possible, as displaying the commit number would mean changing the commit ……

@cobordism
Copy link
Member Author

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?

@leotrs
Copy link
Contributor

leotrs commented Oct 13, 2020

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.

@cobordism
Copy link
Member Author

cobordism commented Oct 13, 2020

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

@leotrs
Copy link
Contributor

leotrs commented Oct 13, 2020

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

@huguesdevimeux
Copy link
Member

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.

@naveen521kk
Copy link
Member

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

@huguesdevimeux
Copy link
Member

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

@naveen521kk
Copy link
Member

Something like setuptools-scm can be used I think. But I don't how well it will work.

@leotrs
Copy link
Contributor

leotrs commented Oct 16, 2020

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 🙃

@cobordism
Copy link
Member Author

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 :)

@leotrs
Copy link
Contributor

leotrs commented Oct 16, 2020

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

@naveen521kk
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Additions and improvements in general pr:bugfix Bug fix for use in PRs solving a specific issue:bug
Projects
None yet
Development

No branches or pull requests

7 participants