Skip to content

Commit

Permalink
Update CI (#92)
Browse files Browse the repository at this point in the history
- Check only Python-3.8 and Python-3.11
- Switch to Ruff for linting
  • Loading branch information
HDembinski authored Jan 31, 2024
1 parent 07d3a89 commit 49ea939
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.9", "3.10"]
python-version: ["3.8", "3.11"]

steps:
- uses: actions/checkout@v2
Expand Down
21 changes: 7 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,15 @@ repos:
- id: trailing-whitespace
exclude: .*\.svg

# Python linter (Flake8)
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
# Ruff linter, replacement for flake8, pydocstyle, isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.1.6'
hooks:
- id: flake8

# Python docstring formatting
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
args: ["--convention=numpy"]
files: src/numba_stats/[^_].*\.py
- id: ruff
args: [--fix, --show-fixes]

# Python formatting
- repo: https://github.com/psf/black
rev: 23.11.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.1.1
hooks:
- id: black
24 changes: 24 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,27 @@ write_to = "src/numba_stats/_version.py"
minversion = "6.0"
addopts = "-q -ra --ff"
testpaths = ["tests"]

[tool.ruff]
select = [
"E",
"F", # flake8
"D", # pydocstyle
]
extend-ignore = [
"D212", # multi-line-summary-first-line
]
src = ["src"]
unfixable = [
"F841", # Removes unused variables
]

[tool.ruff.pydocstyle]
convention = "numpy"

[tool.ruff.per-file-ignores]
"setup.py" = ["D"]
"tests/*.py" = ["B", "D"]
".ci/*.py" = ["D"]
"bench/*.py" = ["D"]
"docs/*.py" = ["D"]
4 changes: 3 additions & 1 deletion src/numba_stats/_util.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Utilities for code and docs generation to reduce boilerplate code."""

import numba as nb
import numpy as np
from numba.types import Array
Expand All @@ -15,7 +17,7 @@ def _readonly_carray(T):

def _jit(arg, cache=True):
"""
Wrapper for numba.njit to reduce boilerplate code.
Wrap numba.njit to reduce boilerplate code.
We want to build jitted functions with explicit signatures to restrict the argument
types which are used in the implemnetation to float32 or float64. We also want to
Expand Down
1 change: 1 addition & 0 deletions src/numba_stats/cpoisson.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
There is a Meijer G-function implemented in mpmath, but I don't know how to use it.
"""

from ._special import gammaincc as _gammaincc
from ._util import _jit, _generate_wrappers, _prange
import numpy as np
Expand Down
1 change: 1 addition & 0 deletions src/numba_stats/crystalball.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
--------
scipy.stats.crystalball: Scipy equivalent.
"""

from ._util import _jit, _trans, _generate_wrappers, _prange
import numpy as np
from math import erf as _erf
Expand Down
1 change: 1 addition & 0 deletions src/numba_stats/expon.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
--------
scipy.stats.expon: Scipy equivalent.
"""

import numpy as np
from math import expm1 as _expm1, log1p as _log1p
from ._util import _jit, _trans, _generate_wrappers, _prange, _rvs_jit, _seed
Expand Down
1 change: 1 addition & 0 deletions src/numba_stats/laplace.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
--------
scipy.stats.laplace: Scipy equivalent.
"""

import numpy as np
from ._util import _jit, _trans, _generate_wrappers, _prange, _rvs_jit, _seed

Expand Down
1 change: 1 addition & 0 deletions src/numba_stats/lognorm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
--------
scipy.stats.lognorm: Scipy equivalent.
"""

import numpy as np
from . import norm as _norm
from ._util import _jit, _trans, _generate_wrappers, _prange, _seed, _rvs_jit
Expand Down
1 change: 1 addition & 0 deletions src/numba_stats/norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
--------
scipy.stats.norm: Scipy equivalent.
"""

import numpy as np
from ._special import ndtri as _ndtri
from ._util import _jit, _trans, _generate_wrappers, _prange, _seed, _rvs_jit
Expand Down
1 change: 1 addition & 0 deletions src/numba_stats/t.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
--------
scipy.stats.t: Scipy equivalent.
"""

import numpy as np
from ._special import stdtr as _stdtr, stdtrit as _stdtrit
from ._util import _jit, _trans, _generate_wrappers, _prange, _seed, _rvs_jit
Expand Down
1 change: 1 addition & 0 deletions src/numba_stats/truncexpon.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
--------
scipy.stats.truncexpon: Scipy equivalent.
"""

import numpy as np
from ._util import _jit, _trans, _generate_wrappers, _prange, _rvs_jit, _seed
from . import expon as _expon
Expand Down
1 change: 1 addition & 0 deletions src/numba_stats/uniform.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
--------
scipy.stats.uniform: Equivalent in Scipy.
"""

from ._util import _jit, _generate_wrappers, _prange, _rvs_jit, _seed
import numpy as np

Expand Down
1 change: 1 addition & 0 deletions src/numba_stats/voigt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
--------
scipy.special.voigt_profile: Equvialent in Scipy.
"""

from ._special import voigt_profile as _voigt
from ._util import _jit, _generate_wrappers, _prange
import numpy as np
Expand Down

0 comments on commit 49ea939

Please sign in to comment.