diff --git a/.gitignore b/.gitignore index ce62fc6c..30d2e11f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ build/ dist/ *.egg *.egg-info +xfaster/_version.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..fa55b729 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,22 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "xfaster" +description = "A fast power spectrum and likelihood estimator for CMB datasets" +readme = "README.rst" +requires-python = ">=3.0" +urls = {source = "https://github.com/SPIDERCMB/xfaster"} +license = {file = "LICENSE"} +dynamic = ["version"] +dependencies = ["numpy>1.17.5", "healpy", "camb", "emcee", "h5py"] + +[project.scripts] +xfaster = "xfaster:xfaster_main" + +[tool.setuptools] +packages = ["xfaster"] + +[tool.setuptools_scm] +write_to = "xfaster/_version.py" diff --git a/setup.py b/setup.py deleted file mode 100644 index bcafcb79..00000000 --- a/setup.py +++ /dev/null @@ -1,37 +0,0 @@ -import os - -from setuptools import setup - - -def read(rel_path): - # type: (str) -> str - here = os.path.abspath(os.path.dirname(__file__)) - # intentionally *not* adding an encoding option to open, See: - # https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690 - with open(os.path.join(here, rel_path)) as fp: - return fp.read() - - -def get_version(rel_path): - # type: (str) -> str - for line in read(rel_path).splitlines(): - if line.startswith("__version__"): - # __version__ = "0.9" - delim = '"' if '"' in line else "'" - return line.split(delim)[1] - raise RuntimeError("Unable to find version string.") - - -setup( - name="xfaster", - version=get_version("xfaster/__init__.py"), - description="A fast power spectrum and likelihood estimator for CMB datasets", - long_description=read("README.rst"), - license="MIT", - url="https://github.com/SPIDERCMB/xfaster", - packages=["xfaster"], - package_dir={"xfaster": "xfaster"}, - entry_points={"console_scripts": ["xfaster=xfaster:xfaster_main"]}, - install_requires=["numpy>1.17.5", "healpy", "camb", "emcee", "h5py"], - python_requires=">=3.0", -) diff --git a/xfaster/__init__.py b/xfaster/__init__.py index 0ac7e792..5feec9a5 100644 --- a/xfaster/__init__.py +++ b/xfaster/__init__.py @@ -4,4 +4,4 @@ from .parse_tools import load_and_parse, save from .spec_tools import get_camb_cl -__version__ = "1.2.0" +from ._version import __version__