-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
152 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,5 @@ code/Templates/Builder/MyModel.h | |
code/Templates/Builder/MyModel.cpp | ||
ms.out | ||
dnest4.lib | ||
build | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include LICENSE *.rst python/*.rst *.toml | ||
|
||
include code/*.cpp | ||
include code/Distributions/*.cpp | ||
include code/RJObject/ConditionalPriors/*.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["setuptools", "wheel", "numpy", "cython"] | ||
build-backend = "setuptools.build_meta" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
__version__ = "0.2.3" | ||
__version__ = "0.2.4" | ||
|
||
try: | ||
__DNEST4_SETUP__ | ||
except NameError: | ||
__DNEST4_SETUP__ = False | ||
|
||
if not __DNEST4_SETUP__: | ||
__all__ = ["DNest4Sampler", "postprocess", "analysis", "my_loadtxt, loadtxt_rows"] | ||
__all__ = [ | ||
"DNest4Sampler", | ||
"postprocess", | ||
"analysis", | ||
"my_loadtxt, loadtxt_rows", | ||
] | ||
|
||
from . import analysis | ||
from .sampler import DNest4Sampler | ||
from .deprecated import postprocess, postprocess_abc | ||
from .loading import my_loadtxt, loadtxt_rows | ||
from .utils import rand | ||
from .utils import randn | ||
from .utils import randt2 | ||
from .utils import randh | ||
from .utils import wrap | ||
from .utils import rand, randn, randt2, randh, wrap | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
from setuptools import setup, Extension | ||
|
||
|
||
if __name__ == "__main__": | ||
import sys | ||
|
||
# Publish the library to PyPI. | ||
if "publish" in sys.argv: | ||
os.system("python setup.py sdist upload") | ||
sys.exit() | ||
|
||
if "--without-cext" in sys.argv: | ||
sys.argv.remove("--without-cext") | ||
extensions = [] | ||
|
||
else: | ||
import glob | ||
from itertools import chain | ||
|
||
import numpy | ||
from Cython.Build import cythonize | ||
|
||
# The root of the DNest4 repo. | ||
basedir = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
# Set up the C++-extension. | ||
libraries = [] | ||
if os.name == "posix": | ||
libraries.append("m") | ||
include_dirs = [ | ||
"dnest4", | ||
os.path.join(basedir, "code"), | ||
numpy.get_include(), | ||
] | ||
|
||
src = [ | ||
os.path.join(basedir, "code", fn) | ||
for fn in chain( | ||
glob.glob(os.path.join(basedir, "code", "*.cpp")), | ||
glob.glob( | ||
os.path.join(basedir, "code", "Distributions", "*.cpp") | ||
), | ||
glob.glob( | ||
os.path.join( | ||
basedir, | ||
"code", | ||
"RJObject", | ||
"ConditionalPriors", | ||
"*.cpp", | ||
) | ||
), | ||
) | ||
] | ||
src += [os.path.join(basedir, "python", "dnest4", "_dnest4.pyx")] | ||
|
||
ext = [ | ||
Extension( | ||
"dnest4._dnest4", | ||
sources=src, | ||
language="c++", | ||
libraries=libraries, | ||
include_dirs=include_dirs, | ||
extra_compile_args=[ | ||
"-std=c++11", | ||
"-Wno-unused-function", | ||
"-Wno-uninitialized", | ||
"-DNO_THREADS", | ||
], | ||
extra_link_args=["-std=c++11"], | ||
), | ||
Extension( | ||
"dnest4.utils", | ||
sources=[ | ||
os.path.join(basedir, "python", "dnest4", "utils.pyx") | ||
], | ||
language="c++", | ||
libraries=libraries, | ||
include_dirs=include_dirs, | ||
extra_compile_args=[ | ||
"-std=c++11", | ||
"-Wno-unused-function", | ||
"-Wno-uninitialized", | ||
"-DNO_THREADS", | ||
], | ||
extra_link_args=["-std=c++11"], | ||
), | ||
] | ||
extensions = cythonize(ext) | ||
|
||
# Hackishly inject a constant into builtins to enable importing of the | ||
# package before the library is built. | ||
if sys.version_info[0] < 3: | ||
import __builtin__ as builtins | ||
else: | ||
import builtins | ||
builtins.__DNEST4_SETUP__ = True | ||
sys.path.insert(0, os.path.join(basedir, "python")) | ||
import dnest4 | ||
|
||
setup( | ||
name="dnest4", | ||
version=dnest4.__version__, | ||
author="Daniel Foreman-Mackey", | ||
author_email="foreman.mackey@gmail.com", | ||
url="https://github.com/eggplantbren/DNest4", | ||
license="MIT", | ||
packages=["dnest4"], | ||
package_dir={"": "python"}, | ||
ext_modules=extensions, | ||
description="Diffusive nested sampling in Python", | ||
long_description=open("python/README.rst").read(), | ||
classifiers=[ | ||
# "Development Status :: 5 - Production/Stable", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Science/Research", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python", | ||
], | ||
) |