From 7121a95079c74c63fbe9ff2ca2a670b5a2b159db Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Sat, 27 Jul 2024 13:22:15 -0400 Subject: [PATCH] bringing version to cookiecutter standards and changing how xonsh is initialized in init --- src/regolith/__init__.py | 28 +++++++++++++++-------- src/regolith/version.py | 49 ++-------------------------------------- 2 files changed, 21 insertions(+), 56 deletions(-) diff --git a/src/regolith/__init__.py b/src/regolith/__init__.py index 0d5143d00..9c855482f 100644 --- a/src/regolith/__init__.py +++ b/src/regolith/__init__.py @@ -1,12 +1,22 @@ -# stup import hooks -import xonsh.imphooks -from xonsh.built_ins import XSH -from xonsh.execer import Execer +# import xonsh.imphooks +# from xonsh.built_ins import XSH +# from xonsh.execer import Execer -XSH.load(execer=Execer()) -execer = XSH.execer -xonsh.imphooks.install_import_hooks(execer=execer) +from xonsh.main import setup -__version__ = "0.8.2" +from regolith.version import __version__ -del xonsh +"""A Research group database management system""" + +# Silence the pyflakes syntax checker +assert __version__ or True + +setup() +del setup + +# Initialize the Xonsh environment +# # execer = Execer(config=None) +# # XSH.load(execer=execer) +# # xonsh.imphooks.install_import_hooks(execer=execer) +# +# del xonsh diff --git a/src/regolith/version.py b/src/regolith/version.py index a7fbc220f..cebe0c8fa 100644 --- a/src/regolith/version.py +++ b/src/regolith/version.py @@ -3,7 +3,7 @@ # # regolith by DANSE Diffraction group # Simon J. L. Billinge -# (c) 2011 The Trustees of Columbia University +# (c) 2011-2024 The Trustees of Columbia University # in the City of New York. All rights reserved. # # File coded by: Pavol Juhas @@ -14,57 +14,12 @@ ############################################################################## """ -Definition of __version__, __date__, __timestamp__, __git_commit__. - -Notes ------ -Variable `__gitsha__` is deprecated as of version 3.0. -Use `__git_commit__` instead. +Definition of __version__ """ -# __all__ = ["__date__", "__git_commit__", "__timestamp__", "__version__"] - -# import os.path - # obtain version information from importlib.metadata import version -# from importlib.resources import as_file, files -# -# # obtain version information from the version.cfg file -# cp = dict(version="", date="", commit="", timestamp="0") -# if __package__ is not None: -# ref = files(__package__) / "version.cfg" -# with as_file(ref) as fcfg: -# if not os.path.isfile(fcfg): # pragma: no cover -# from warnings import warn -# -# warn("Package metadata not found.") -# fcfg = os.devnull -# with open(fcfg) as fp: -# kwords = [ -# [w.strip() for w in line.split(" = ", 1)] for line in fp if line[:1].isalpha() and " = " in line -# ] -# assert all(w[0] in cp for w in kwords), "received unrecognized keyword" -# cp.update(kwords) -# del kwords -# -# __version__ = cp["version"] -# __date__ = cp["date"] -# __git_commit__ = cp["commit"] -# __timestamp__ = int(cp["timestamp"]) - -# TODO remove deprecated __gitsha__ in version 3.1. -# __gitsha__ = __git_commit__ -# -# del cp - -# from cookiecutter in case we want to migrate later: -# -# # We do not use the other three variables, but can be added back if needed. -# # __all__ = ["__date__", "__git_commit__", "__timestamp__", "__version__"] - - __version__ = version("regolith") # End of file