Skip to content

Commit

Permalink
setup changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pravirkr committed Jan 4, 2022
1 parent 3938209 commit c1f4996
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 153 deletions.
17 changes: 4 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: GitHub CI

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

jobs:
build:
Expand All @@ -13,24 +13,15 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-latest]
python-version: [3.7, 3.8]
os: [ubuntu-latest, macos-latest]
python-version: [3.8, 3.9, 3.10]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies for macOS
if: startsWith(matrix.os, 'macos')
run: |
brew install libomp fftw
- name: Install dependencies for ubuntu
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get -y install build-essential fftw3 fftw3-dev
- name: Install it
run: |
python -m pip install -U pip setuptools wheel
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ conda:

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
version: "3.8"
install:
- method: pip
path: .
Expand Down
37 changes: 0 additions & 37 deletions Dockerfile

This file was deleted.

4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# -- Project information -----------------------------------------------------

project = "sigpyproc3"
copyright = "2020, Ewan Barr & Fast Radio Burst Software"
copyright = "2022, Ewan Barr & Fast Radio Burst Software"
author = "Ewan Barr"

# The version info for the project you're documenting, acts as replacement for
Expand Down Expand Up @@ -61,7 +61,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.

html_theme = "sphinx_rtd_theme"
html_theme = 'sphinx_book_theme'
html_theme_options = {
"logo_only": False,
"display_version": True,
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
requires = [
"setuptools>=47",
"wheel",
"pybind11>=2.6.0",
]

build-backend = "setuptools.build_meta"


[tool.black]
line-length = 90
target_version = ['py36', 'py37', 'py38']
target_version = ['py38', 'py39', 'py310']
12 changes: 6 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = sigpyproc
version = 0.5.7
version = 0.6.0
author = Ewan Barr
author_email = [email protected]
maintainer = Pravir Kumar
Expand All @@ -12,11 +12,9 @@ long_description_content_type = text/markdown
classifiers =
Operating System :: OS Independent
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: C++
Programming Language :: Python :: 3.10
Intended Audience :: Science/Research
Topic :: Scientific/Engineering :: Astronomy

Expand All @@ -31,7 +29,9 @@ install_requires =
rich
attrs
bidict
importlib_metadata; python_version<'3.8'
scipy
bottleneck
numba

[options.entry_points]
console_scripts =
Expand All @@ -47,7 +47,7 @@ tests =
pytest-benchmark
docs =
sphinx>=3.2.1
sphinx_rtd_theme>=0.5.0
sphinx-book-theme
pandoc
ipython
breathe
Expand Down
94 changes: 2 additions & 92 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,92 +1,2 @@
import os
import sys
import sysconfig
import platform

from setuptools import setup

# Available at setup time due to pyproject.toml
from pybind11.setup_helpers import Pybind11Extension, build_ext


MACOS = sys.platform.startswith("darwin")
TRIPLET = sysconfig.get_config_var("MULTIARCH") or "" # x86_64-linux-gnu
BITS = platform.architecture()[0][:-3]


def append_path(dirs_list, *args):
entry = os.path.normpath(os.path.join(*args))
if os.path.isdir(entry):
if entry not in dirs_list:
dirs_list.append(entry)


def get_include_dirs():
prefix_dirs = ["/usr", "/usr/local"]
dirs = []
sys_include = sysconfig.get_config_var("INCLUDEDIR")
if sys_include is not None:
append_path(dirs, sys_include, TRIPLET)
append_path(dirs, sys_include)
for prefix in prefix_dirs:
append_path(dirs, prefix, "include", TRIPLET)
append_path(dirs, prefix, "include")
return dirs


def get_library_dirs():
prefix_dirs = ["/usr", "/usr/local"]
dirs = []
sys_lib = sysconfig.get_config_var("LIBDIR")
if sys_lib is not None:
append_path(dirs, sys_lib, TRIPLET)
append_path(dirs, sys_lib)
for prefix in prefix_dirs:
append_path(dirs, prefix, f"lib{BITS}")
append_path(dirs, prefix, "lib", TRIPLET)
append_path(dirs, prefix, "lib")
return dirs


def get_compile_flags():
cflags = ["-Wall", "-Wextra"]
if MACOS:
cflags += ["-Xpreprocessor", "-fopenmp"]
else:
cflags += ["-fopenmp"]
return cflags


def get_link_flags():
lflags = ["-lm"]
if MACOS:
lflags += ["-lomp"]
else:
lflags += ["-lgomp"]
return lflags


# The main interface is through Pybind11Extension.
# * You can add cxx_std=11/14/17, and then build_ext can be removed.
# * You can set include_pybind11=false to add the include directory yourself,
# say from a submodule.
#
# Note:
# Sort input source files if you glob sources to ensure bit-for-bit
# reproducible builds (https://github.com/pybind/python_example/pull/53)

ext_modules = [
Pybind11Extension(
"sigpyproc.libcpp",
sources=["sigpyproc/cpp/bindings.cpp"],
include_dirs=get_include_dirs(),
library_dirs=get_library_dirs(),
extra_link_args=get_link_flags(),
extra_compile_args=get_compile_flags(),
),
]

setup(
ext_modules=ext_modules,
cmdclass={"build_ext": build_ext},
)
import setuptools
setuptools.setup()

0 comments on commit c1f4996

Please sign in to comment.