Skip to content

Commit

Permalink
MNT: Do not write config on import
Browse files Browse the repository at this point in the history
  • Loading branch information
pllim committed Apr 9, 2021
1 parent 71f23fd commit fa5bae9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 61 deletions.
22 changes: 2 additions & 20 deletions poppy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
"""
# Enforce Python version check during package import.
# This is the same check as the one at the top of setup.py
import os
import sys
from warnings import warn
from astropy import config as _config

try:
Expand All @@ -27,9 +25,11 @@

__minimum_python_version__ = "3.6"


class UnsupportedPythonError(Exception):
pass


if sys.version_info < tuple((int(val) for val in __minimum_python_version__.split('.'))):
raise UnsupportedPythonError("poppy does not support Python < {}".format(__minimum_python_version__))

Expand Down Expand Up @@ -102,24 +102,6 @@ class Conf(_config.ConfigNamespace):

conf = Conf()

config_dir = os.path.dirname(__file__)
config_template = os.path.join(config_dir, __package__ + ".cfg")
if os.path.isfile(config_template):
try:
_config.configuration.update_default_config(
__package__, config_dir, version=__version__)
except TypeError as orig_error:
try:
_config.configuration.update_default_config(
__package__, config_dir)
except _config.configuration.ConfigurationDefaultMissingError as e:
wmsg = (e.args[0] + " Cannot install default profile. If you are "
"importing from source, this is expected.")
warn(_config.configuration.ConfigurationDefaultMissingWarning(wmsg))
del e
except:
raise orig_error

from . import poppy_core
from . import utils
from . import optics
Expand Down
41 changes: 0 additions & 41 deletions poppy/poppy.cfg

This file was deleted.

0 comments on commit fa5bae9

Please sign in to comment.