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 Nov 6, 2024
2 parents ae6565a + f0ccb5f commit f2b0321
Show file tree
Hide file tree
Showing 72 changed files with 1,306 additions and 1,114 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
coverage ~=6.0 ; sys_platform != 'win32'
# coverage ~=7.0
cython ~=3.0
semantic-version ~=2.10
wheel
auditwheel
setuptools >=46.4.0
# semantic-version ~=2.10
scikit-build-core
importlib-resources ; python_version < '3.9'
scoring-matrices ~=0.2.0
scoring-matrices ~=0.3.0
91 changes: 53 additions & 38 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

test_linux:
name: Test (Linux)
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
env:
OS: Linux
strategy:
Expand All @@ -27,12 +27,15 @@ jobs:
- python-version: '3.10'
python-release: v3.10
python-impl: CPython
- python-version: '3.11'
- python-version: 3.11
python-release: v3.11
python-impl: CPython
- python-version: '3.12'
- python-version: 3.12
python-release: v3.12
python-impl: CPython
- python-version: 3.13
python-release: v3.13
python-impl: CPython
- python-version: pypy-3.7
python-release: v3.7
python-impl: PyPy
Expand All @@ -54,26 +57,26 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install CI requirements
- name: Update pip
run: python -m pip install -U pip wheel setuptools
- name: Install Python requirements
run: python -m pip install -r .github/workflows/requirements.txt
- name: Install test requirements
run: python -m pip install -r pyfamsa/tests/requirements.txt
- name: Build C extension in debug mode
run: python setup.py build_ext --inplace --debug
- name: Test with coverage
run: python -m coverage run -m unittest discover -vv
- name: Upload to Codecov
if: matrix.python-impl == 'CPython'
uses: codecov/codecov-action@v4
with:
flags: ${{ matrix.python-impl }},${{ matrix.python-release }},${{ env.OS }}
name: test-python-${{ matrix.python-version }}
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build extension in debug mode
run: python -m pip install -v -e . --no-build-isolation
- name: Test extension
run: python -m unittest pyfamsa.tests -vv
# - name: Upload to Codecov
# if: matrix.python-impl == 'CPython'
# uses: codecov/codecov-action@v3
# with:
# flags: ${{ matrix.python-impl }},${{ matrix.python-release }},${{ env.OS }}
# name: test-python-${{ matrix.python-version }}
# fail_ci_if_error: true
# token: ${{ secrets.CODECOV_TOKEN }}

test_osx:
name: Test (OSX)
runs-on: macos-12
runs-on: macos-13
env:
OS: OSX
strategy:
Expand All @@ -98,6 +101,9 @@ jobs:
- python-version: '3.12'
python-release: v3.12
python-impl: CPython
- python-version: '3.13'
python-release: v3.13
python-impl: CPython
- python-version: pypy-3.7
python-release: v3.7
python-impl: PyPy
Expand All @@ -119,22 +125,26 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install CI requirements
- name: Setup deployment target
shell: bash
if: ${{ startsWith(matrix.python-version, 'pypy') || matrix.python-version == '3.11' || matrix.python-version == '3.12' }}
run: echo "MACOSX_DEPLOYMENT_TARGET=10.12" >> $GITHUB_ENV
- name: Update pip
run: python -m pip install -U pip wheel setuptools
- name: Install Python requirements
run: python -m pip install -r .github/workflows/requirements.txt
- name: Install test requirements
run: python -m pip install -r pyfamsa/tests/requirements.txt
- name: Build C extension in debug mode
run: python setup.py build_ext --inplace --debug
- name: Test with coverage
run: python -m coverage run -m unittest discover -vv
- name: Upload to Codecov
if: matrix.python-impl == 'CPython'
uses: codecov/codecov-action@v4
with:
flags: ${{ matrix.python-impl }},${{ matrix.python-release }},${{ env.OS }}
name: test-python-${{ matrix.python-version }}
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build extension in debug mode
run: python -m pip install -v -e . --no-build-isolation
- name: Test extension
run: python -m unittest pyfamsa.tests -vv
# - name: Upload to Codecov
# if: matrix.python-impl == 'CPython'
# uses: codecov/codecov-action@v3
# with:
# flags: ${{ matrix.python-impl }},${{ matrix.python-release }},${{ env.OS }}
# name: test-python-${{ matrix.python-version }}
# fail_ci_if_error: true
# token: ${{ secrets.CODECOV_TOKEN }}

test_windows:
name: Test (Windows)
Expand Down Expand Up @@ -163,6 +173,9 @@ jobs:
- python-version: '3.12'
python-release: v3.12
python-impl: CPython
- python-version: '3.13'
python-release: v3.13
python-impl: CPython
- python-version: pypy-3.7
python-release: v3.7
python-impl: PyPy
Expand All @@ -185,9 +198,11 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Update pip
run: python -m pip install -U pip wheel setuptools
- 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
- name: Test without coverage
run: python -m unittest discover -vv
- name: Build extension in debug mode
run: python -m pip install -v . --no-build-isolation
- name: Test extension
run: python -m unittest pyfamsa.tests -vv
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
45 changes: 45 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
cmake_minimum_required(VERSION 3.20)
project(${SKBUILD_PROJECT_NAME} VERSION ${SKBUILD_PROJECT_VERSION} LANGUAGES C CXX)

set(BUILD_SHARED_LIBS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

message(STATUS "Building ${SKBUILD_PROJECT_NAME} for ${CMAKE_SYSTEM_PROCESSOR}")

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

set_property(GLOBAL PROPERTY PYTHON_EXTENSIONS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(CYTHON_HEADERS_DIR ${CMAKE_CURRENT_LIST_DIR}/include)

# --- Add global C++ flags -----------------------------------------------------

include(CheckCXXCompilerFlag)

check_cxx_compiler_flag(-funroll-loops HAVE_UNROLL_LOOPS)
if(HAVE_UNROLL_LOOPS)
add_compile_options(-funroll-loops)
endif()

add_definitions(-DOLD_ATOMIC_FLAG -DNO_PROFILE_PAR)

if(WIN32)
add_definitions(-D_WIN32)
endif()

# --- Add scripts for Cython ---------------------------------------------------

include("src/scripts/cmake/FindAVX1.cmake")
include("src/scripts/cmake/FindAVX2.cmake")
# include("src/scripts/cmake/FindAVX512.cmake")
include("src/scripts/cmake/FindNEON.cmake")
include("src/scripts/cmake/FindPOPCNT.cmake")
include("src/scripts/cmake/FindSSE2.cmake")
include("src/scripts/cmake/FindSSE4.cmake")
include("src/scripts/cmake/CythonExtension.cmake")

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

add_subdirectory("src")
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ the standard library. Running them requires the extension to be built
locally:

```console
$ python setup.py build_ext --debug --inplace
$ python -m pip install -v -e . --no-build-isolation
$ python -m unittest discover -vv
```

## Coding guidelines

This project targets Python 3.6 or later.
This project targets Python 3.7 or later.

Python objects should be typed; since it is not supported by Cython,
you must manually declare types in type stubs (`.pyi` files). In Python
Expand Down
16 changes: 0 additions & 16 deletions MANIFEST.in

This file was deleted.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ the following advantages:
- **friendly interface**: The different guide tree build methods and
heuristics can be selected from the Python code with a simple keyword
argument when configuring a new [`Aligner`](https://pyfamsa.readthedocs.io/en/stable/api/aligner.html#pyfamsa.Aligner).
- **custom scoring matrices**: You can use any custom scoring matrix from
- **custom scoring matrices**: You can use any custom scoring matrix from
the [`scoring-matrices`](https://pypi.org/project/scoring-matrices) library
in addition to the default MIQS to score the alignment.
in addition to the default MIQS to score the alignment.

## 🔧 Installing

PyFAMSA can be installed directly from [PyPI](https://pypi.org/project/pyfamsa/),
which hosts some pre-built wheels for the x86-64 architecture (Linux/OSX)
and the Aarch64 architecture (Linux only), as well as the code required to
compile from source with Cython:
which hosts some pre-built wheels for the x86-64 and Aarch architectures
for Linux, MacOS and Windows, as well as the code required to compile from
source with Cython:
```console
$ pip install pyfamsa
```
Expand All @@ -63,7 +63,7 @@ package:
$ conda install -c bioconda pyfamsa
```

Otherwise, have a look at the [Installation page](https://pyfamsa.readthedocs.io/en/stable/install.html) of the [online documentation](https://pyfamsa.readthedocs.io/)
Otherwise, have a look at the [Installation page](https://pyfamsa.readthedocs.io/en/stable/guide/install.html) of the [online documentation](https://pyfamsa.readthedocs.io/)

## 💡 Example

Expand Down
4 changes: 0 additions & 4 deletions patches/sequence.cpp.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
diff --git a/src/core/sequence.cpp b/src/core/sequence.cpp
index 54401be..83d0f2f 100644
--- a/src/core/sequence.cpp
+++ b/src/core/sequence.cpp
@@ -19,6 +19,18 @@ char CGappedSequence::mapping_table[25] = "ARNDCQEGHILKMFPSTWYVBZX*";


Expand Down
4 changes: 0 additions & 4 deletions patches/sequence.h.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
diff --git a/src/core/sequence.h b/src/core/sequence.h
index ac37942..e17620e 100644
--- a/src/core/sequence.h
+++ b/src/core/sequence.h
@@ -32,7 +32,7 @@ public:
bit_vec_t *p_bit_masks;
uint32_t p_bv_len;
Expand Down
1 change: 0 additions & 1 deletion pyfamsa/tests/data/adeno_fiber.faa

This file was deleted.

1 change: 0 additions & 1 deletion pyfamsa/tests/data/adeno_fiber.p1.afa

This file was deleted.

1 change: 0 additions & 1 deletion pyfamsa/tests/data/adeno_fiber.p2.afa

This file was deleted.

1 change: 0 additions & 1 deletion pyfamsa/tests/data/adeno_fiber.sl.afa

This file was deleted.

1 change: 0 additions & 1 deletion pyfamsa/tests/data/adeno_fiber.sl.nwk

This file was deleted.

1 change: 0 additions & 1 deletion pyfamsa/tests/data/adeno_fiber.upgma.afa

This file was deleted.

1 change: 0 additions & 1 deletion pyfamsa/tests/data/adeno_fiber.upgma.nwk

This file was deleted.

1 change: 0 additions & 1 deletion pyfamsa/tests/data/adeno_fiber.upgma.pp.afa

This file was deleted.

1 change: 0 additions & 1 deletion pyfamsa/tests/data/hemopexin.faa

This file was deleted.

1 change: 0 additions & 1 deletion pyfamsa/tests/data/hemopexin.medoid-nj.afa

This file was deleted.

1 change: 0 additions & 1 deletion pyfamsa/tests/data/hemopexin.medoid-nj.nwk

This file was deleted.

1 change: 0 additions & 1 deletion pyfamsa/tests/data/hemopexin.medoid-sl.afa

This file was deleted.

1 change: 0 additions & 1 deletion pyfamsa/tests/data/hemopexin.medoid-sl.nwk

This file was deleted.

1 change: 0 additions & 1 deletion pyfamsa/tests/data/hemopexin.medoid-slink.nwk

This file was deleted.

1 change: 0 additions & 1 deletion pyfamsa/tests/data/hemopexin.medoid-upgma.afa

This file was deleted.

1 change: 0 additions & 1 deletion pyfamsa/tests/data/hemopexin.medoid-upgma.nwk

This file was deleted.

Loading

0 comments on commit f2b0321

Please sign in to comment.