Skip to content

Conversation

@eteq
Copy link
Member

@eteq eteq commented May 1, 2014

This is triggered by discussion in #2304. There seems to be building consensus to do away with the functional interface in favor of e.g. WMAP9.luminosity_distance(...) and similar OO-approaches.

The rest is my response to the comment in #2304 by @nhmc that begins with "I started a pull request to mirror the methods as functions, and my inner developer protested too much":

I would also be fine (perhaps happy?) with seeing the functional interface go away, but I also see @nhmc's point that this may well annoy users who we never hear from.

A "third-road" option: Deprecate in 0.4, and in the next verson (1.0, an LTS), leave the functions in, but no longer publicly expose them (e.g., just remove from .funcs import * from astropy/cosmology/__init__.py). In the deprecation message, be sure to end with "in future releases, the functional interface will not be supported, but will remain in astropy.cosmology.func" or similar. Then people can keep using their old code with just a trivial change from from astropy.cosmologyimport whatever to from astropy.cosmology.func import whatever, but they've been warned that they really shouldn't be doing that.

@eteq
Copy link
Member Author

eteq commented Apr 21, 2014

@eteq
Copy link
Member Author

eteq commented Apr 21, 2014

Oh, and one point I forgot to mention above: The idea is that we'd deprecate in 0.4, and then wait and see if we get any complaints (might require some actively legwork on our part to actually ask people instead of just seeing if they raise an issue).

@aconley
Copy link
Contributor

aconley commented Apr 21, 2014

Sounds like a good plan to me.

@nhmc
Copy link
Contributor

nhmc commented Apr 21, 2014

Sounds good to me too.

@eteq
Copy link
Member Author

eteq commented May 1, 2014

Alright, @aconley @nhmc, this is now a PR that deprecates the functional interface. I also tried to update the docs appropriately, but some cases may have slipped through.

If we do go ahead with removing them in a future version, some of the tests will have to be re-written, but I figured I'd leave them in so that we're testing until they actually go away.

@nhmc
Copy link
Contributor

nhmc commented May 1, 2014

Thanks for the PR!

The code changes look fine, but I think the documentation will need a bigger overhaul. The 'Getting Started' section should show examples using the built-in cosmologies, and the description of get_current()/set_current() can be moved right to the end of the docs. The nice list of functions at the bottom will also go away once the functional interface is removed, so we should work out a way to list the most commonly used methods in a similar way.

I'm happy to open a separate PR for the documentation changes if you like.

@eteq
Copy link
Member Author

eteq commented May 1, 2014

Yeah, I see your point on the docs, @nhmc . If you could take care of it, that would be great (particularly since you have a good idea). Do you want to open it against my branch here, or would you rather wait for the merge and get it from master?

(Also, there was a typo in the "whatsnew" section that I just fixed)

@nhmc
Copy link
Contributor

nhmc commented May 1, 2014

I'll wait for the merge.

@astrofrog
Copy link
Member

@eteq - this will need rebasing following the merging of #2094

@eteq
Copy link
Member Author

eteq commented May 5, 2014

Alright, rebased. If the tests pass I'll merge it tomorrow. I also had to make some doc changes to mesh with @2094 and it's change to using default_cosmology.get/set. @nhmc, this may be part of what you had in mind, but of course cleaning it up more is a good idea!

@astrofrog
Copy link
Member

👍

@astrofrog
Copy link
Member

@eteq - I think there is a minor rebase needed, due to #2103 - I just realized, can you remove the function adding in #2103 from the funcs.py file? (since there's no need to deprecate it).

@eteq
Copy link
Member Author

eteq commented May 6, 2014

@astrofrog - done. I also realized that the age and comoving_volume convinience functions were not in 0.3, so I removed them as well (previously they were deprecated). If the tests pass, I will merge.

@eteq
Copy link
Member Author

eteq commented May 6, 2014

Looks like there was another conflict just merged... Rebasing again.

@astrofrog
Copy link
Member

👍

@eteq
Copy link
Member Author

eteq commented May 7, 2014

Alright, merging! @nhmc, you can do the doc changes against master at will.

eteq added a commit that referenced this pull request May 7, 2014
Deprecate functional cosmology interface
@eteq eteq merged commit d10e736 into astropy:master May 7, 2014
@eteq eteq deleted the deprecate-cosmology-funcs branch May 7, 2014 17:32
@nhmc
Copy link
Contributor

nhmc commented May 7, 2014

Great, thanks!

On 8 May 2014 03:32, Erik Tollerud [email protected] wrote:

Merged #2343 #2343.


Reply to this email directly or view it on GitHubhttps://github.com//pull/2343#event-118785548
.

@aconley
Copy link
Contributor

aconley commented May 19, 2014

Now that it's too late...

Should we warn users somewhere to update their astropy.config information? If you have an old one, every time you import astropy.cosmology you will get a warning about the default_cosmology parameter being deprecated. Easy to fix -- if you happen to know about the astropy config system, which I bet many users don't.

@astrofrog
Copy link
Member

@aconley - I think the warning should only appear if you modified the configuration file, so users that are not familiar with the config file will probably not see the warning. Did you edit your config file?

@aconley
Copy link
Contributor

aconley commented May 19, 2014

I have no idea, but it's certainly possible.

@mdboom
Copy link
Contributor

mdboom commented May 19, 2014

As @astrofrog says, by design that warning should only appear for people who edited their config file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants