コード例 #1
0
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"
コード例 #2
0
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'
コード例 #3
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')
コード例 #4
0
# 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
コード例 #5
0
ファイル: conf.py プロジェクト: sdss/lvmieb
# 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"
コード例 #6
0
ファイル: __init__.py プロジェクト: sdss/clu
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)
コード例 #7
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 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')
コード例 #8
0
ファイル: conf.py プロジェクト: sdss/catalogdb
#
# 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')
コード例 #9
0
ファイル: conf.py プロジェクト: sdss/valis
#
# 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
コード例 #10
0
ファイル: conf.py プロジェクト: sdss/python_template
# 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
コード例 #11
0
# 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
コード例 #12
0
ファイル: __init__.py プロジェクト: karenlmasters/marvin
# 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.
コード例 #13
0
#
# 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')
コード例 #14
0
# 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 *
コード例 #15
0
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
コード例 #16
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 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')
コード例 #17
0
ファイル: __init__.py プロジェクト: sdss/basecam
# 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 *
コード例 #18
0
ファイル: conf.py プロジェクト: sdss/mugatu
#
# 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')
コード例 #19
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 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
コード例 #20
0
ファイル: conf.py プロジェクト: sdss/sdss_brain
#
# 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')
コード例 #21
0
ファイル: conf.py プロジェクト: sdss/platescheduler
#
# 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')
コード例 #22
0
# 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"
コード例 #23
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
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

コード例 #24
0
ファイル: __init__.py プロジェクト: sdss/valis
# 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)
コード例 #25
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 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')
コード例 #26
0
# 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',
コード例 #27
0
ファイル: __init__.py プロジェクト: sdss/target_selection
# 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