-
-
Notifications
You must be signed in to change notification settings - Fork 2k
APE3: Config system improvements #2094
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
Conversation
|
I could be mistaken, but I thought the "default" config file, being that it contains only sample values and does not provide the actual defaults to the library, was going to be named something like |
|
I think that plan was rejected, because it means if the user copies it to the "real" config file, and then does nothing, we can't ever change the defaults for config values because the old defaults will still be in the config file from a previous version. It seems that commented-out config entries is the only sane way to detect what the user actively changed -- it's what we do in matplotlib, and I think it works pretty well, but matplotlib has no facilities at all for saving values to the config file. If we remove that from astropy as well, we're golden -- maybe that's something to consider. |
|
I think that if the user choose to copy the config file they are actively taking responsibility for it (whereas if they just leave the default then we can replace it without them noticing). I think we should remove the ability to save changes to the config file from code. I think that with the other restructuring we're doing, that becomes less useful, if not even dangerous. |
|
I agree about removing the ability to save, it solves this problem quite handily. Whether to comment out values in the template then becomes a separate question -- I think it's handy to have everything in there, even if you don't care about all of them at the time. If you have them uncommented, you have to remove the entries you don't care about if you want upgrading to be smooth. If you have everything in the template commented, only the entries you actively changed will require mental effort when upgrading. |
|
It seems like there were no objections to removing the ability to save, so maybe we can go ahead with that assumption? (and update the APE itself too?) |
astropy/astropy.cfg
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have mixed feelings about whether this should be a global configuration item since it affects reproducibility (a script may assume that the names have been changed to col. I think it would make more sense for this to be an option to Table. @taldcroft - what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't done any sorting of the configuration items yet. That's in phase 2 as the APE is written. Probably not worth commenting on that now -- I was going to raise any controversial ones in the APE itself.
|
@mdboom - actually I think you can ignore my comments above - this doesn't yet implement splitting configuration into global vs run-time configuration items, right? |
|
@astrofrog: Yes -- I'm going to do that as a second phase. This is just getting the infrastructure together. |
|
This is now ready for review. I won't have time to respond over the next week or so, but thought I'd give others a chance to comment now. This patch ended up much larger than I had hoped -- the vast majority of the lines of code have to do with backward compatibility. I have no idea how many users even use the config file and how important that was. I, for one, will be glad to rip most of this out in the astropy 0.5 cycle. Which config items become science state items is still up for debate, but the infrastructure is there to do just about any kind of move we want. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be clear, the alias is just for backward-compatibility and not required going forward, right? Will the alias be depreciated as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes -- the aliases keyword means that the configuration system will also look for the value under that old name, but it will display a DeprecationWarning. In astropy 0.5, we'll take that out altogether, and it just won't look in the old place at all.
|
The unit tests are all passing here, and it's ready for a review. I suggest starting with |
|
@mdboom - it looks like it needs a rebase - will you rebase after we've reviewed it? (since rebasing can sometimes remove in-line comments) |
|
Sure. I can hold off on rebasing. |
|
@mdboom - actually I meant that you could do it now since we haven't started reviewing it yet - but I'll leave it up to you :) |
|
Rebased. |
|
@mdboom - thanks! I will try and review this today or tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe clarify whether at installation time or runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I installed astropy and imported it, but the config file was not replaced, nor was the astropy.0.4.cfg file added. I'll try and understand why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore my last comment - I read the comment you left that copying the template is not done for dev versions.
|
@mdboom - this looks fantastic! Thank you for all your work in refactoring this! Judging from the code, I was expecting a deprecation warning here: but didn't see one. Also, from the code, it looks like calling should emit a warning, but shouldn't we make Minor bug: |
|
@mdboom - I ran into the folllowing error: |
|
@astrofrog wrote:
I get the deprecation warning when I do that. I wonder what's different about your environment... |
|
@astrofrog: Your import error -- perhaps caused by mixing versions of astropy? Can you try a clean build and install? EDIT: Scratch that. I see the problem, and will submit a fix. |
|
This has been updated so that affiliated packages still using the astropy 0.3 conventions will continue to work. |
|
Note to self: #2219 will add a new configuration item. This PR should be updated to include that config item updated for the new style. |
|
Insane rebase completed. |
|
Thanks! I wonder why the conflict happened in this case. Let's merge this once it passes, and before any other PR! |
|
There were significant changes in VO, which uses config items pretty heavily, so a lot of the renames had to be redone etc. |
|
My bad - I should have merged this first. Thanks for your work on this! I will merge this first thing tomorrow morning (once the Travis queue clears), and we should make sure we don't merge anything else in the mean time. |
|
Pretty sure there woulda been merge conflicts either way 🤷 |
|
@mdboom - the Travis failures appear to be genuine. I'm going to restart the 3.2 build, but I think it's done that every time. |
|
Ok, the 3.2 failure was not real, but the sphinx failure is. |
|
The Sphinx errors are trivial to fix, so to save time, I'm going to go ahead and merge this now, then fix the warnings directly in master. |
APE3: Config system improvements
|
I fixed the warnings in d814e7e |
|
Two more merge leftovers in #2436. |
|
Thanks for cleaning these up --- sorry for rushing to get this out the door on Friday. |
This currently implements the "changes to the base configuration system" part of the APE.
Hit a bit of a road block, since it's not possible to update configuration values in the default configuration file, since they are commented out by default. We first need to find and remove the commented out value to replace it with a real one. ConfigObj doesn't really handle that directly, and not sure how to handle it in the general case.