Skip to content

Commit

Permalink
Switch to setup.cfg (#74)
Browse files Browse the repository at this point in the history
* MAINT: switch to setup.cfg

* Fix cupy numpy switching (#73)

* DEV: improve backend settings

* TEST: make tests run on cupy if available

* TYPO: typo fixes

* MAINT: Some more packaging updates

* DOCS: some docs updates

* MAINT: make subpackages work again
  • Loading branch information
ColmTalbot authored Oct 4, 2023
1 parent 858c68c commit 3db35c5
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 61 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,9 @@ jobs:
conda-channels: anaconda, conda-forge
- name: Install dependencies
run: |
conda install flake8 pytest-cov
conda install --file requirements.txt
conda install pre-commit codespell
conda install jupyter
conda install pip setuptools
conda update nbconvert
conda install --file requirements.txt
conda install --file test_requirements.txt
pre-commit install
- name: Install gwpopulation
run: |
Expand All @@ -57,7 +54,6 @@ jobs:
run: |
pre-commit run --all-files --verbose --show-diff-on-failure
jupyter nbconvert --clear-output --inplace examples/*.ipynb
codespell examples/*.ipynb -L "hist"
git reset --hard
- name: Test with pytest
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ venv/
.idea/
**/.version
**/_version.py
.vscode
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include README.md
include LICENSE.md
include requirements.txt
include pages_requirements.txt
include test_requirements.txt
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ API:
:recursive:

models
backend
conversions
cupy_utils
hyperpe
utils
vt
Expand Down
4 changes: 2 additions & 2 deletions gwpopulation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
from .hyperpe import RateLikelihood

try:
from ._version import version as __version__
from ._version import __version__
except ModuleNotFoundError: # development mode
__version__ = "unknown"

try:
set_backend("cupy")
except ModuleNotFoundError:
except ImportError:
set_backend("numpy")
10 changes: 5 additions & 5 deletions priors/bbh_population.prior
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ alpha_chi_2 = Uniform(minimum=1, maximum=5, name='alpha_2', latex_label='$\\alph
beta_chi_1 = Uniform(minimum=1, maximum=5, name='beta_1', latex_label='$\\beta_1$')
beta_chi_2 = Uniform(minimum=1, maximum=5, name='beta_2', latex_label='$\\beta_2$')
alpha = Uniform(minimum=-4, maximum=12, name='alpha', latex_label='$\\alpha$')
mmin = Uniform(minimum=3, maximum=10, name='mmin', latex_label='$m_{\min}$')
mmax = Uniform(minimum=30, maximum=65, name='mmax', latex_label='$m_{\max}$')
lam = Uniform(minimum=0, maximum=1, name='lam', latex_label='$\lambda$')
mpp = Uniform(minimum=20, maximum=60, name='mpp', latex_label='$\mu_{pp}$')
mmin = Uniform(minimum=3, maximum=10, name='mmin', latex_label='$m_{\\min}$')
mmax = Uniform(minimum=30, maximum=65, name='mmax', latex_label='$m_{\\max}$')
lam = Uniform(minimum=0, maximum=1, name='lam', latex_label='$\\lambda$')
mpp = Uniform(minimum=20, maximum=60, name='mpp', latex_label='$\\mu_{pp}$')
sigpp = Uniform(minimum=5e-1, maximum=1e1, name='sigpp', latex_label='$\\sigma_{pp}$')
beta = Uniform(minimum=-4, maximum=12, name='beta', latex_label='$\\beta$')
delta_m = Uniform(minimum=0, maximum=10, name='delta_m', latex_label='$\delta m$')
delta_m = Uniform(minimum=0, maximum=10, name='delta_m', latex_label='$\\delta m$')
lamb = Uniform(minimum=-5, maximum=10, name="lamb", latex_label="$\\lambda_{z}$")
rate = LogUniform(minimum=1e-1, maximum=1e3, name='rate', latex_label='$R$')
4 changes: 2 additions & 2 deletions priors/mass_rates.prior
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ beta_2 = 1
alpha = Uniform(minimum=-4, maximum=6, name='alpha', latex_label='$\\alpha$')
mmin = Uniform(minimum=2, maximum=10, name='mmin', latex_label='$m_{\\min}$')
mmax = Uniform(minimum=20, maximum=65, name='mmax', latex_label='$m_{\\max}$')
lam = Uniform(minimum=0, maximum=1, name='lam', latex_label='$\lambda$')
mpp = Uniform(minimum=20, maximum=60, name='mpp', latex_label='$\mu_{pp}$')
lam = Uniform(minimum=0, maximum=1, name='lam', latex_label='$\\lambda$')
mpp = Uniform(minimum=20, maximum=60, name='mpp', latex_label='$\\mu_{pp}$')
sigpp = Uniform(minimum=5e-1, maximum=1e1, name='sigpp', latex_label='$\\sigma_{pp}$')
beta = Uniform(minimum=-4, maximum=6, name='beta', latex_label='$\\beta$')
delta_m = Uniform(minimum=0, maximum=10, name='delta_m', latex_label='$\\delta m$')
Expand Down
32 changes: 32 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
[metadata]
name = gwpopulation
description = Unified population inference
url = https://github.com/ColmTalbot/gwpopulation
author = Colm Talbot
author_email = [email protected]
license_file = LICENSE.md
long_description = file: README.md
long_description_content_type = text/markdown
classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
License :: OSI Approved :: MIT License
Operating System :: OS Independent
python_requires = ">=3.8"

[options]
packages = find:
install_requires = file: requirements.txt

[options.extras_require]
cupy = cupy
pages = file: pages_requirements.txt
test = file: test_requirements.txt

[options.packages.find]
exclude =
test
venv
priors

[flake8]
exclude = .git,build,dist,docs,test,*__init__.py
max-line-length = 120
Expand Down
46 changes: 2 additions & 44 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,47 +1,5 @@
#!/usr/bin/env python

import os
from setuptools import setup

from setuptools import find_packages, setup


def get_long_description():
"""Finds the README and reads in the description"""
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "README.md")) as f:
long_description = f.read()
return long_description


# get version info from __init__.py
def readfile(filename):
with open(filename) as fp:
filecontents = fp.read()
return filecontents


long_description = get_long_description()

with open("requirements.txt", "r") as ff:
requirements = ff.readlines()
setup(
name="gwpopulation",
description="Unified population inference",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/ColmTalbot/gwpopulation",
author="Colm Talbot",
author_email="[email protected]",
license="MIT",
packages=find_packages(exclude=["test", "venv", "priors"]),
package_dir={"gwpopulation": "gwpopulation"},
install_requires=requirements,
classifiers=[
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires=">=3.8",
)
setup()
4 changes: 4 additions & 0 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pytest-cov
pre-commit
jupyter
nbconvert

0 comments on commit 3db35c5

Please sign in to comment.