Skip to content

Commit

Permalink
Use Github actions for CI (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
benfred committed Nov 6, 2020
1 parent 69791cd commit 29405a1
Show file tree
Hide file tree
Showing 23 changed files with 82 additions and 155 deletions.
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package
name: Build

on:
push:
Expand All @@ -12,10 +12,11 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8]
os: [macos-latest, ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v2
Expand All @@ -27,20 +28,20 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install flake8 isort cpplint
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -r requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=11 --max-line-length=127 --statistics
flake8 --filename='*.pyx,*.px*' --ignore E901,E225,E226,E227,E999
flake8 --filename='*.pyx,*.px*' --ignore E901,E225,E226,E227,E402,E999
- name: Lint with isort
run: |
isort -c implicit/*.py
isort -c examples/*.py
isort -c tests/*.py
isort -c --thirdparty=seaborn --thirdparty=matplotlib --thirdparty=pyspark benchmarks/*.py
isort -c .
- name: Build
run: |
python setup.py install
- name: Run unittests
run: |
python setup.py test
64 changes: 0 additions & 64 deletions .travis.yml

This file was deleted.

3 changes: 1 addition & 2 deletions README.md
@@ -1,8 +1,7 @@
Implicit
=======

[![Build Status](https://travis-ci.org/benfred/implicit.svg?branch=master)](https://travis-ci.org/benfred/implicit)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/9kfbvx5i6dc48yr0?svg=true)](https://ci.appveyor.com/project/benfred/implicit)
[![Build Status](https://github.com/benfred/implicit/workflows/Build/badge.svg)](https://github.com/benfred/implicit/actions?query=workflow%3ABuild+branch%3Amaster)

Fast Python Collaborative Filtering for Implicit Datasets.

Expand Down
23 changes: 0 additions & 23 deletions appveyor.yml

This file was deleted.

2 changes: 1 addition & 1 deletion cuda_setup.py
Expand Up @@ -3,8 +3,8 @@
import logging
import os
import sys

from distutils import ccompiler, errors, msvccompiler, unixccompiler

from setuptools.command.build_ext import build_ext as setuptools_build_ext


Expand Down
8 changes: 5 additions & 3 deletions implicit/_nearest_neighbours.pyx
@@ -1,15 +1,17 @@
import cython

from cython cimport floating, integral
import numpy as np
import scipy.sparse

import threading

import numpy as np
import scipy.sparse
from cython.operator import dereference
from cython.parallel import parallel, prange

from libcpp cimport bool
from libcpp.vector cimport vector
from libcpp.utility cimport pair
from libcpp.vector cimport vector

from tqdm.auto import tqdm

Expand Down
11 changes: 7 additions & 4 deletions implicit/cpu/_als.pyx
@@ -1,13 +1,16 @@
import numpy as np
import cython
import numpy as np

from cython cimport floating, integral

from cython.parallel import parallel, prange
from libc.stdlib cimport malloc, free
from libc.string cimport memcpy, memset

cimport scipy.linalg.cython_blas as cython_blas
# requires scipy v0.16
cimport scipy.linalg.cython_lapack as cython_lapack
cimport scipy.linalg.cython_blas as cython_blas
from libc.stdlib cimport free, malloc
from libc.string cimport memcpy, memset


# lapack/blas wrappers for cython fused types
cdef inline void axpy(int * n, floating * da, floating * dx, int * incx, floating * dy,
Expand Down
2 changes: 1 addition & 1 deletion implicit/cpu/als.py
Expand Up @@ -9,9 +9,9 @@
import scipy.sparse
from tqdm.auto import tqdm

from . import _als
from ..recommender_base import MatrixFactorizationBase
from ..utils import check_blas_config, check_random_state, nonzeros
from . import _als

log = logging.getLogger("implicit")

Expand Down
9 changes: 6 additions & 3 deletions implicit/cpu/bpr.pyx
@@ -1,25 +1,28 @@
import cython

from cython cimport floating, integral

import logging
import multiprocessing
import time
from tqdm.auto import tqdm

from cython.parallel import parallel, prange
from tqdm.auto import tqdm

from libc.math cimport exp
from libcpp cimport bool
from libcpp.algorithm cimport binary_search

import random

import numpy as np
import scipy.sparse

import random
from libcpp.vector cimport vector

from ..recommender_base import MatrixFactorizationBase
from ..utils import check_random_state


log = logging.getLogger("implicit")

# thin wrapper around omp_get_thread_num (since referencing directly will cause OSX
Expand Down
2 changes: 1 addition & 1 deletion implicit/datasets/_download.py
@@ -1,12 +1,12 @@
import os

try:
from urllib.request import urlretrieve
except ImportError:
from urllib import urlretrieve

from tqdm.auto import tqdm


LOCAL_CACHE_DIR = os.path.join(os.path.expanduser("~"), "implicit_datasets")


Expand Down
10 changes: 5 additions & 5 deletions implicit/datasets/lastfm.py
@@ -1,13 +1,13 @@
import h5py
import time
import os
import logging
from scipy.sparse import coo_matrix, csr_matrix
import os
import time

import h5py
import numpy as np
from scipy.sparse import coo_matrix, csr_matrix

from implicit.datasets import _download


log = logging.getLogger("implicit")


Expand Down
12 changes: 6 additions & 6 deletions implicit/datasets/million_song_dataset.py
@@ -1,14 +1,14 @@
import h5py
import time
from tqdm.auto import tqdm
import os
import logging
from scipy.sparse import coo_matrix, csr_matrix
import os
import time

import h5py
import numpy as np
from scipy.sparse import coo_matrix, csr_matrix
from tqdm.auto import tqdm

from implicit.datasets import _download


log = logging.getLogger("implicit")


Expand Down
8 changes: 4 additions & 4 deletions implicit/datasets/movielens.py
@@ -1,12 +1,12 @@
import h5py
import os
import logging
from scipy.sparse import coo_matrix, csr_matrix
import os

import h5py
import numpy as np
from scipy.sparse import coo_matrix, csr_matrix

from implicit.datasets import _download


log = logging.getLogger("implicit")


Expand Down
10 changes: 5 additions & 5 deletions implicit/datasets/reddit.py
@@ -1,13 +1,13 @@
import h5py
import time
import os
import logging
from scipy.sparse import coo_matrix, csr_matrix
import os
import time

import h5py
import numpy as np
from scipy.sparse import coo_matrix, csr_matrix

from implicit.datasets import _download


log = logging.getLogger("implicit")


Expand Down
10 changes: 5 additions & 5 deletions implicit/datasets/sketchfab.py
@@ -1,13 +1,13 @@
import h5py
import time
import os
import logging
from scipy.sparse import coo_matrix, csr_matrix
import os
import time

import h5py
import numpy as np
from scipy.sparse import coo_matrix, csr_matrix

from implicit.datasets import _download


log = logging.getLogger("implicit")


Expand Down
4 changes: 2 additions & 2 deletions implicit/evaluation.pyx
Expand Up @@ -8,9 +8,9 @@ from cython.parallel import parallel, prange
from scipy.sparse import coo_matrix, csr_matrix
from tqdm.auto import tqdm

from libc.stdlib cimport malloc, free
from libc.string cimport memset
from libc.math cimport fmin
from libc.stdlib cimport free, malloc
from libc.string cimport memset
from libcpp.unordered_set cimport unordered_set

from .utils import check_random_state
Expand Down
3 changes: 2 additions & 1 deletion implicit/gpu/__init__.py
@@ -1,8 +1,9 @@
from __future__ import absolute_import

try:
from ._cuda import * # noqa
import cupy # noqa

from ._cuda import * # noqa
HAS_CUDA = True
except ImportError:
HAS_CUDA = False
3 changes: 2 additions & 1 deletion implicit/gpu/_cuda.pyx
@@ -1,11 +1,12 @@
""" Various thin cython wrappers on top of CUDA functions """
import numpy as np
import cython
import numpy as np
from cython.operator import dereference

from libcpp cimport bool
from libcpp.utility cimport pair


cdef extern from "als.h" namespace "implicit" nogil:
cdef cppclass CudaCSRMatrix:
CudaCSRMatrix(int rows, int cols, int nonzeros,
Expand Down
2 changes: 1 addition & 1 deletion implicit/gpu/als.py
Expand Up @@ -11,8 +11,8 @@
import scipy.sparse
from tqdm.auto import tqdm


import implicit.gpu

from .matrix_factorization_base import MatrixFactorizationBase, check_random_state

log = logging.getLogger("implicit")
Expand Down

0 comments on commit 29405a1

Please sign in to comment.