def test_get_package_version_path(tmp_path): package_path = tmp_path / "src" / "package" package_path.mkdir(parents=True) init_path = package_path / "__init__.py" assert get_package_version(path=init_path) is None setup_cfg = tmp_path / "setup.cfg" setup_cfg.touch() assert get_package_version(path=init_path) is None setup_cfg.write_text(""" [metadata] name = test-package version = 0.4.6-alpha.0 """) assert get_package_version(path=init_path) == "0.4.6-alpha.0" assert get_package_version(path=init_path, pep_440=True) == "0.4.6a0" pyproject = tmp_path / "pyproject.toml" pyproject.write_text(""" [tool.poetry] name = "sdsstools" version = "0.2.2" """) assert get_package_version(path=init_path) == "0.2.2"
def get_version(NAME): try: return pkg_resources.get_distribution(NAME).version except pkg_resources.DistributionNotFound: try: from sdsstools import get_package_version return get_package_version(__file__, NAME) or '0.0.0' except (ImportError, ModuleNotFoundError): return '0.0.0'
# # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os from pkg_resources import parse_version try: from apogee_drp import __version__ except ModuleNotFoundError: from sdsstools import get_package_version __version__ = get_package_version(__file__, 'sdss_apogee_drp') or 'dev' # Are we building in RTD? on_rtd = os.environ.get('READTHEDOCS') == 'True' # Sphinx template selected in cookiecutter and whether to use releases sphinx_template = 'sphinx-bootstrap' use_releases = 'yes' if sphinx_template == 'sphinx-bootstrap': import sphinx_bootstrap_theme # Importing matplotlib here with agg to prevent tkinter error in readthedocs # import matplotlib # matplotlib.use('agg')
# encoding: utf-8 import warnings from sdsstools import get_config, get_logger, get_package_version warnings.filterwarnings( 'ignore', '.*Skipped unsupported reflection of expression-based index .*q3c.*') NAME = 'sdssdb' __version__ = get_package_version(path='./', package_name=NAME) log = get_logger(NAME) # This looks for user configuration in the usual places (including # ~/.config/sdss/sdssdb.yml and ~/.sdssdb/sdssdb.yml). config = get_config(NAME) from .connection import PeeweeDatabaseConnection # noqa from .connection import SQLADatabaseConnection # noqa
# If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # import os #import sys # sys.path.insert(0, os.path.abspath('.')) from pkg_resources import parse_version try: from lvmieb import __version__ except ModuleNotFoundError: from sdsstools import get_package_version __version__ = get_package_version(__file__, "lvmieb") or "dev" # -- Project information ----------------------------------------------------- project = 'lvmieb' copyright = '{0}, {1}'.format('2021', 'SDSS LVMI softwareteam in Kyung Hee university') author = 'Changgon Kim, Mingyeong Yang, Taeeun Kim' # The full version, including alpha/beta/rc tags version = parse_version(__version__).base_version release = __version__ # Are we building in RTD? on_rtd = os.environ.get("READTHEDOCS") == "True"
from sdsstools import get_package_version from .actor import * from .base import * from .client import * from .command import * from .device import * from .exceptions import * from .legacy import LegacyActor from .parsers import * from .tools import ( REPLY, ActorHandler, CommandStatus, as_complete_failer, escape, format_value, ) # Add REPLY level to logging logging.addLevelName(REPLY, "REPLY") logging.Logger.REPLY = lambda self, message, *args, **kws: self._log( # type: ignore REPLY, message, *args, **kws ) NAME = "sdss-clu" __version__ = get_package_version(__file__, "sdss-clu", pep_440=True)
# # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os from pkg_resources import parse_version try: from chernosim import __version__ except ModuleNotFoundError: from sdsstools import get_package_version __version__ = get_package_version(__file__, 'sdss-chernosim') or 'dev' # Are we building in RTD? on_rtd = os.environ.get('READTHEDOCS') == 'True' # Sphinx template selected in cookiecutter and whether to use releases sphinx_template = 'alabaster' use_releases = 'yes' if sphinx_template == 'sphinx-bootstrap': import sphinx_bootstrap_theme # Importing matplotlib here with agg to prevent tkinter error in readthedocs # import matplotlib # matplotlib.use('agg')
# # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os from pkg_resources import parse_version try: from catalogdb import __version__ except ModuleNotFoundError: from sdsstools import get_package_version __version__ = get_package_version(__file__, 'sdss-catalogdb') or 'dev' # Are we building in RTD? on_rtd = os.environ.get('READTHEDOCS') == 'True' # Sphinx template selected in cookiecutter and whether to use releases sphinx_template = 'alabaster' use_releases = 'yes' if sphinx_template == 'sphinx-bootstrap': import sphinx_bootstrap_theme # Importing matplotlib here with agg to prevent tkinter error in readthedocs # import matplotlib # matplotlib.use('agg')
# # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os from pkg_resources import parse_version try: from valis import __version__ except ModuleNotFoundError: from sdsstools import get_package_version __version__ = get_package_version(__file__, 'sdss-valis') or 'dev' # Are we building in RTD? on_rtd = os.environ.get('READTHEDOCS') == 'True' # Sphinx template selected in cookiecutter and whether to use releases sphinx_template = 'alabaster' use_releases = 'yes' if sphinx_template == 'sphinx-bootstrap': import sphinx_bootstrap_theme # Importing matplotlib here with agg to prevent tkinter error in readthedocs # import matplotlib
# autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. # type: ignore import os from pkg_resources import parse_version try: from {{cookiecutter.package_name}} import __version__ except ModuleNotFoundError: from sdsstools import get_package_version __version__ = get_package_version(__file__, '{{cookiecutter.pip_name}}') or 'dev' # Are we building in RTD? on_rtd = os.environ.get('READTHEDOCS') == 'True' # Sphinx template selected in cookiecutter and whether to use releases sphinx_template = '{{cookiecutter.sphinx_template}}' use_releases = '{{cookiecutter.use_releases}}' if sphinx_template == 'sphinx-bootstrap': import sphinx_bootstrap_theme # Importing matplotlib here with agg to prevent tkinter error in readthedocs # import matplotlib
# encoding: utf-8 # isort:skip import os from sdsstools import get_config, get_package_version NAME = "sdss-flicamera" __version__ = get_package_version(__file__, "sdss-flicamera") or "dev" config = get_config( "flicamera", config_file=os.path.join(os.path.dirname(__file__), "etc/flicamera.yaml"), ) OBSERVATORY = os.environ.get("OBSERVATORY", "UNKNOWN") from .camera import * from .lib import LibFLI
# isort:skip_file import os import re import warnings import contextlib import six from collections import OrderedDict from astropy.wcs import FITSFixedWarning from sdsstools import get_config, get_logger, get_package_version NAME = 'marvin' # Set the Marvin version __version__ = get_package_version(path=__file__, package_name='sdss-marvin') # Does this so that the implicit module definitions in extern can happen. # time - 483 ms from marvin.core.exceptions import MarvinUserWarning, MarvinError from brain.utils.general.general import getDbMachine from brain import bconfig from brain.core.core import URLMapDict from brain.core.exceptions import BrainError # Loads config curdir = os.path.dirname(os.path.abspath(__file__)) cfg_params = get_config(NAME, config_file=os.path.join(curdir, 'data/marvin.yml')) # Defines log dir.
# # All configuration values have a default; values that are commented out # serve to show the default. # type: ignore import os from pkg_resources import parse_version try: from archon import __version__ except ModuleNotFoundError: from sdsstools import get_package_version __version__ = get_package_version(__file__, "sdss-archon") or "dev" # Are we building in RTD? on_rtd = os.environ.get("READTHEDOCS") == "True" # Sphinx template selected in cookiecutter and whether to use releases sphinx_template = "alabaster" use_releases = "yes" if sphinx_template == "sphinx-bootstrap": import sphinx_bootstrap_theme # Importing matplotlib here with agg to prevent tkinter error in readthedocs # import matplotlib # matplotlib.use('agg')
# encoding: utf-8 from sdsstools import get_logger, get_package_version NAME = 'sdss-flicamera' __version__ = get_package_version(__file__, 'sdss-flicamera') or 'dev' # Get a logger, mostly for warning formatting. log = get_logger(NAME) from .camera import *
def test_get_package_version_name(): assert get_package_version(package_name="pip") is not None assert get_package_version(package_name="non-existing-package") is None
# # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os from pkg_resources import parse_version try: from npsactor import __version__ except ModuleNotFoundError: from sdsstools import get_package_version __version__ = get_package_version(__file__, 'sdss-npsactor') or 'dev' # Are we building in RTD? on_rtd = os.environ.get('READTHEDOCS') == 'True' # Sphinx template selected in cookiecutter and whether to use releases sphinx_template = 'sphinx-bootstrap' use_releases = 'no' if sphinx_template == 'sphinx-bootstrap': import sphinx_bootstrap_theme # Importing matplotlib here with agg to prevent tkinter error in readthedocs # import matplotlib # matplotlib.use('agg')
# encoding: utf-8 # flake8: noqa from sdsstools import get_package_version NAME = "sdss-basecam" __version__ = get_package_version(__file__, "sdss-basecam") or "dev" from .camera import * from .events import * from .exceptions import * from .exposure import * from .notifier import *
# # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os from pkg_resources import parse_version try: from mugatu import __version__ except ModuleNotFoundError: from sdsstools import get_package_version __version__ = get_package_version(__file__, 'sdss-mugatu') or 'dev' # Are we building in RTD? on_rtd = os.environ.get('READTHEDOCS') == 'True' # Sphinx template selected in cookiecutter and whether to use releases sphinx_template = 'sphinx_rtd_theme' use_releases = 'no' if sphinx_template == 'sphinx-bootstrap': import sphinx_bootstrap_theme # Importing matplotlib here with agg to prevent tkinter error in readthedocs # import matplotlib # matplotlib.use('agg')
# # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os from pkg_resources import parse_version try: from kronos import __version__ except ModuleNotFoundError: from sdsstools import get_package_version __version__ = get_package_version(__file__, 'sdss-kronos') or 'dev' # Are we building in RTD? on_rtd = os.environ.get('READTHEDOCS') == 'True' # Sphinx template selected in cookiecutter and whether to use releases sphinx_template = 'sphinx-bootstrap' use_releases = 'no' if sphinx_template == 'sphinx-bootstrap': import sphinx_bootstrap_theme # Importing matplotlib here with agg to prevent tkinter error in readthedocs # import matplotlib
# # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os from pkg_resources import parse_version try: from sdss_brain import __version__ except ModuleNotFoundError: from sdsstools import get_package_version __version__ = get_package_version(__file__, 'sdss-brain') or 'dev' # Are we building in RTD? on_rtd = os.environ.get('READTHEDOCS') == 'True' # Sphinx template selected in cookiecutter and whether to use releases sphinx_template = 'sphinx-bootstrap' use_releases = 'yes' if sphinx_template == 'sphinx-bootstrap': import sphinx_bootstrap_theme # Importing matplotlib here with agg to prevent tkinter error in readthedocs # import matplotlib # matplotlib.use('agg')
# # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os from pkg_resources import parse_version try: from platescheduler import __version__ except ModuleNotFoundError: from sdsstools import get_package_version __version__ = get_package_version(__file__, 'sdss-platescheduler') or 'dev' # Are we building in RTD? on_rtd = os.environ.get('READTHEDOCS') == 'True' # Sphinx template selected in cookiecutter and whether to use releases sphinx_template = 'sphinx-bootstrap' use_releases = 'no' if sphinx_template == 'sphinx-bootstrap': import sphinx_bootstrap_theme # Importing matplotlib here with agg to prevent tkinter error in readthedocs # import matplotlib # matplotlib.use('agg')
# documentation root, use os.path.abspath to make it absolute, like shown here. # import os import sys #sys.path.append('/home/khu/changgon/workspace/scpactor/scpactor/python/scpactor') #sys.path.insert(0, os.path.abspath('..')) from pkg_resources import parse_version try: from scpactor import __version__ except ModuleNotFoundError: from sdsstools import get_package_version __version__ = get_package_version(__file__, "scpactor") or "dev" # -- Project information ----------------------------------------------------- project = "scpactor" copyright = "{0}, {1}".format( "2021", "SDSS LVMI softwareteam in Kyung Hee university") author = "Changgon Kim, Mingyeong Yang, Taeeun Kim" # The full version, including alpha/beta/rc tags version = parse_version(__version__).base_version realese = __version__ # Are we building in RTD? on_rtd = os.environ.get("READTHEDOCS") == "True"
# # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os import sys from pkg_resources import parse_version try: from cthreepo import __version__ except ModuleNotFoundError: from sdsstools import get_package_version __version__ = get_package_version(__file__, 'sdss-cthreepo') or 'dev' # adding a path custom documentation extension sys.path.insert(0, os.path.abspath('../../python/cthreepo/datamodel/')) # Are we building in RTD? on_rtd = os.environ.get('READTHEDOCS') == 'True' # Sphinx template selected in cookiecutter and whether to use releases sphinx_template = 'alabaster' use_releases = 'yes' if sphinx_template == 'sphinx-bootstrap': import sphinx_bootstrap_theme
# encoding: utf-8 from sdsstools import get_config, get_logger, get_package_version # pip package name NAME = 'sdss-valis' # Loads config. config name is the package name. config = get_config('valis') # Inits the logging system as NAME. Only shell logging, and exception and warning catching. # File logging can be started by calling log.start_file_logger(path). Filename can be different # than NAME. log = get_logger(NAME) # package name should be pip package name __version__ = get_package_version(path=__file__, package_name=NAME)
# # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os from pkg_resources import parse_version try: from fibermeas import __version__ except ModuleNotFoundError: from sdsstools import get_package_version __version__ = get_package_version(__file__, 'sdss-fibermeas') or 'dev' # Are we building in RTD? on_rtd = os.environ.get('READTHEDOCS') == 'True' # Sphinx template selected in cookiecutter and whether to use releases sphinx_template = 'alabaster' use_releases = 'no' if sphinx_template == 'sphinx-bootstrap': import sphinx_bootstrap_theme # Importing matplotlib here with agg to prevent tkinter error in readthedocs # import matplotlib # matplotlib.use('agg')
# All configuration values have a default; values that are commented out # serve to show the default. import sphinx_bootstrap_theme # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. from pkg_resources import parse_version try: from tree import __version__ except ModuleNotFoundError: from sdsstools import get_package_version __version__ = get_package_version(__file__, 'sdss-tree') or 'dev' # add a local path to the Sphinx search path # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. # # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'sphinx.ext.autosummary', 'sphinx.ext.todo', 'sphinx.ext.viewcode', 'sphinx.ext.mathjax',
# encoding: utf-8 import os import enlighten from sdsstools import get_config, get_logger, get_package_version NAME = 'sdss-target-selection' config = get_config( 'target_selection', os.path.join(os.path.dirname(__file__), 'config/target_selection.yml')) log = get_logger(NAME) __version__ = get_package_version(path=__file__, package_name=NAME, pep_440=True) manager = enlighten.get_manager() from .xmatch import XMatchPlanner, XMatchModel # isort:skip