X Tutup
Skip to content

Added -j shortcut for --processes=#7362

Merged
NelleV merged 5 commits intomatplotlib:masterfrom
bcongdon:multi-process-flag
Nov 8, 2016
Merged

Added -j shortcut for --processes=#7362
NelleV merged 5 commits intomatplotlib:masterfrom
bcongdon:multi-process-flag

Conversation

@bcongdon
Copy link
Copy Markdown
Contributor

Addresses #7361.

The argv parsing is a bit naive, but I'm not sure what matplotlib's opinion on getopt or argparse is.

@NelleV
Copy link
Copy Markdown
Member

NelleV commented Oct 30, 2016

I am totally in favor of argparse!

Copy link
Copy Markdown
Member

@NelleV NelleV left a comment

Choose a reason for hiding this comment

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

At some point we will have to refactor a bit this code, but for now this looks good.

tests.py Outdated

if '--no-pep8' in sys.argv:
parser = argparse.ArgumentParser()
parser.add_argument('--no-pep8', action="store_true")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we really need no-pep8 and pep8? Seems they are redundant.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's certainly confusing. I think the idea is that '--pep8' means do only PEP8 testing, '--no-pep8' means do everything except PEP8 testing, and leaving both out means test everything including PEP8.
When using argparse, it would be good to add 'help' kwargs to each add_argument call.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oh wow… Thanks for the explanation.

@Kojoley
Copy link
Copy Markdown
Member

Kojoley commented Oct 30, 2016

I suppose argparse will interfere with nose on --help flag.

@anntzer
Copy link
Copy Markdown
Contributor

anntzer commented Oct 30, 2016

Haven't looked at the PR itself but in any case you can prevent argparse from adding a --help with add_help=False (https://docs.python.org/3/library/argparse.html#add-help).

@NelleV
Copy link
Copy Markdown
Member

NelleV commented Nov 5, 2016

Thanks @anntzer for pointing out the solution.
@bcongdon Do you think you can add this to the PR?

@bcongdon
Copy link
Copy Markdown
Contributor Author

bcongdon commented Nov 5, 2016

Sure. Added it 👍

@tacaswell
Copy link
Copy Markdown
Member

This seems to have broken the --with-coverage flag https://travis-ci.org/matplotlib/matplotlib/jobs/173562893

See https://docs.python.org/3/library/argparse.html#nargs for REMAINDER. Any CL args we do not explicitly consume should fall through to nose / pytest (eventually).

@tacaswell tacaswell added this to the 2.0.1 (next bug fix release) milestone Nov 8, 2016
@tacaswell
Copy link
Copy Markdown
Member

milestoned as 2.0.1, but if the backport is at all hard, lets not bother.

@bcongdon
Copy link
Copy Markdown
Contributor Author

bcongdon commented Nov 8, 2016

Latest commit should fix passthrough flags like --with-coverage

@tacaswell tacaswell changed the title Added -j shortcut for --processes= [MRG+1] Added -j shortcut for --processes= Nov 8, 2016
@NelleV NelleV merged commit 3e89069 into matplotlib:master Nov 8, 2016
@NelleV
Copy link
Copy Markdown
Member

NelleV commented Nov 8, 2016

@tacaswell This does not apply cleanly on v2.x. I don't think it is worth bothering with this patch for 2.0. What do you think?

@efiring
Copy link
Copy Markdown
Member

efiring commented Nov 8, 2016

I'll answer: No, just leave it in master.

@QuLogic QuLogic modified the milestones: 2.1 (next point release), 2.0.1 (next bug fix release) Nov 8, 2016
@QuLogic QuLogic changed the title [MRG+1] Added -j shortcut for --processes= Added -j shortcut for --processes= Nov 8, 2016
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.

7 participants

X Tutup