diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ed01de276fb230bbe0d8872b4d2cda8390cd7791..fcf6f666364213ea9f3874a05342e185f9fa700c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,7 +27,7 @@ gwinc/base: cat <<EOF > Dockerfile FROM igwn/base:buster RUN apt-get update -qq - RUN apt-get -y install --no-install-recommends git python3-gitlab python3 python3-yaml python3-scipy python3-matplotlib python3-lalsimulation python3-pypdf2 python3-h5py + RUN apt-get -y install --no-install-recommends git python3 python3-gitlab python3-setuptools-scm python3-yaml python3-scipy python3-matplotlib python3-lalsimulation python3-pypdf2 python3-h5py RUN git clone https://gitlab-ci-token:ci_token@git.ligo.org/gwinc/inspiral_range.git EOF - docker build -t $IMAGE_TAG . diff --git a/MANIFEST.in b/MANIFEST.in index f6608408100b7d077f0576b8869e3970d34f3079..5606b95c027a35d55321dc39d367eccb0d073c9b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,7 +1,4 @@ -include CONTRIBUTIONS.md -include setup.cfg -include tox.ini - -recursive-include gwinc *.yaml -recursive-include matlab *.m -recursive-include docs * +exclude IFO.md +global-exclude *.git* +prune docs +prune matlab diff --git a/gwinc/__init__.py b/gwinc/__init__.py index d3baf384962c0657fdd561ff0266330195433341..94afbf7663df3ee0009c352175b723e0a7a457c3 100644 --- a/gwinc/__init__.py +++ b/gwinc/__init__.py @@ -5,6 +5,11 @@ import logging import importlib import numpy as np +try: + from ._version import __version__ +except ModuleNotFoundError: + import setuptools_scm + __version__ = setuptools_scm.get_version() from .ifo import IFOS from .struct import Struct from .plot import plot_budget diff --git a/gwinc/__main__.py b/gwinc/__main__.py index 9f3d071b49d56708fb5f5a3a12b8dd930df5048d..51cc0b7f235e311de649afda88a11198c7e7326f 100644 --- a/gwinc/__main__.py +++ b/gwinc/__main__.py @@ -5,6 +5,7 @@ import logging import argparse from . import ( + __version__, IFOS, DEFAULT_FREQ, freq_from_spec, @@ -66,6 +67,8 @@ parser = argparse.ArgumentParser( prog='gwinc', description=description, formatter_class=argparse.RawDescriptionHelpFormatter) +parser.add_argument( + '--version', '-v', action='version', version=__version__) parser.add_argument( '--freq', '-f', metavar='FLO:[NPOINTS:]FHI', help="logarithmic frequency array specification in Hz [{}]".format(DEFAULT_FREQ)) diff --git a/setup.cfg b/setup.cfg index f575ad345646ced79e7558cde67308de6e282b63..0fa7a2e20287fbbb02ede4387a60506c01434321 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,13 +1,65 @@ -[bdist_wheel] -# This flag says that the code is written to work on both Python 2 and Python -# 3. If at all possible, it is good practice to do this. If you cannot, you -# will need to generate wheels for each Python version that you support. -universal=1 - [aliases] test=pytest +# [bdist_wheel] +# universal=1 + +[flake8] +exclude = + gwinc/_version.py + versioneer.py +ignore = D100,D102,D104,D107,D205,D400 + +[coverage:run] +source = gwinc +omit = + gwinc/_version.py + gwinc/test/* + [metadata] -description-file = README.rst +name = gwinc +license = UNLICENSE +license_file = LICENSE +author = LIGO Scientific Collaboration +author_email = jameson.rollins@ligo.org +description = Gravitation Wave Interferometer Noise Calculator +long_description = file:README.md +long_description_content_type = text/markdown +url = https://git.ligo.org/gwinc/pygwinc +classifiers = + Development Status :: 4 - Beta + Environment :: Console + License :: OSI Approved :: The Unlicense (Unlicense) + Topic :: Scientific/Engineering + Topic :: Scientific/Engineering :: Astronomy + Topic :: Scientific/Engineering :: Physics + Intended Audience :: Science/Research + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 +project_urls = + Bug Tracker = https://git.ligo.org/gwinc/pygwinc/issues + Source Code = https://git.ligo.org/gwinc/pygwinc +[options] +packages = find: +python_requires = >=3.6 +install_requires = + h5py + ipython + matplotlib + numpy + pyyaml + scipy +tests_require = + PyPDF2 +[versioneer] +VCS = git +versionfile_build = gwinc/_version.py +versionfile_source = gwinc/_version.py +tag_prefix = v +parentdir_prefix = gwinc- diff --git a/setup.py b/setup.py old mode 100755 new mode 100644 index baf74befe9f867658ecfce10d2cb6ed00fab9ba6..16eeb63b7ec91a947dfd8b23e0a70558bf4f3f72 --- a/setup.py +++ b/setup.py @@ -1,56 +1,23 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -from setuptools import find_packages, setup +# import sys +# import versioneer +from setuptools import setup -version = '0.1' +# if {'build_sphinx'}.intersection(sys.argv): +# setup_requires.append('sphinx') +# if {'pytest', 'test', 'ptr'}.intersection(sys.argv): +# setup_requires.append('pytest-runner') -setup_args = dict( - name = 'pygwinc', - version = version, - url = 'https://git.ligo.org/gwinc/pygwinc', - author = 'LIGO Laboratory', - author_email = 'jrollins@ligo.caltech.edu ', - description = "Gravitation Wave Interferometer Noise Calculator", - license = 'Copyright 2018 LIGO Laboratory', - keywords = 'Noise, LIGO, Gravitational Wave,', - classifiers = [ - 'Topic :: Scientific/Engineering', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', +setup( + setup_requires=[ + 'setuptools >= 30.3.0', + 'setuptools_scm', ], - - install_requires = [ - 'h5py', - 'ipython', - 'matplotlib', - 'numpy', - 'PyPDF2', - 'pyyaml', - 'scipy', - ], - - packages = find_packages( - exclude = ['docs',], - ), - - entry_points={ - 'console_scripts': [ - 'gwinc = gwinc.__main__:main', - ], - }, - - include_package_data = True, - zip_safe = False, + use_scm_version={ + 'write_to': 'gwinc/_version.py', + 'write_to_template': '__version__ = "{version}"', + } + # version=versioneer.get_version(), + # cmdclass=versioneer.get_cmdclass(), ) - -if __name__ == "__main__": - setup(**setup_args) diff --git a/tox.ini b/tox.ini index c4a19f31209c5caf64596bdff65b37ba37858d06..ac63477b6f5936f8a97fff987e1d0021293774e4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,16 +1,14 @@ -# content of: tox.ini , put in same dir as setup.py [tox] envlist = - py27 - py34 - py35 py36 py37 + py38 [testenv] setenv = PYTHONPATH = '' -deps = +deps = + h5py pytest pytest-xdist pytest-benchmark @@ -20,5 +18,3 @@ deps = scipy commands=python -m gwinc.test pip_pre=True - -