Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Commit

Permalink
try hacking together configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
  • Loading branch information
nstarman committed Sep 12, 2021
1 parent cda4f22 commit f127f5f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
27 changes: 24 additions & 3 deletions discO/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# IMPORTS

# STDLIB
import configparser
import importlib
import os

# THIRD PARTY
Expand Down Expand Up @@ -55,9 +57,28 @@
if not HAS_GALPY:
collect_ignore.append("plugin/galpy/")
else:
from galpy.util import config as galpy_config
galpy_config.__config__["astropy"]["astropy-units"] = "True"
galpy_config.__config__["astropy"]["astropy-coords"] = "True"
# THIRD PARTY
import galpy

importlib.reload(galpy)

if ".tmp" in os.getcwd():

# THIRD PARTY
from galpy.util import config as galpy_config

# configuration
galpy_config._APY_LOADED = True
galpy_config.__config__.set("astropy", "astropy-units", "True")
galpy_config.__config__.set("astropy", "astropy-coords", "True")

# write config and read it
cfilename = os.path.join(os.path.expanduser("~"), ".galpyrc")
galpy_config.write_config(cfilename, galpy_config.__config__)

__config__ = configparser.ConfigParser()
__config__.read(cfilename)
galpy_config.__config__ = __config__


# ------------------------------------------------------
Expand Down
15 changes: 11 additions & 4 deletions discO/setup_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

from __future__ import absolute_import

# STDLIB
import importlib

__all__ = ["HAS_AGAMA", "HAS_GALA", "HAS_GALPY", "HAS_TQDM"]


Expand Down Expand Up @@ -48,12 +51,16 @@
else:
HAS_GALPY = True

# TODO better way of ensuring unit!
importlib.reload(galpy)

# THIRD PARTY
from galpy.util.config import __config__
from galpy.util import config as galpy_config

__config__.set("astropy", "astropy-units", "True")
__config__.set("astropy", "astropy-coords", "True")
# configuration
galpy_config._APY_LOADED = True
galpy_config.__config__.set("astropy", "astropy-units", "True")
galpy_config.__config__.set("astropy", "astropy-coords", "True")
galpy_config.default_configuration["astropy"]["astropy-units"] = True

# /try

Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ packages = find:
python_requires = >=3.8
setup_requires = setuptools_scm
install_requires =
extension_helpers
astropy >= 4.3
numpy >= 1.17
PyYAML
Expand Down

0 comments on commit f127f5f

Please sign in to comment.