diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e7f8405..7a4a34e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -2,8 +2,6 @@ name: tests on: push: - branches: - - master pull_request: null jobs: @@ -18,27 +16,20 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: conda-incubator/setup-miniconda@v2 + - name: Set up Python ${{ matrix.pyver }} + uses: actions/setup-python@v4 with: python-version: ${{ matrix.pyver }} - channels: conda-forge - channel-priority: strict - show-channel-urls: true - - name: configure conda and install code - shell: bash -l {0} - run: | - conda config --set always_yes yes - conda install -q flake8 pytest scipy - - pip install --no-deps -e . + - name: Install code + run: pip install -e . - name: lint - shell: bash -l {0} run: | + pip install flake8 flake8 esutil - name: test - shell: bash -l {0} run: | + pip install pytest pytest -vv esutil diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..a497ed1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[build-system] +requires = ["setuptools","wheel","numpy"] \ No newline at end of file diff --git a/setup.py b/setup.py index 95b7fa4..92da5ce 100644 --- a/setup.py +++ b/setup.py @@ -6,26 +6,16 @@ import tempfile import subprocess import shutil +import numpy from setuptools import setup, Extension from setuptools.command.build_ext import build_ext -# can we build recfile? +# To build recfile packages = ["esutil"] ext_modules = [] -try: - import numpy - - include_dirs = [numpy.get_include()] - include_dirs += ["esutil/include"] - have_numpy = True -except ImportError: - have_numpy = False - ext_modules = [] - include_dirs = [] - - stdout.write("Numpy not found: Not building C extensions\n") - time.sleep(5) +include_dirs = [numpy.get_include()] +include_dirs += ["esutil/include"] extra_compile_args = [] extra_link_args = [] @@ -172,88 +162,87 @@ def build_extensions(self): # Make the extensions to be built # -if have_numpy: - # recfile - include_dirs += ["esutil/recfile"] - recfile_sources = [ - "esutil/recfile/records.cpp", - "esutil/recfile/records_wrap.cpp", - ] - recfile_module = Extension( - "esutil.recfile._records", - extra_compile_args=extra_compile_args, - extra_link_args=extra_link_args, - sources=recfile_sources, - include_dirs=include_dirs, - ) - ext_modules.append(recfile_module) - packages.append("esutil.recfile") - - # cosmology package - cosmo_sources = glob("esutil/cosmology/*.c") - cosmo_module = Extension( - "esutil.cosmology._cosmolib", - extra_compile_args=extra_compile_args, - extra_link_args=extra_link_args, - sources=cosmo_sources, - include_dirs=include_dirs, - ) - ext_modules.append(cosmo_module) - packages.append("esutil.cosmology") - - # HTM - include_dirs += ["esutil/htm", "esutil/htm/htm_src"] - htm_sources = glob("esutil/htm/htm_src/*.cpp") - htm_sources += ["esutil/htm/htmc.cc", "esutil/htm/htmc_wrap.cc"] - htm_module = Extension( - "esutil.htm._htmc", - extra_compile_args=extra_compile_args, - extra_link_args=extra_link_args, - sources=htm_sources, - include_dirs=include_dirs, - ) - - ext_modules.append(htm_module) - packages.append("esutil.htm") - - # stat package - # include_dirs += ['esutil/stat'] - # chist_sources = ['chist.cc','chist_wrap.cc'] - # chist_sources = ['esutil/stat/'+s for s in chist_sources] - chist_sources = ["esutil/stat/chist_pywrap.c"] - chist_module = Extension( - "esutil.stat._chist", - extra_compile_args=extra_compile_args, - extra_link_args=extra_link_args, - sources=chist_sources, - include_dirs=include_dirs, - ) - ext_modules.append(chist_module) - stat_util_sources = ["_stat_util.c"] - stat_util_sources = ["esutil/stat/" + s for s in stat_util_sources] - stat_util_module = Extension( - "esutil.stat._stat_util", - extra_compile_args=extra_compile_args, - extra_link_args=extra_link_args, - sources=stat_util_sources, - include_dirs=include_dirs, - ) - ext_modules.append(stat_util_module) - packages.append("esutil.stat") - - # integrate package - - # cgauleg_sources = glob('esutil/integrate/*.cc') - cgauleg_sources = glob("esutil/integrate/cgauleg_pywrap.c") - cgauleg_module = Extension( - "esutil.integrate._cgauleg", - extra_compile_args=extra_compile_args, - extra_link_args=extra_link_args, - sources=cgauleg_sources, - include_dirs=include_dirs, - ) - ext_modules.append(cgauleg_module) - packages.append("esutil.integrate") +# recfile +include_dirs += ["esutil/recfile"] +recfile_sources = [ + "esutil/recfile/records.cpp", + "esutil/recfile/records_wrap.cpp", +] +recfile_module = Extension( + "esutil.recfile._records", + extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, + sources=recfile_sources, + include_dirs=include_dirs, +) +ext_modules.append(recfile_module) +packages.append("esutil.recfile") + +# cosmology package +cosmo_sources = glob("esutil/cosmology/*.c") +cosmo_module = Extension( + "esutil.cosmology._cosmolib", + extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, + sources=cosmo_sources, + include_dirs=include_dirs, +) +ext_modules.append(cosmo_module) +packages.append("esutil.cosmology") + +# HTM +include_dirs += ["esutil/htm", "esutil/htm/htm_src"] +htm_sources = glob("esutil/htm/htm_src/*.cpp") +htm_sources += ["esutil/htm/htmc.cc", "esutil/htm/htmc_wrap.cc"] +htm_module = Extension( + "esutil.htm._htmc", + extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, + sources=htm_sources, + include_dirs=include_dirs, +) + +ext_modules.append(htm_module) +packages.append("esutil.htm") + +# stat package +# include_dirs += ['esutil/stat'] +# chist_sources = ['chist.cc','chist_wrap.cc'] +# chist_sources = ['esutil/stat/'+s for s in chist_sources] +chist_sources = ["esutil/stat/chist_pywrap.c"] +chist_module = Extension( + "esutil.stat._chist", + extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, + sources=chist_sources, + include_dirs=include_dirs, +) +ext_modules.append(chist_module) +stat_util_sources = ["_stat_util.c"] +stat_util_sources = ["esutil/stat/" + s for s in stat_util_sources] +stat_util_module = Extension( + "esutil.stat._stat_util", + extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, + sources=stat_util_sources, + include_dirs=include_dirs, +) +ext_modules.append(stat_util_module) +packages.append("esutil.stat") + +# integrate package + +# cgauleg_sources = glob('esutil/integrate/*.cc') +cgauleg_sources = glob("esutil/integrate/cgauleg_pywrap.c") +cgauleg_module = Extension( + "esutil.integrate._cgauleg", + extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, + sources=cgauleg_sources, + include_dirs=include_dirs, +) +ext_modules.append(cgauleg_module) +packages.append("esutil.integrate") long_description = """ A python package including a wide variety of utilities, focused primarily on @@ -291,7 +280,7 @@ def build_extensions(self): packages=packages, cmdclass={"build_ext": MyBuilder}, ext_modules=ext_modules, - install_requires=['numpy'], + install_requires=['numpy','scipy'], ) # If we get to here, then all was fine. Go ahead and delete the files in the