Skip to content

Commit

Permalink
Add newer pythons to github actions (#483)
Browse files Browse the repository at this point in the history
* Updates for python3.10 / LGTM warnings
  • Loading branch information
PhilipDeegan authored Jan 18, 2023
1 parent cc67f7d commit 75d252d
Show file tree
Hide file tree
Showing 37 changed files with 226 additions and 150 deletions.
41 changes: 30 additions & 11 deletions .github/workflows/build_nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ on:

env:
TICK_DEBUG: 0

TICK_WERROR: 0
MKN_GCC_PREFERRED: 1

jobs:
build:
Expand All @@ -20,25 +21,43 @@ jobs:
fail-fast: false
max-parallel: 4
matrix:
python-version: ['3.7']
python-version: ['3.7', '3.9', '3.10'] # '3.8' has "'tp_print' is deprecated [-Werror,-Wdeprecated-declarations]"

steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: install swig
run: |
git clone https://github.com/swig/swig -b rel-4.0.2 swig
cd swig && ./autogen.sh && ./configure --without-pcre
make && sudo make install && cd .. && rm -rf swig
- uses: actions/setup-python@v1
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- run: |




- name: info
run: |
python3 -V
gcc -v
swig -version
- name: pip
run: |
python3 -m pip install wheel pip --upgrade
python3 -m pip install -r requirements.txt
python3 setup.py build_ext --inplace cpptest pytest
- name: build
run: |
curl -Lo mkn https://github.com/mkn/mkn/releases/download/latest/mkn_nix
chmod +x mkn
PATH=$PWD:$PATH KLOG=3 ./sh/mkn.sh
- name: cpptest
run: |
PATH=$PWD:$PATH KLOG=3 ./sh/gtest.sh
- name: pytest
run: |
python3 setup.py pytest
46 changes: 30 additions & 16 deletions .github/workflows/build_osx.yml.off
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:
TICK_DEBUG: 0
TICK_WERROR: 0


jobs:
build:
name: Python ${{ matrix.python-version }}
Expand All @@ -20,30 +21,43 @@ jobs:
fail-fast: false
max-parallel: 4
matrix:
python-version: ['3.7', '3.8', '3.9']
python-version: ['3.7', '3.9', '3.10'] # '3.8' has "'tp_print' is deprecated [-Werror,-Wdeprecated-declarations]"

steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: install swig
run: |
brew update
brew install automake m4
git clone https://github.com/swig/swig -b rel-4.0.2 swig
cd swig && ./autogen.sh && ./configure --without-pcre
make && make install && cd .. && rm -rf swigkey

- uses: actions/setup-python@v1
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- run: |
pip install pip --upgrade
pip install wheel
pip install -r requirements.txt
python setup.py build_ext --inplace cpptest
python -m unittest discover -v . "*_test.py"




- name: info
run: |
python3 -V
clang -v
swig -version

- name: pip
run: |
python3 -m pip install wheel pip --upgrade
python3 -m pip install -r requirements.txt

- name: build
run: |
curl -Lo mkn https://github.com/mkn/mkn/releases/download/latest/mkn_osx
chmod +x mkn
PATH=$PWD:$PATH KLOG=3 ./sh/mkn.sh

- name: cpptest
run: |
PATH=$PWD:$PATH KLOG=3 ./sh/gtest.sh

- name: pytest
run: |
python -m unittest discover -v . "*_test.py"
38 changes: 29 additions & 9 deletions .github/workflows/build_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ on:

env:
TICK_DEBUG: 0
# TICK_CMAKE_GENERATOR: Visual Studio 16 2022
TICK_WERROR: 0
MKN_CL_PREFERRED: 1

jobs:
build:
Expand All @@ -20,24 +21,43 @@ jobs:
fail-fast: false
max-parallel: 4
matrix:
python-version: ['3.9']
python-version: ['3.7'] # '3.8', '3.9', '3.10', have dll init issues

This comment has been minimized.

Copy link
@lgoix

lgoix Feb 7, 2023

I confirm version 0.7.0.1 at commit 73acead doesn't have this DLL issue and build on Windows 10/11

The version 0.7.0.1 in https://pypi.org/project/tick/0.7.0.1/#files seems to be the commit 5b8ef9d and this version doesn't build on Windows 10/11

This comment has been minimized.

Copy link
@PhilipDeegan

PhilipDeegan Feb 7, 2023

Author Member

and this version doesn't build on Windows 10/11

Please make an issue with some info/logs showing

  • How you are building it
  • with what compiler/win sdk versions
  • anything else you think is important

I can build and run on windows 10 with various versions of python without any dll issues so it's not so easy for me to debug


steps:
- uses: actions/checkout@v2
with:
submodules: true

- uses: actions/setup-python@v1
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- run: |
- uses: ilammy/msvc-dev-cmd@v1 # setup vcvars for cl.exe
with:
arch: amd64

- name: info
run: |
python3 -V
swig -version
pip install pip --upgrade
pip install wheel
pip install -r requirements.txt
python setup.py build_ext --inplace
python -m unittest discover -v . "*_test.py"
cl
- name: pip
run: |
python3 -m pip install wheel pip --upgrade
python3 -m pip install -r requirements.txt
- name: build
run: | # MINGW link interferres with MSVC link.exe
bash -c "rm /bin/link"
bash -c "curl -Lo mkn.exe https://github.com/mkn/mkn/releases/download/latest/mkn.exe"
bash -c 'PATH=$PWD:$PATH KLOG=3 ./sh/mkn.sh'
- name: cpptest
run: |
bash -c 'PATH=$PWD:$PATH KLOG=3 ./sh/gtest.sh'
- name: pytest
run: |
python -m unittest discover -v . "*_test.py"
7 changes: 6 additions & 1 deletion .github/workflows/pythonpublish-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
submodules: true

- run: |
git clone https://github.com/swig/swig -b rel-4.0.0 swig
git clone https://github.com/swig/swig -b rel-4.0.2 swig
cd swig && ./autogen.sh && ./configure --without-pcre
make && make install && cd .. && rm -rf swig
Expand All @@ -38,6 +38,11 @@ jobs:
$PYTHON39/bin/python -m pip install wheel -r requirements.txt
$PYTHON39/bin/python setup.py bdist_wheel
- run: |
$PYTHON310/bin/python -m pip install twine pip --upgrade
$PYTHON310/bin/python -m pip install wheel -r requirements.txt
$PYTHON310/bin/python setup.py bdist_wheel
- run: for wheel in $(ls dist); do auditwheel repair dist/$wheel; done

- env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pythonpublish-osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ['3.7', '3.8', '3.9']
python-version: ['3.7', '3.8', '3.9', '3.10']
name: Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
Expand All @@ -29,7 +29,7 @@ jobs:
- run: |
brew update
brew install automake m4
git clone https://github.com/swig/swig -b rel-4.0.0 swig
git clone https://github.com/swig/swig -b rel-4.0.2 swig
cd swig && ./autogen.sh && ./configure --without-pcre
make && make install && cd .. && rm -rf swigkey
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pythonpublish-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ['3.7', '3.8', '3.9']
python-version: ['3.7', '3.8', '3.9', '3.10']
name: Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
Expand Down
1 change: 0 additions & 1 deletion examples/plot_2d_linear_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.utils import shuffle
from sklearn.datasets import load_boston
from mpl_toolkits.mplot3d import axes3d
from matplotlib import cm

# Load the Boston Housing Dataset
Expand Down
1 change: 0 additions & 1 deletion examples/plot_conv_sccs_cv_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
and compare the estimated coefficients to the relative incidences used for
the simulation.
"""
from time import time
import numpy as np
from scipy.sparse import csr_matrix, hstack
from matplotlib import cm
Expand Down
6 changes: 3 additions & 3 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.7)
project(tick)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -ffast-math")
Expand Down Expand Up @@ -95,8 +95,8 @@ if (${GTEST_FOUND})
message(STATUS "Testing in C++ enabled")

find_package(Threads REQUIRED)
find_package(PythonInterp 3 REQUIRED)
find_package(PythonLibs 3 REQUIRED)
find_package(PythonInterp 3.7 REQUIRED)
find_package(PythonLibs 3.7 REQUIRED)

include_directories(${GTEST_INCLUDE_DIRS})

Expand Down
8 changes: 6 additions & 2 deletions lib/cpp-test/array/array_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ArrayTest : public ::testing::Test {
typedef ::testing::Types<ArrayFloat, ArrayDouble, ArrayShort, ArrayUShort,
ArrayInt, ArrayUInt, ArrayLong, ArrayULong>
MyArrayTypes;
TYPED_TEST_CASE(ArrayTest, MyArrayTypes);
TYPED_TEST_SUITE(ArrayTest, MyArrayTypes);

template <typename ArrType>
class Array2dTest : public ::testing::Test {
Expand All @@ -49,7 +49,7 @@ typedef ::testing::Types<ArrayFloat2d, ArrayDouble2d, ArrayShort2d,
ArrayUShort2d, ArrayInt2d, ArrayUInt2d, ArrayLong2d,
ArrayULong2d>
MyArray2dTypes;
TYPED_TEST_CASE(Array2dTest, MyArray2dTypes);
TYPED_TEST_SUITE(Array2dTest, MyArray2dTypes);

TYPED_TEST(ArrayTest, InitToZero) {
TypeParam arr{TICK_TEST_DATA_SIZE};
Expand Down Expand Up @@ -195,6 +195,10 @@ TYPED_TEST(ArrayTest, Contains) {

typename TypeParam::value_type value_3 = arrA[3] + 0.;
typename TypeParam::value_type new_value = 7032;

int retries = 0;
while(retries++ < 5 && arrA.contains(new_value)) arrA = ::GenerateRandomArray<TypeParam>();

EXPECT_TRUE(arrA.contains(value_3));
EXPECT_FALSE(arrA.contains(new_value));
arrA[3] = new_value;
Expand Down
2 changes: 1 addition & 1 deletion lib/cpp-test/array/atomic_array_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class AtomicArrayTest : public ::testing::Test {
};

typedef ::testing::Types<Array<float>, Array<double>> MyArrayTypes;
TYPED_TEST_CASE(AtomicArrayTest, MyArrayTypes);
TYPED_TEST_SUITE(AtomicArrayTest, MyArrayTypes);

TYPED_TEST(AtomicArrayTest, InitToZero) {
TypeParam arr{TICK_TEST_DATA_SIZE};
Expand Down
2 changes: 1 addition & 1 deletion lib/cpp-test/array/linear_system_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LinearSystemTest : public ::testing::Test {
};

typedef ::testing::Types<ArrayFloat, ArrayDouble> MyArrayTypes;
TYPED_TEST_CASE(LinearSystemTest, MyArrayTypes);
TYPED_TEST_SUITE(LinearSystemTest, MyArrayTypes);



Expand Down
2 changes: 1 addition & 1 deletion lib/cpp-test/base/utils_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ TEST_P(ParallelTest, MapArray) {
}
}

INSTANTIATE_TEST_CASE_P(AllParallelTests, ParallelTest,
INSTANTIATE_TEST_SUITE_P(AllParallelTests, ParallelTest,
::testing::Values(1, 2, 4, 8, 16));

TEST(ParallelTest, CPUCount) {
Expand Down
9 changes: 5 additions & 4 deletions lib/cpp/hawkes/inference/hawkes_em.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,11 @@ void HawkesEM::compute_intensities_ur(
const ulong node_u = r_u % n_nodes;

ArrayDouble2d kernel_norms = *get_kernel_norms(kernels);
double marginal_int_intensity = 0;
for (ulong node_v = 0; node_v < n_nodes; ++node_v) {
marginal_int_intensity += kernel_norms(node_v, node_u);
}
// ?
// double marginal_int_intensity = 0;
// for (ulong node_v = 0; node_v < n_nodes; ++node_v) {
// marginal_int_intensity += kernel_norms(node_v, node_u);
// }

// Fetch corresponding data
SArrayDoublePtrList1D &realization = timestamps_list[r];
Expand Down
3 changes: 1 addition & 2 deletions lib/cpp/random/rand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ void Rand::reseed(const int seed) {
std::seed_seq seed_seq{r(), r(), r(), r(), r(), r(), r(), r()};
generator = std::mt19937_64(seed_seq);
} else {
unsigned int useed = seed < 0 ? 0 : static_cast<unsigned int>(seed);
generator = std::mt19937_64(useed);
generator = std::mt19937_64(seed);
}

Rand::seed = seed;
Expand Down
5 changes: 5 additions & 0 deletions lib/include/tick/base/parallel/parallel_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ namespace tick {
*/
template <typename T, typename S, typename... Args>
using FuncResultType = typename std::result_of<T(S, ulong, Args...)>::type;
/*
// this in future will be for C++17
using FuncResultType = typename std::result_of<T(S, ulong, Args...)>::type;
*/


/**
* Determine if return type of function call is a Python primitive or not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class DLL_PUBLIC HawkesKernelSumExp : public HawkesKernel {
* @param intensities: Array of the intensities of the kernel
* @param decay: Array of the decays of the kernel
*/
explicit HawkesKernelSumExp(const ArrayDouble &intensities, const ArrayDouble &decays);
HawkesKernelSumExp(const ArrayDouble &intensities, const ArrayDouble &decays);

/**
* Copy constructor
Expand Down
Loading

0 comments on commit 75d252d

Please sign in to comment.