Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[flake8]
extend-ignore =
# whitespace before ':' (currently conflicts with black formatting):
E203,
# missing docstring in public module:
D100,
# missing docstring in public class:
D101,
# missing docstring in public method:
D103,
# missing docstring in public package:
D104,
# missing docstring in magic method:
D105,
# missing docstring in __init__:
D107,
# 1 blank line required between summary line and description:
D205,
# first line should end with a period:
D400,
# first line should be in imperative mood:
D401,
# first line should not be the function's "signature":
D402,

per-file-ignores =
mkl_random/__init__.py: F401
mkl_random/interfaces/__init__.py: F401

filename = *.py, *.pyx, *.pxi, *.pxd
max_line_length = 80
max-doc-length = 80
show-source = True

# Print detailed statistic if any issue detected
count = True
statistics = True
6 changes: 6 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@

# Sporadic fixes in test_random.py
e76aa3a5a4b889c0434f0103ec102a50b93ab1ca

# Added pre-commit hooks
1982deb5c4c189e4bab5733972027a5f82b8868e

# Added more pre-commit hooks
ca14da6a4aa55abc42f7c9993cfb28f046b3c156
2 changes: 1 addition & 1 deletion .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
run: |
# Ensure that SYCL libraries are on LD_LIBRARY_PATH
source /opt/intel/oneapi/setvars.sh
pip install --no-deps --no-build-isolation -e . --verbose
pip install --no-deps --no-build-isolation -e . --verbose
python -c "import mkl_random; print(mkl_random.__version__)" || exit 1
sphinx-build -M html docs/source docs/build
mkdir -p ~/rendered_docs
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/build-with-clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13"]
numpy_version: ["numpy'>=2'"]
numpy_version: ["numpy>=2"]
env:
ONEAPI_ROOT: /opt/intel/oneapi

Expand Down Expand Up @@ -55,22 +55,22 @@ jobs:
- name: Install mkl_random dependencies
run: |
pip install cython setuptools">=77"
pip install ${{ matrix.numpy_version }}
pip install "${{ matrix.numpy_version }}"

- name: List oneAPI folder content
run: ls ${{ env.ONEAPI_ROOT }}/compiler
run: ls "${{ env.ONEAPI_ROOT }}/compiler"

- name: Build mkl_random
run: |
source ${{ env.ONEAPI_ROOT }}/setvars.sh
echo $CMPLR_ROOT
export CC=$CMPLR_ROOT/bin/icx
export CXX=$CMPLR_ROOT/bin/icpx
source "${{ env.ONEAPI_ROOT }}/setvars.sh"
echo "$CMPLR_ROOT"
export CC="$CMPLR_ROOT/bin/icx"
export CXX="$CMPLR_ROOT/bin/icpx"
export CFLAGS="${CFLAGS} -fno-fast-math -O2"
pip install -e . --no-build-isolation --no-deps --verbose

- name: Run mkl_random tests
run: |
source ${{ env.ONEAPI_ROOT }}/setvars.sh
source "${{ env.ONEAPI_ROOT }}/setvars.sh"
pip install pytest
pytest -s -v --pyargs mkl_random
48 changes: 24 additions & 24 deletions .github/workflows/conda-package-cf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ jobs:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-

- name: Add conda to system path
run: echo $CONDA/bin >> $GITHUB_PATH
run: echo "$CONDA/bin" >> "$GITHUB_PATH"
- name: Install conda-build
run: conda install conda-build
- name: Build conda package
run: |
CHANNELS="-c conda-forge --override-channels"
VERSIONS="--python ${{ matrix.python }} --numpy ${{ matrix.numpy }}"
TEST="--no-test"
CHANNELS=(-c conda-forge --override-channels)
VERSIONS=(--python "${{ matrix.python }}" --numpy "${{ matrix.numpy }}")
TEST=(--no-test)

conda build \
$TEST \
$VERSIONS \
$CHANNELS \
"${TEST[@]}" \
"${VERSIONS[@]}" \
"${CHANNELS[@]}" \
conda-recipe-cf
- name: Upload artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
- name: Install conda-build
run: conda install -n base -y conda-build
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
- name: Build conda package
run: conda build --no-test --python ${{ matrix.python }} --numpy ${{ matrix.numpy }} -c conda-forge --override-channels conda-recipe-cf
- name: Upload artifact
Expand Down Expand Up @@ -144,24 +144,24 @@ jobs:
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
- name: Add conda to system path
run: echo $CONDA/bin >> $GITHUB_PATH
run: echo "$CONDA/bin" >> "$GITHUB_PATH"
- name: Install conda-build
run: conda install conda-build
- name: Create conda channel
run: |
mkdir -p $GITHUB_WORKSPACE/channel/linux-64
conda index $GITHUB_WORKSPACE/channel || exit 1
mv ${PACKAGE_NAME}-*.conda $GITHUB_WORKSPACE/channel/linux-64 || exit 1
conda index $GITHUB_WORKSPACE/channel || exit 1
mkdir -p "$GITHUB_WORKSPACE/channel/linux-64"
conda index "$GITHUB_WORKSPACE/channel" || exit 1
mv "${PACKAGE_NAME}"-*.conda "$GITHUB_WORKSPACE/channel/linux-64" || exit 1
conda index "$GITHUB_WORKSPACE/channel" || exit 1
# Test channel
conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels --info --json > $GITHUB_WORKSPACE/ver.json
conda search "$PACKAGE_NAME" -c "$GITHUB_WORKSPACE/channel" --override-channels --info --json > "$GITHUB_WORKSPACE/ver.json"
cat ver.json
- name: Collect dependencies
run: |
. $CONDA/etc/profile.d/conda.sh
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
conda create -n ${{ env.TEST_ENV_NAME }} $PACKAGE_NAME=${PACKAGE_VERSION} python=${{ matrix.python }} numpy=${{ matrix.numpy }} $CHANNELS --only-deps --dry-run > lockfile
. "$CONDA/etc/profile.d/conda.sh"
PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")"
export PACKAGE_VERSION
conda create -n "${{ env.TEST_ENV_NAME }}" "${PACKAGE_NAME}=${PACKAGE_VERSION}" "python=${{ matrix.python }}" "numpy=${{ matrix.numpy }}" -c "$GITHUB_WORKSPACE/channel" -c conda-forge --override-channels --only-deps --dry-run > lockfile
cat lockfile
- name: Set pkgs_dirs
run: |
Expand All @@ -180,16 +180,16 @@ jobs:

- name: Install mkl_random
run: |
. $CONDA/etc/profile.d/conda.sh
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
conda create -n ${{ env.TEST_ENV_NAME }} $PACKAGE_NAME=${PACKAGE_VERSION} pytest python=${{ matrix.python }} numpy=${{ matrix.numpy }} $CHANNELS
. "$CONDA/etc/profile.d/conda.sh"
PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")"
export PACKAGE_VERSION
conda create -n "${{ env.TEST_ENV_NAME }}" "${PACKAGE_NAME}=${PACKAGE_VERSION}" pytest "python=${{ matrix.python }}" "numpy=${{ matrix.numpy }}" -c "$GITHUB_WORKSPACE/channel" -c conda-forge --override-channels
# Test installed packages
conda list
- name: Run tests
run: |
. $CONDA/etc/profile.d/conda.sh
conda activate ${{ env.TEST_ENV_NAME }}
. "$CONDA/etc/profile.d/conda.sh"
conda activate "${{ env.TEST_ENV_NAME }}"
pytest -vv --pyargs ${{ env.MODULE_NAME }}

test_windows:
Expand Down
58 changes: 29 additions & 29 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,26 @@ jobs:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-

- name: Add conda to system path
run: echo $CONDA/bin >> $GITHUB_PATH
run: echo "$CONDA/bin" >> "$GITHUB_PATH"

- name: Install conda-build
run: conda install conda-build

- name: Store conda paths as envs
shell: bash -el {0}
run: |
echo "CONDA_BLD=/usr/share/miniconda/conda-bld/linux-64/" >> $GITHUB_ENV
echo "CONDA_BLD=/usr/share/miniconda/conda-bld/linux-64/" >> "$GITHUB_ENV"

- name: Build conda package
run: |
CHANNELS="-c https://software.repos.intel.com/python/conda -c conda-forge --override-channels"
VERSIONS="--python ${{ matrix.python }}"
TEST="--no-test"
CHANNELS=(-c https://software.repos.intel.com/python/conda -c conda-forge --override-channels)
VERSIONS=(--python "${{ matrix.python }}")
TEST=(--no-test)

conda build \
$TEST \
$VERSIONS \
$CHANNELS \
"${TEST[@]}" \
"${VERSIONS[@]}" \
"${CHANNELS[@]}" \
conda-recipe

- name: Upload artifact
Expand Down Expand Up @@ -120,10 +120,10 @@ jobs:
- name: Store conda paths as envs
shell: bash -el {0}
run: |
echo "CONDA_BLD=$CONDA_PREFIX\\conda-bld\\win-64\\" >> $GITHUB_ENV
echo "CONDA_BLD=${CONDA_PREFIX}\\conda-bld\\win-64\\" >> "$GITHUB_ENV"

- name: Build conda package
run: conda build --no-test --python ${{ matrix.python }} -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels conda-recipe
run: conda build --no-test --python "${{ matrix.python }}" -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels conda-recipe

- name: Upload artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
Expand Down Expand Up @@ -158,27 +158,27 @@ jobs:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}

- name: Add conda to system path
run: echo $CONDA/bin >> $GITHUB_PATH
run: echo "$CONDA/bin" >> "$GITHUB_PATH"

- name: Install conda-build
run: conda install conda-build

- name: Create conda channel
run: |
mkdir -p $GITHUB_WORKSPACE/channel/linux-64
conda index $GITHUB_WORKSPACE/channel || exit 1
mv ${PACKAGE_NAME}-*.conda $GITHUB_WORKSPACE/channel/linux-64 || exit 1
conda index $GITHUB_WORKSPACE/channel || exit 1
mkdir -p "$GITHUB_WORKSPACE/channel/linux-64"
conda index "$GITHUB_WORKSPACE/channel" || exit 1
mv "${PACKAGE_NAME}"-*.conda "$GITHUB_WORKSPACE/channel/linux-64" || exit 1
conda index "$GITHUB_WORKSPACE/channel" || exit 1
# Test channel
conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels --info --json > $GITHUB_WORKSPACE/ver.json
conda search "$PACKAGE_NAME" -c "$GITHUB_WORKSPACE/channel" --override-channels --info --json > "$GITHUB_WORKSPACE/ver.json"
cat ver.json

- name: Collect dependencies
run: |
. $CONDA/etc/profile.d/conda.sh
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
conda create -n ${{ env.TEST_ENV_NAME }} $PACKAGE_NAME=${PACKAGE_VERSION} python=${{ matrix.python }} numpy=${{ matrix.numpy }} $CHANNELS --only-deps --dry-run > lockfile
. "$CONDA/etc/profile.d/conda.sh"
PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")"
export PACKAGE_VERSION
conda create -n "${{ env.TEST_ENV_NAME }}" "${PACKAGE_NAME}=${PACKAGE_VERSION}" "python=${{ matrix.python }}" "numpy=${{ matrix.numpy }}" -c "$GITHUB_WORKSPACE/channel" -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels --only-deps --dry-run > lockfile
cat lockfile

- name: Set pkgs_dirs
Expand All @@ -199,19 +199,19 @@ jobs:

- name: Install mkl_random
run: |
. $CONDA/etc/profile.d/conda.sh
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
conda create -n ${{ env.TEST_ENV_NAME }} $PACKAGE_NAME=${PACKAGE_VERSION} pytest python=${{ matrix.python }} numpy=${{ matrix.numpy }} $CHANNELS
conda activate ${{ env.TEST_ENV_NAME }}
. "$CONDA/etc/profile.d/conda.sh"
PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")"
export PACKAGE_VERSION
conda create -n "${{ env.TEST_ENV_NAME }}" "${PACKAGE_NAME}=${PACKAGE_VERSION}" pytest "python=${{ matrix.python }}" "numpy=${{ matrix.numpy }}" -c "$GITHUB_WORKSPACE/channel" -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels
conda activate "${{ env.TEST_ENV_NAME }}"

# Test installed packages
conda list

- name: Run tests
run: |
. $CONDA/etc/profile.d/conda.sh
conda activate ${{ env.TEST_ENV_NAME }}
. "$CONDA/etc/profile.d/conda.sh"
conda activate "${{ env.TEST_ENV_NAME }}"
pytest -vv --pyargs ${{ env.MODULE_NAME }}

test_windows:
Expand Down Expand Up @@ -255,7 +255,7 @@ jobs:
run: |
mkdir ${{ env.GITHUB_WORKSPACE }}\channel\win-64
move ${{ env.PACKAGE_NAME }}-*.conda ${{ env.GITHUB_WORKSPACE }}\channel\win-64
python -m conda_index ${{ env.GITHUB_WORKSPACE }}/channel
python -m conda_index "${{ env.GITHUB_WORKSPACE }}/channel"

# Test channel
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.GITHUB_WORKSPACE }}/channel --override-channels --info --json > ${{ env.GITHUB_WORKSPACE }}\ver.json
Expand Down Expand Up @@ -305,5 +305,5 @@ jobs:

- name: Run tests
run: |
conda activate -n ${{ env.TEST_ENV_NAME }}
conda activate -n "${{ env.TEST_ENV_NAME }}"
pytest -v --pyargs ${{ env.MODULE_NAME }}
49 changes: 49 additions & 0 deletions .github/workflows/pre-commit-autoupdate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Autoupdate pre-commit

on:
workflow_dispatch:
# To guarantee Maintained check is occasionally updated. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
schedule:
- cron: '28 2 * * 6' # Saturday at 02:28 UTC

permissions: read-all

jobs:
autoupdate:
name: Autoupdate

runs-on: ubuntu-latest
timeout-minutes: 10

permissions:
# Needed to create a PR with autoupdate changes
contents: write
pull-requests: write

steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v5.6.0
with:
python-version: '3.14'

- name: Install pre-commit
run: pip install pre-commit

- name: Run pre-commit autoupdate
run: pre-commit autoupdate

- name: Create a PR with autoupdate changes
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
commit-message: 'chore: update pre-commit hooks'
add-paths: .pre-commit-config.yaml
branch: 'bot/pre-commit-autoupdate'
delete-branch: true
title: Weekly pre-commit autoupdate
body: |
This PR updates the `.pre-commit-config.yaml` using `pre-commit autoupdate`.
labels: autoupdate
Loading
Loading