Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Fix cycler validation #6275
Conversation
mdboom
added the
needs_review
label
Apr 6, 2016
|
@WeatherGod Why is there an extra merge commit in here? |
tacaswell
commented on an outdated diff
Apr 8, 2016
| @@ -767,6 +759,17 @@ def validate_cycler(s): | ||
| else: | ||
| raise ValueError("object was not a string or Cycler instance: %s" % s) | ||
| + unknowns = cycler_inst.keys - (set(_prop_validators.keys()) | |
tacaswell
Owner
|
tacaswell
and 1 other
commented on an outdated diff
Apr 8, 2016
| @@ -767,6 +759,17 @@ def validate_cycler(s): | ||
| else: | ||
| raise ValueError("object was not a string or Cycler instance: %s" % s) | ||
| + unknowns = cycler_inst.keys - (set(_prop_validators.keys()) | | ||
| + set(_prop_aliases.keys())) | ||
| + if unknowns: | ||
| + raise ValueError("Unknown artist properties: %s" % unknowns) | ||
| + | ||
| + # Not a full validation, but it'll at least normalize property names | ||
| + # A fuller validation would require v0.10 of cycler. | ||
| + for prop in cycler_inst.keys: | ||
| + norm_prop = _prop_aliases.get(prop, prop) | ||
| + cycler_inst.change_key(prop, norm_prop) |
tacaswell
Owner
|
|
I suspect that this will not catch everything as aliases will still fall through the plot functions in funny ways. |
tacaswell
added this to the
1.5.2 (Critical bug fix release)
milestone
Apr 8, 2016
|
This isn't meant to catch anything having to do with plotting functions. This is strictly about the problem arising from having multiple entry points from which users can supply a property cycler, and normalizing the aliases was only done at one of the entry points. Now, aliasing will happen at every entry point. We are still left with validation only happening if the cycler is passed as a string, but full validation will need the newer cycler features. |
|
The extra merge commit seemed to have happened because I originally forked from the v1.5.x branch, but submitted this as against master instead. I'll fix that at the next batch of updates to this PR. |
|
I mean that users can pass |
|
That is the responsibility of the individual plotting functions. The plotting functions can now assume that the property cycle will always have the normalized property names. Previously, it was possible that it didn't always have that, and as such, would do a double-update. That is now fixed. However, you can also get a double-update if the plotting function does not properly normalize its list of properties before consulting the property cycle. We are much better about this than we used to be, but still not perfect. |
|
I think we are on the same page. |
|
Of course, there is still the fun aspect of fall-back properties (e.g., using color when facecolor or linecolor isn't provided), and the weird mixing of terminology (e.g., eliding 'color' to mean 'facecolor' in bar()). |
|
Please note, I accidentally pushed up this branch to matplotlib's repo. I deleted that branch, and cancelled the extra travis build that it triggered (comes up now as an error). I don't think I have any permissions to cancel the extra appveyor build, though. |
|
I just noticed that this is milestoned for v1.5.2. That might need to be reconsidered because of the version bump in the cycler dependency? Not that it is a difficult dependency, I just didn't know if we should do that in a bugfix release. Also, it isn't like what I am fixing is a regression, since property cyclers were brand-new in v1.5. |
WeatherGod
closed this
Apr 11, 2016
mdboom
removed the
needs_review
label
Apr 11, 2016
WeatherGod
reopened this
Apr 11, 2016
mdboom
added the
needs_review
label
Apr 11, 2016
tacaswell
modified the milestone: 2.0 (style change major release), 1.5.2 (Critical bug fix release)
Apr 11, 2016
|
I am sold on not bumping the version of required cycler on 1.5.x branch. |
|
cycling this PR didn't get rid of the bad Appveyor/Travis runs that happened when I accidentally pushed to the repo. So they should be ignored. The PR test runs are green. |
tacaswell
merged commit 6f167ca
into matplotlib:master
Apr 11, 2016
3 of 4 checks passed
tacaswell
removed the
needs_review
label
Apr 11, 2016
tacaswell
added a commit
that referenced
this pull request
Apr 12, 2016
|
|
tacaswell |
337fb07
|
|
backported to v2.x as 337fb07 |
WeatherGod
referenced
this pull request
Apr 27, 2016
Merged
BLD: make minimum cycler version 0.10.0 #6340
rathann
commented on bfe5e3f
Aug 29, 2016
|
Actually, this requires cycler 0.10+, as it was implemented in 1898aa2, which is present only in 0.10.0 and master. |
WeatherGod commentedApr 6, 2016
This should fix the cycler normalization/validation bugs we have seen such as #5875. This does require a minimum version of Cycler v0.9 to get the
change_key()feature. We could go a few steps further and get full validation of property values for Cycler objects, but that will require Cycler v0.10, I think, so that I can introspect the cycler object better -- not out of the question, but I figure I would get this first step done first.