Skip to content
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

MNT: Do not write config on import #429

Merged
merged 1 commit into from
Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.