Conversation
|
This seems to include commits by @mdboom that have already been merged in - maybe a rebase is necessary against the most recent master? |
astropy/config/configs.py
Outdated
There was a problem hiding this comment.
Isn't the directory created in get_config_dir?
There was a problem hiding this comment.
the .astropy directory is, but the config directory (for astropy, this is .astropy/astropy) is not until this point. (see below for more on this)
|
See my low-level comments above. Here's some comments pertaining to the pull request discussion:
|
|
Those updates are just a rebase against master to get rid of the extraneous commits. |
|
@mdboom - Regarding the general comments(in the same order):
|
|
One quick question - do we really expect to have so many configuration options that we'll need to split it up into multiple fils, one for each sub-package? If not, then we can have a single file with e.g. That would be easier than having to create a config file for each sub-package, which could be a pain. Maybe you were already thinking about having this? If we went with that, then we could even have just a file called |
|
+1 for @astrofrog Having all options in one file makes it so much easier to backup, to synchronize or to give my options to colleagues new to astropy. I don't mind if that single file needs a few hundred lines, because I could just use a text editor to modify it. And, if the options are named sensibly, it's often easier to edit a text file then to search though the documentation to find functions like If you think The fitting package |
|
@eteq: In response to the general comments:
To @astrofrog 's comment: I don't know if being consistent with how matplotlib handles configuration should be a goal :) It's been on my TODO list for some time to make it more like I described above. My suggestion (to put the files in the modern platform-specific locations for configuration and cache) is orthogonal to whether we decide to have a single file for configuration or a directory with multiple files. |
|
@mdboom regarding the directory structure: My point was that there's no straightforward way to do this in a cross-platform way. I suppose we could look to see if its unix-like, and put it in |
|
@astrofrog and @hamogu : I had conversations with a couple other people who favored multiple-file scheme, as that then allows you to skip having sections entirely for smaller subpackages. Again, I don't really have a terribly strong opinion here, so one or many files is fine. Two complications to consider with a single-file scheme, though: First, affiliated packages that get merged will have to switch to using the astropy config file, so settings from affiliated packages will have to get copied over. This may not be an issue, but is something to be aware of. Second, it's a bit more complicated to enforce the sectioning in ConfigObj if its not at a per-file level. To add a section in ConfigObj, you do |
|
@eteq - ok, I don't have a strong preference for single file vs multiple file. By the way, do your comments mean that affiliated packages will be allowed (and should be encouraged) to place their configuration files in the astropy configuration directory? (to avoid having to move the config once the package is merged) If so, how should we deal with name changes? (e.g. specutils might become part of astropy.spectrum) @mdboom - I don't really have a strong preference for where the cache should go, but I think we want to keep the configuration files in the same location for all systems ( |
|
@astrofrog - you make a good point with the name change bit... that's actually a good reason to use a single file for astropy. So perhaps it sould be that the core astropy package configuration would be in @mdboom - just to be clear, were you saying you thought single-file (e.g. like matplotlib) is a good idea, a bad idea, or you don't have a strong preference? |
astropy/config/__init__.py
Outdated
There was a problem hiding this comment.
Should these be relative imports .configs, .data and .affiliated?
There was a problem hiding this comment.
Good catch - I fixed that with a commit just now
|
@eteq - maybe we could even do |
|
@eteq: Note that the current version of IPython puts its configuration XDG_CONFIG_HOME on Linux. matplotlib has a bug out for this change as well, which will probably be fixed for the next major release. IPython doesn't have any cache, of course, only configuration. If we really want everything under I don't have strong feelings about whether configuration is a single file or not. |
|
@mdboom: Hmm... it looks like IPython first looks for XDG_CONFIG_HOME and then does .config if it doesn't find it. They do have something like a cache in the form of the history database - that's stored in the config dir (although you're right that just because other people do something that doesn't mean we should). There also seems to be a XDG_CACHE_HOME variable that XDG defines... but neither of those variables seem to be defined by default on either OS X or Ubuntu (although the Ubuntu I checked is a bit out-of-date). I'm leaning towards a variant of your intermediate solution - I'll look for a directory called |
astropy/config/configs.py
Outdated
There was a problem hiding this comment.
One suggestion for this function that came up in other discussions: It should also be possible to specify the location of the Astropy config dir in an environment variable, such as ASTROPY_CONFIG_DIR. Another nice feature which matplotlib has, is to look for a '.astropy' directory in the cwd. I know we haven't done anything with logging yet, but there should be a log message as to which config dir is being used. If you prefer I could just open a separate issue for this for now.
There was a problem hiding this comment.
I agree this makes a lot of sense (modulo my comments below). Regarding the message, for now I'll use print statements, with #TODO comments that clearly indicate this should be switched to the logging framework as soon as it has been merged.
|
I am closing this pull request and replacing it with a new one because the new version is pretty much different almost everywhere... |
Define an UnitNotSet class so we can have uninitialised units
…eds_stub attribute to all Extension objects (awesome =_=), so adding this extension to the extension list *before* the original build_ext.finalize causes things to break later when the original build_ext.run tries to access that attribute.
Fix for _needs_stub failure
…ight, but will be useful in the future as a template for tests for build_ext. This also involved reorganizing setup_helpers so that it will be easier to reset its module global variables between tests.
Add 0.4 announcement
This pull request implements the layout of the
configpackage, And also implements functionality for remote download/caching of data files and configuration file utility functions.The remote data aspect of this is ready to go (including tests). One choice I ended up making that could be changed if desired: As it stands right now, data included in the source distribution should live in the astropy/data directory (or subdirectories), rather than in data directories scattered around in each package. If that's strongly desired, it can probably be implemented, although it may require fiddling with setup.py. I shy aware from that because it'll be confusing for future developers - specifically, how does the directory structure of package map onto the directory structure in the data directory? It could be multiple ways, but the simplest thing is to just put them all in one place.
As for the configuration files, there are a few questions to be addressed:
get_config('subpackagename')) be it? I could implement a scheme where package authors could just define constants at the top of the modules and have them automatically get passed out to the configuration files (or a new version adopted or whatever), but I wasn't sure what everyone else wanted, so I started with this basic interface (which will be useful in more complicated cases, anyway)..astropyname? Right now, inside that directory there will be directories with the name e.g.astropyfor the astropy core,afpkg1for the first afilliated package, and so on... You specify which one you want with the second argument toget_config. This could change to have separate main directories for each affiliate package, but I think this is easier to deal with, as it doens't clutter up the user's home directory.get_configI'm pointing to the configobj web site for definitions of the ConfigObj object and its interface. Should I pull in a copy of the ConfigObj documentation and included it in the sphinx docs (just as a separate html file include in the source dist)?Once this has been decided on and the pull request completed, I will write up documentation describing how to use these modules in the sphinx docs and issue a new pull request.