Skip to content

Commit d3d5c8e

Browse files
authored
Merge pull request #2037 from pllim/config-no-write
MNT: Do not write config on import
2 parents cfe5c86 + f78949f commit d3d5c8e

File tree

4 files changed

+11
-238
lines changed

4 files changed

+11
-238
lines changed

astroquery/_astropy_init.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,36 +25,9 @@
2525

2626
if not _ASTROPY_SETUP_: # noqa
2727
import os
28-
from warnings import warn
29-
from astropy.config.configuration import (
30-
update_default_config,
31-
ConfigurationDefaultMissingError,
32-
ConfigurationDefaultMissingWarning)
3328

3429
# Create the test function for self test
3530
from astropy.tests.runner import TestRunner
3631
test = TestRunner.make_test_runner_in(os.path.dirname(__file__))
3732
test.__test__ = False
3833
__all__ += ['test']
39-
40-
# add these here so we only need to cleanup the namespace at the end
41-
config_dir = None
42-
43-
if not os.environ.get('ASTROPY_SKIP_CONFIG_UPDATE', False):
44-
config_dir = os.path.dirname(__file__)
45-
config_template = os.path.join(config_dir, __package__ + ".cfg")
46-
if os.path.isfile(config_template):
47-
try:
48-
update_default_config(
49-
__package__, config_dir, version=__version__)
50-
except TypeError as orig_error:
51-
try:
52-
update_default_config(__package__, config_dir)
53-
except ConfigurationDefaultMissingError as e:
54-
wmsg = (e.args[0] +
55-
" Cannot install default profile. If you are "
56-
"importing from source, this is expected.")
57-
warn(ConfigurationDefaultMissingWarning(wmsg))
58-
del e
59-
except Exception:
60-
raise orig_error

astroquery/astroquery.cfg

Lines changed: 0 additions & 210 deletions
This file was deleted.

astroquery/setup_package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
def get_package_data():
5-
return {'astroquery': ['astroquery.cfg', 'CITATION']}
5+
return {'astroquery': ['CITATION']}

docs/index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,16 @@ All query tools allow coordinate-based queries:
143143
144144
For additional guidance and examples, read the documentation for the individual services below.
145145

146+
.. _default_config:
147+
148+
Default configuration file
149+
--------------------------
150+
151+
To customize this, copy it to your ``$HOME/.astropy/config/astroquery.cfg``,
152+
uncomment the relevant configuration item(s), and insert your desired value(s).
153+
154+
.. generate_config:: astroquery
155+
146156
Available Services
147157
==================
148158

0 commit comments

Comments
 (0)