-
Notifications
You must be signed in to change notification settings - Fork 3
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
Warning about IamDataFrame.data
deprecation
#109
Comments
The majority of tests involve constructing and modifying dataframes in this way, e.g. from test_utils: We need to refresh the metadata in order to proceed.df_to_test = pyam.IamDataFrame(df_to_test.data) If you change this, you will be going out of your way to make work for me without adding functionality for anyone. This would be most annoying under any circumstances, but particularly since silicone is on haitus while the paper is under review, and I am doing other, time-sensitive projects. |
First, this is not going to happen in the next days - so you should have plenty of time to refactor when it's convenient. But I thought better to give warning of possible deprecation early. Second, it will actually provide additional functionality (to you) by using pyam as intended - for example using Third, it might be a good opportunity to refactor your code:
seems to be doing the same as
(with the second option being more readable and maintaining internal consistency). |
hi hi, I think there might be some misunderstanding here so just want to jump in to see if I can help clear things up at all. Firstly, thanks @danielhuppmann, pointing out the Secondly, @Rlamboll I wouldn't worry about having extra work all of a sudden. @danielhuppmann and many others have gone to massive lengths to make sure pyam adheres to semantic versioning. In short, that means that if they make some change which doesn't work with silicone, we can simply lock the version of pyam. We can leave it locked until we're ready to update our code for the newer version of pyam, hence no nasty surprises and extra work when there are other tight deadlines, ever :) Whilst we don't get to decide what pyam develops in, we also get the guarantee that it will be versioned appropriately so we can avoid any changes we don't like. |
|
tl;dr I think there's a pretty easy fix here. Having said the above, I think there's a few things which are worth clarifying.
I'm not sure that's what is being said. I think we're just clarifying that one shouldn't operate on
I think the point is that being able to set values in this way is an (I suspect unintended) consequence of pyam's convenience access (see https://github.com/IAMconsortium/pyam/blob/0a7931f4fd983c462deba8654e82c5c0f7d520d9/pyam/core.py#L141). I think @danielhuppmann's point is that this is a relic of earlier work but shouldn't actually be used in practice (as you can see in the code, only meta is altered which breaks the internal consistency). I guess this is the nature of bugs, you put stuff in and only work out later that it wasn't what was intended. At that point your options are a) leave it forever so downstream users don't have headaches but your own development stalls and you have permanently buggy code, b) fix it immediately and don't tell anyone, downstream users will work it out or c) flag it as a bug, raise deprecation warnings so people can change code that uses deprecated features and use clear versioning so that downstream users can identify and update to the new behaviour as suits them. Of those options, I think c) is clearly best and am happy pyam does it this way. Of course, if you want to offer a fix so that the direct access (e.g. data["scenario"] = "interesting scenario") actually works as intended, I think such a PR would be gladly welcomed into pyam.
I don't think it's fair to suggest that pyam should have to think of every single place it's used before it makes a change. If we're writing a pipeline elsewhere, then it's our job to control the versions of packages within the pipeline. In such a case the semantic versioning is essential for quickly identifying behaviour conflicts. It's our job as pipeline maintainers to deal with conflicting requirements, not pyam's job.
With all due respect, I you're underestimating the pyam team here. They have a massive user base which they are looking after, and they don't make changes like this lightly. If they say the change needs to happen, then I think they should be believed and/or an issue raised in pyam where they have a chance to respond. In this case, I think the need is pretty clear. Directly fiddling with data means that meta can become out of date, which then blows up a whole bunch of pyam functionality. The other problem with As discussed above, one very easy change would be that |
Thanks @znicholls for the detailed explanation - I agree with everything you say! Indeed, having If silicone is indeed only working on the data and does not require any extra features, refactoring to
is a pain, but should be manageable. I apologize for the inconvenience! |
Per the discussion in IAMconsortium/pyam#397, it seems that the
data
attribute of anIamDataFrame
is handled not as intended in silicone.Could you please point to the instance(s) where manipulating
data
is necessary such that the resultingIamDataFrame
is inconsistent.I can't guarantee that we won't refactor
data
in a way that breaks the current usage in silicone.The text was updated successfully, but these errors were encountered: