Skip to content

Conversation

@jvdoorn
Copy link
Contributor

@jvdoorn jvdoorn commented Oct 5, 2020

List of Changes

  • Implemented -q/--quality [k,h,m,l] flags
  • Removed -k/-e/-m/-l flags

Motivation

Implements behaviour as described in #146 except for -qp. This flag would specify default behaviour and seems redundant to me. It could however be easily implemented if that is prefered for this PR.

Testing Status

Old tests have been updated to use new flags when needed and a new test has been written to test the flags.

Further Comments

The new test might be a bit too extensive but it covers every way someone could write the flags (par example -q h or -qh are both tested). The production quality does not have its own section in the config but instead reads from the CLI section (which was its old behaviour).

Acknowledgement

Comment on lines 83 to 87
quality = _determine_quality(args)
section = config_parser[quality if quality != "production" else "CLI"]

# Loop over low quality for the keys, could be any quality really
config = {opt: section.getint(opt) for opt in config_parser['low_quality']}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very clean code, I like it.

'high_quality': 'h',
'medium_quality': 'm',
'low_quality': 'l'
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you run black on this? In any case, please leave a blank line at the end of the file.

# The following are mutually exclusive and each overrides
# FRAME_RATE, PIXEL_HEIGHT, and PIXEL_WIDTH,
parser.add_argument(
"-l",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we should completely remove these flags just yet. Doing so will most likely break every single user's workflow. Yes, it's an easy change, but it still needs to be done with care.

Is there a way of adding a deprecation warning instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is possible to tell -l apart from --low_quality. If we want to warn for deprecation we could maybe create a new argument with just -l and if someone uses it warn them. Not sure if that will produce clean code though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm that's a good point. I'm still a bit weary of breaking every user's flow though. Let's see what others think.

@leotrs
Copy link
Contributor

leotrs commented Oct 5, 2020

The test you added is looking good. However, this seems to have broken other existing tests. Could you please check those?

Finally, please make sure to rebuild the documentation as well. Specifically, this PR should change https://manimce.readthedocs.io/en/latest/tutorials/configuration.html and the doctest found therein.

@jvdoorn
Copy link
Contributor Author

jvdoorn commented Oct 5, 2020

Yeah so, when I run just the new test it works. However, when running all tests it fails. I'm not sure what it is caused by, it seems that when running all tests that the parser expects different arguments. I was hoping one of you could enlighten me on the cause of the error it throws.

I'll update the docs!

@leotrs
Copy link
Contributor

leotrs commented Oct 5, 2020

cc @ManimCommunity/tests

Also, does anyone in @ManimCommunity/core object to this change? I think we should deprecate the current flags instead of removing them.

@naveen521kk
Copy link
Member

I think this PR should only be merged only after the release. Also, there should should be depreciation warning like done in TexMobject and not abruptly breaking everything.

@jvdoorn
Copy link
Contributor Author

jvdoorn commented Oct 5, 2020

I have added a deprecation warning to the old flags but they are still supported. As far as I'm aware this PR is now complete and ready for review.

Copy link
Member

@eulertour eulertour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for writing tests!


for quality in old_qualities.keys():
if getattr(args, quality):
logging.getLogger("manim").warning(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you move this line

set_rich_logger(config_parser["logger"], file_writer_config["verbosity"])
to just below this line
args, config_parser, file_writer_config, successfully_read_files = _run_config()
this log will be formatted with rich, which will look a little nicer. You should also update or remove this comment
# Set the different loggers
since it will only affect a single logger.

@kilacoda-old
Copy link
Contributor

CMIIW, but merging this means something like -pm will become -pqm, right? Or will they have to be separated like -p -qm?

@jvdoorn
Copy link
Contributor Author

jvdoorn commented Oct 6, 2020

They don't have to be separated as long as -qm is the last argument.

See Python documentation.

@jvdoorn
Copy link
Contributor Author

jvdoorn commented Oct 6, 2020

Uhm, not sure why the tests fail but it seems unrelated to my changes?

@eulertour
Copy link
Member

Probably transient errors. I tried re-running them, but if its still an unrelated failure we can merge anyway.

@jvdoorn
Copy link
Contributor Author

jvdoorn commented Oct 6, 2020

Well they fail when installing, and since I changed nothing in the install process I'd say it is not possible that my changes broke the tests.

Copy link
Member

@eulertour eulertour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the old flags are deprecated rather than removed I don't see why this can't be merged now.

Copy link
Member

@huguesdevimeux huguesdevimeux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, there is not end to end test for these flags (except for -ql).

Do you think it's the right PR for that ? I know, there are already tests for these flags but not invovling the whole video process.
If you decide to do so, everything is explained in the wiki on github, testing section

i mark it as change requested, just to have time to discuss a little bit

@eulertour
Copy link
Member

Even if you do decide that you want to add end-to-end tests you shouldn't block this PR for it; that should be discussed separately.

@huguesdevimeux
Copy link
Member

Even if you do decide that you want to add end-to-end tests you shouldn't block this PR for it; that should be discussed separately.

That's why I was asking.

@eulertour eulertour merged commit fa0a82c into ManimCommunity:master Oct 6, 2020
@behackl behackl mentioned this pull request Oct 12, 2020
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants