Skip to content

Commit

Permalink
bringing version to cookiecutter standards and changing how xonsh is …
Browse files Browse the repository at this point in the history
…initialized in init
  • Loading branch information
sbillinge committed Jul 27, 2024
1 parent 133666e commit 7121a95
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 56 deletions.
28 changes: 19 additions & 9 deletions src/regolith/__init__.py
Original file line number Diff line number Diff line change
@@ -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
49 changes: 2 additions & 47 deletions src/regolith/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 7121a95

Please sign in to comment.