-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Default to not showing deprecation warnings #35362
Conversation
To clarify my point, it's not about my code that's running slower or printing warnings. In the case that triggered this discussion, after updating DataStructures from 0.17.10 to 0.17.11, a JuMP user started to see warnings, and their code was running more than 10x slower than before (JuliaCollections/DataStructures.jl#599 (comment)). This is a terrible user experience, arguably as bad as getting an error message from an API breakage—at least that would be more obvious and require less time to debug. Supposing that one of my constraints as a package developer is to avoid terrible user experiences like the one above, the best action I can take is to defensively freeze my dependencies to exact patch releases. This is bad for the ecosystem overall because overly tight version requirements will create version conflicts elsewhere. I support |
Also, just to take issue with the implied conclusion that because
we cannot introduce breaking changes in a minor version or patch release. This is explicitly not true for versions <
Please learn from my experience and use this standard to your extreme advantage, because once you get to v1, your hands become considerably more tied. That said, I don't know how I feel about Also "that said", I understand and agree with @mlubin's concerns that it is a suboptimal user experience. But there is a risk to running v0 code, and library developers need a chance and flexibility to finalize an API. If an upstream relies on a v0 dependency, then it's up to the upstream to keep on top of things, as there should not be any guarantee of API stability if we're SemVer purists. |
Julia explicitly doesn't follow that rule. https://julialang.github.io/Pkg.jl/v1/compatibility/#Pre-1.0-behavior-1 says:
|
Yes, I understand, but it still relaxes SemVer below v1. In this case it would've been more appropriate to release 0.18.0 instead of 0.17.11. |
I see your point, but I don't think normal users should be exposed to this process of discovery. Looking at deprecations is its a useful sign yes, to go looking and check what is up. And you don't want to cap the version of your dependency of a dependency -- else you will missout on those backported bugfixes. |
@sbromberger, regardless of the specifics of SemVer, it seems that we're in agreement that if deprecation warnings are displayed by default, then a deprecation should be treated as an API change when deciding the version number of the next release. I think this isn't the intention of deprecations, so setting |
Well, I only agree with this because of the performance impact of the depwarn. If the only change was a warning being issued, then no – I would disagree that it counts as an API change. Here's an example: in LightGraphs, right now, we are at 1.3.1 officially. For 2.0.0 we are planning a comprehensive, full-scale API rewrite to most of our codebase. The plan was to release 1.4.0 with deprecation warnings and 2.0.0 with the deprecations (and old code) removed, similar to how Julia 0.7/1.0 was rolled out, except we're beyond version 1. If depwarns were API changing, then we'd have to release 2.0.0 with the deprecation warnings, and then 3.0.0 to remove them, since the API really changes when we prohibit people from using the old function names. This seems ... silly. |
I don't agree that the performance impact is the only issue. It's also a bad user experience for JuMP users to see warnings that they have no need to understand about JuMP internals (i.e., how JuMP uses certain libraries). That said, the issue still stands on your terms if there's no way to mitigate the performance impact of deprecation warnings in general. |
Well, no. Let me walk it back a bit after having applied the proposed rules to LightGraphs: would your proposal be to release 2.0.0 with deprecation warnings, simultaneously with 3.0.0 with the deprecations/old code removed? Or would it be 2.0.0 with depwarns, 2.1.0 without depwarns? Or something else? Right now our plans are to release 1.4.0 with depwarns, and 2.0.0 with the code removal. |
If you were to do this change, isn't it better to tweak Alternatively, maybe the default logger can do a bit more clever thing like printing deprecation warning only if the packages causing it is |
That can break some tests that rely on |
@sbromberger The hard constraint I would like to impose is to avoid the following situation:
There are a number of ways to avoid this situation. Turning off deprecation warnings by default is one. "2.0.0 with depwarns, 2.1.0 without depwarns" could also work. |
Why not use |
This raises the question as to when a change is considered breaking. For you, I conclude it's when performance or output changes. But to what extent? Performance improvements are certainly non-breaking. Are small performance regressions? Where do we draw the line? I'm not necessarily disagreeing. Until this conversation my feeling was the API was breaking "when functions that used to work with a given set of arguments no longer work with those arguments (or at all)". I can see the other view. But you can't hold both views unless you want "2.0.0 with deprecations, 3.0.0 without", which seems like an awful idea. |
Sorry for the double-post. cc @StefanKarpinski since he and I have discussed this subject recently. |
Because you're testing to make sure a function emits a (non-deprecation) warning correctly, not testing to see whether it's been deprecated. cf https://github.com/JuliaGraphs/LightGraphs.jl/blob/master/test/distance.jl#L62-L65 |
I don't think we need a complete answer to that question for this issue. A 10x performance regression that users noticed and complained about crosses the line for me. Also printing confusing warnings (about a library's internals) is breaking in my book. As a JuMP developer I want to be able to control the output that the user sees. We try very hard to avoid error messages and warnings that relate to library internals. |
This can be easily fixed by improving the tooling or the way the test is written or executed. I don't think it's a good reason to make it hard for the developers to see the deprecation warnings. |
PRs gratefully accepted. |
|
I agree |
Note |
If |
When running with |
Whitespace needs fixing in NEWS file. |
You can already do But I doubt people will do this in CI if this is not the default. It then, in turn, makes it very hard to use it. Imagine that tens of transitive dependencies printing deprecation warnings. How do you find the deprecation warnings from your package? It practically makes (OK. It is technically possible to develop a logging filter to focus on your packages. But then you have to be actively configuring packages to filter-in. Warning that requires your focus does not seem to be a good warning system.) |
Triage ok's this; any further improvements can be considered separately. |
Did triage acknowledge that, after this change, there is no reliable way for package authors to deliver a warning to other developers of downstream packages? (I'm asking this simply because the only way I can think of for triage to approve this PR is that they missed this aspect.) |
@tfk Developers of downstream packages should turn on deprecation warnings when updating the libraries they use. Worst case, when they update a library, they get a missing method error and have to take a step back and re-run the last working version with deprecation warnings on. Admittedly this is a change in the current workflow, but it's far from having "no reliable way" to deliver the warning. |
As I've explained this before, this requires developers of all transitive dependencies to do the same. This is unlikely to happen in distributed OSS ecosystem built by developers with heterogeneous skill sets. This also makes updating compat entries harder. Before this PR, you can just look at the result of the standard CI run by CompatHelper.jl (well, ideally, this would be the case). After this PR, you have to run the test suite manually. It also makes performance regression silent. Note that deprecated method does have performance overhead even under Please note that I'm only suggesting to include |
This has very much not been clear (at least to me) from reading your comments. That seems reasonable to me. |
@KristofferC Sorry, I've been fooling myself that I made my point clear as that's the first thing I said in this thread. But I should have re-iterate my point when replying to you as my first comment was way above in the thread. |
I'm really worried about how this might slow adoption of our upcoming LG2.0 release. If people (both direct users and authors of libraries that use LG) don't see deprecation warnings, they won't know that a new major version is available, and there will be no reason to look. This may also force us into supporting 1.x for much longer than we normally would. (This even impacts a plan we were considering to issue a single depwarn on LightGraphs 1.x saying that this version is not the latest, and to check code against a custom branch before moving to 2.x. I don't know how we get folks to move across major versions without notifying them, and this removes one main avenue for such notification. I guess we could use |
👍 |
* Default to not showing deprecation warnings Co-authored-by: Kristoffer Carlsson <kricarl@student.chalmers.se>
* Default to not showing deprecation warnings Co-authored-by: Kristoffer Carlsson <kricarl@student.chalmers.se>
All julia packages follow SemVer.
That means that that adding a deprecation is nonbreaking,
and removing the thing you deprecated is breaking.
As such consider if I was a package author. Where my package's current release is v1.x.
consider if I am renaming
foo(args...)
to the newgeneralized_foo(true, args....)
in v1.5.0That means I will not bne removing the old
foo
function til v2.0.0People using my package have Compat set as
="^1"
there is nothing wrong with them continuing to use the
foo
function forever, as long as they do not want to use v2 of my package.Indeed there is some advantages to continuing using
foo
since if they want to swap togeneralized_foo
, they need to restrict their compat to="^1.5"
, which might break compatibility with another package they are using with that might have restricted my package to="~1.1"
(idk why, maybe they need everything auditted)People get really frustrated about deprecation warnings, even to the exent of making PRs to remove them.
And not unreasonably so -- their code works fine, why are they getting spammed with this warning message? A warning message that makes there code much slower infact.
And there code is going to keep working fine since they have the compat bounds set.
One option is to hold off all deprecation warning until the last release before v2.0.0,
say v1.9.0.
However, that just delays the problem.
Even once v2 is out, I don't want to force people to upgrade, if v1, still works fine then that is great.
So I don't want them to do
up
with there compat still set to="^1"
, and for them toi get the 1.9 release added, and then get spammed with deprecation warnings.They should be able to upgrade at there own pace, when they are ready.
I personally just set
--depwarn=no
all the time, except when specifically wanting the warnings because I am upgrading on of my dependencies.and I think everyone else should to.
Thus this PR to change the default
cc @mlubin @sbromberger