Skip to content

Commit

Permalink
Merge branch 'cmake-build'
Browse files Browse the repository at this point in the history
  • Loading branch information
althonos committed Oct 12, 2024
2 parents c7cc98b + df78a4d commit 940a56f
Show file tree
Hide file tree
Showing 157 changed files with 1,357 additions and 1,183 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,22 +257,22 @@ jobs:
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python 3.10
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: 3.12
- name: Download source distribution
uses: actions/download-artifact@v4
with:
name: sdist
path: dist/
merge-multiple: true
- name: Extract package version
run: "echo PKGVER=$(python setup.py --version) >> $GITHUB_ENV"
run: "echo PKGVER=$( grep 'version =' pyproject.toml | cut -d\\\" -f2 ) >> $GITHUB_ENV"
- name: Compute SHA256 of source distribution
run: "echo SHA256=$(sha256sum dist/pyhmmer-${{ env.PKGVER }}.tar.gz | cut -f1 -d' ') >> $GITHUB_ENV"
- name: Generate PKGBUILD
run: 'sed -e "s/%pkgver/${{ env.PKGVER }}/g" -e "s/%sha256sum/${{ env.SHA256 }}/g" pkg/aur/PKGBUILD.in > pkg/aur/PKGBUILD'
run: 'sed -e "s/%pkgver/${{ github.ref }}/g" -e "s/%sha256sum/${{ env.SHA256 }}/g" pkg/aur/PKGBUILD.in > pkg/aur/PKGBUILD'
- name: Update package
uses: KSXGitHub/github-actions-deploy-aur@v2.7.2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# build dependencies
setuptools >=46.4
wheel >=0.34.0
cython ~=3.0
scikit-build-core
ninja

# run dependencies
psutil ~=5.0
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ jobs:
- name: Install Python requirements
run: python -m pip install -r .github/workflows/requirements.txt
- name: Build C extension
run: python setup.py build_ext --inplace --debug -j0
run: pip install -vv -e . --no-build-isolation
- name: Install test requirements
run: python -m pip install -r pyhmmer/tests/requirements.txt
run: python -m pip install -r src/pyhmmer/tests/requirements.txt
- name: Test with coverage
run: python -m coverage run -m unittest discover -vv
run: python -m coverage run -m unittest pyhmmer.tests -vv
- name: Upload to Codecov
if: matrix.python-impl == 'CPython'
uses: codecov/codecov-action@v3
Expand Down Expand Up @@ -164,12 +164,12 @@ jobs:
- name: Install Python requirements
run: python -m pip install -r .github/workflows/requirements.txt
- name: Build C extension
run: arch -x86_64 python setup.py build_ext --inplace --debug
run: arch -x86_64 pip install -vv -e . --no-build-isolation
- name: Install test requirements
run: python -m pip install -r pyhmmer/tests/requirements.txt
run: python -m pip install -r src/pyhmmer/tests/requirements.txt
if: matrix.python-impl == 'CPython'
- name: Test with coverage
run: python -m coverage run -m unittest discover -vv
run: python -m coverage run -m unittest pyhmmer.tests -vv
- name: Upload to Codecov
uses: codecov/codecov-action@v4
if: matrix.python-impl == 'CPython'
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
pyproject.toml

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
52 changes: 52 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
cmake_minimum_required(VERSION 3.20)
project(${SKBUILD_PROJECT_NAME} VERSION ${SKBUILD_PROJECT_VERSION} LANGUAGES C)

set(BUILD_SHARED_LIBS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set_property(GLOBAL PROPERTY PYTHON_EXTENSIONS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)

# --- Detect SIMD --------------------------------------------------------------

include("src/scripts/cmake/FindNEON.cmake")
include("src/scripts/cmake/FindSSE2.cmake")
include("src/scripts/cmake/FindSSE4.cmake")
include("src/scripts/cmake/FindVMX.cmake")
include("src/scripts/cmake/Destatic.cmake")
include("src/scripts/cmake/CythonExtension.cmake")

if(HAVE_SSE4)
set(eslENABLE_SSE4 true)
string(STRIP "${SSE4_C_FLAGS}" IMPL_FLAGS)
if(IMPL_FLAGS)
add_compile_options(${IMPL_FLAGS})
endif()
endif()

if(HAVE_SSE2)
set(eslENABLE_SSE true)
set(HMMER_IMPL "SSE")
string(STRIP "${SSE2_C_FLAGS}" IMPL_FLAGS)
elseif(HAVE_NEON)
set(eslENABLE_NEON true)
set(HMMER_IMPL "NEON")
string(STRIP "${NEON_C_FLAGS}" IMPL_FLAGS)
elseif(HAVE_VMX)
set(eslENABLE_VMX true)
set(HMMER_IMPL "VMX")
string(STRIP "${VMX_C_FLAGS}" IMPL_FLAGS)
else()
message(FATAL_ERROR "Unsupported platform, none of SSE2, NEON or AltiVec available.")
endif()

if(IMPL_FLAGS)
add_compile_options(${IMPL_FLAGS})
endif()

# --- Setup include folders ----------------------------------------------------

set(CYTHON_HEADERS_DIR ${CMAKE_CURRENT_LIST_DIR}/include)

# --- Compile source code ------------------------------------------------------

add_subdirectory("src")
25 changes: 0 additions & 25 deletions MANIFEST.in

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/aur/PKGBUILD.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pkgdesc="Cython bindings and Python interface to HMMER3"
url="https://github.com/althonos/pyhmmer"
arch=('i686' 'pentium4' 'x86_64' 'armv7h' 'aarch64')
license=("MIT")
makedepends=('python-setuptools' 'cython' 'python-build' 'python-installer')
makedepends=('cython' 'python-build' 'python-installer')
depends=('python' 'python-psutil')
source=("https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz")
sha256sums=(%sha256sum)
Expand Down
112 changes: 112 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
[build-system]
requires = ["scikit-build-core", "cython >= 3.0"]
build-backend = "scikit_build_core.build"

[project]
name = "pyhmmer"
version = "0.10.15"
description = "Cython bindings and Python interface to HMMER3."
readme = "README.md"
requires-python = ">=3.7"
license = { file = "COPYING" }
authors = [
{ name = "Martin Larralde", email = "martin.larralde@embl.de" },
]
# platform = "posix"
keywords = ["bioinformatics", "profile", "HMM", "sequence", "pfam"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX",
"Programming Language :: C",
"Programming Language :: Cython",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Medical Science Apps.",
"Typing :: Typed",
]
dependencies = [
"psutil ~=6.0"
]

[project.urls]
"Documentation" = "https://pyhmmer.readthedocs.io/en/stable/"
"Bug Tracker" = "https://github.com/althonos/pyhmmer/issues"
"Changelog" = "https://github.com/althonos/pyhmmer/blob/master/CHANGELOG.md"
"Coverage" = "https://codecov.io/gh/althonos/pyhmmer/"
"Builds" = "https://github.com/althonos/pyhmmer/actions"
"Paper" = "https://doi.org/10.1093/bioinformatics/btad214"
"PyPI" = "https://pypi.org/project/pyhmmer"

[project.optional-dependencies]
test = ["importlib-resources ; python_version < '3.9'"]

[tool.scikit-build]
build-dir = "build/{build_type}"
editable.rebuild = true
editable.verbose = false

[[tool.scikit-build.generate]]
path = "src/pyhmmer/_version.py"
template = '__version__ = "${version}"'
location = 'source'

[[tool.scikit-build.overrides]]
if.state = "editable"
cmake.build-type = "Debug"

[[tool.scikit-build-overrides]]
if.env.SCCACHE = true
cmake.define.CMAKE_C_COMPILER_LAUNCHER = "sccache"
cmake.define.CMAKE_CXX_COMPILER_LAUNCHER = "sccache"

[[tool.scikit-build-overrides]]
if.env.MOLD = true
cmake.define.CMAKE_LINKER_TYPE = "mold"

#[tool.coverage.run]
#plugins = ["Cython.Coverage"]

[tool.coverage.report]
include = ["src/pyhmmer/*"]
omit = ["src/pyhmmer/tests/*"]
show_missing = true
exclude_lines = [
"pragma: no cover",
"if typing.TYPE_CHECKING:",
"@abc.abstractmethod",
"@abc.abstractproperty",
"raise NotImplementedError",
"return NotImplemented",
"raise UnexpectedError",
"raise AllocationError",
]

[tool.coverage.paths]
source = [
"src/pyhmmer/",
"build/Debug/src/pyhmmer/",
]

[tool.mypy]
disallow_any_decorated = true
disallow_any_generics = true
disallow_any_unimported = false
disallow_subclassing_any = false
disallow_untyped_calls = true
disallow_untyped_defs = true
ignore_missing_imports = true
warn_unused_ignores = true
warn_return_any = true

["tool.mypy-pyhmmer.tests.*"]
ignore_errors = true
Loading

0 comments on commit 940a56f

Please sign in to comment.