Skip to content

Commit

Permalink
Updated setup.py and moved all options and metadata to setup.cfg (#324)
Browse files Browse the repository at this point in the history
* Updated setup.py and moved all options and metadata to setup.cfg.
* Updating alpha version to match PEP 440.
* Updated version test.
* Add some missing entries to setup.cfg

---------

Co-authored-by: Marc Paterno <paterno@fnal.gov>
  • Loading branch information
vitenti and marcpaterno authored Oct 16, 2023
1 parent e02bba2 commit 7617cea
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion firecrown/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@

FIRECROWN_MAJOR = 1
FIRECROWN_MINOR = 6
FIRECROWN_PATCH = "alpha"
FIRECROWN_PATCH = "0a0"
__version__ = f"{FIRECROWN_MAJOR}.{FIRECROWN_MINOR}.{FIRECROWN_PATCH}"
34 changes: 34 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
[metadata]
name = firecrown
version = attr: firecrown.version.__version__
author = DESCs Firecrown Developers
description = DESC Cosmology Likelihood Framework
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/LSSTDESC/firecrown
license_files = LICENSE

[options]
include_package_data = True
packages = find:
python_requires = >=3.9
install_requires =
astropy
cosmosis
cobaya
fitsio
numpy
scipy
numcosmo_py
pandas
pyccl
sacc
yaml

[options.packages.find]
exclude =
examples*
tests*
tutorial*
docs*

[flake8]
max_line_length=88
per-file-ignores =
Expand Down
44 changes: 5 additions & 39 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,7 @@
import os
from setuptools import setup, find_packages
from typing import Optional
"""Setup script for firecrown.
"""

from setuptools import setup

def _munge_req(r):
for sym in ["~", "=", "<", ">", ",", "!", "!"]:
r = r.split(sym)[0]
return r


__version__: Optional[str] = None
pth = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "firecrown", "version.py"
)
with open(pth, "r") as fp:
exec(fp.read())

pth = os.path.join(os.path.dirname(os.path.realpath(__file__)), "environment.yml")
rqs = []
with open(pth, "r") as fp:
start = False
for line in fp.readlines():
if line.strip() == "dependencies:":
start = False
if start:
if "- pip:" in line.strip():
continue
r = line.strip()[3:].strip()
rqs.append(_munge_req(r))

setup(
name="firecrown",
version=__version__,
description="DESC Cosmology Likelihood Framework",
author="DESC Team",
packages=find_packages(),
include_package_data=True,
scripts=[],
install_requires=rqs,
)
if __name__ == "__main__":
setup()
2 changes: 1 addition & 1 deletion tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@


def test_version():
assert firecrown.__version__ == "1.6.alpha"
assert firecrown.__version__ == "1.6.0a0"

0 comments on commit 7617cea

Please sign in to comment.