Skip to content

Commit

Permalink
Merge pull request #319 from MC-kit/devel
Browse files Browse the repository at this point in the history
Suspend MacOS support, stop supporting Python 3.9
  • Loading branch information
dvp2015 authored Jul 24, 2024
2 parents ed8be77 + bbc68cf commit f4e3a12
Show file tree
Hide file tree
Showing 72 changed files with 1,829 additions and 1,791 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ select=ANN,B,B9,BLK,C,D,DAR,E,F,I,N,PD,R,TC,TR,S,W
max-complexity=15
max-mccabe-complexity=6
max-cognitive-complexity=10
max-expression-complexity=10
max-line-length=100
ignore=
# ANN001 Missing type annotation for function argument: doesn't allow to use functools dispatching
Expand Down
4 changes: 2 additions & 2 deletions .github/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pip==23.3.1
poetry==1.7.1
pip==24.1.2
poetry==1.8.3

2 changes: 1 addition & 1 deletion .github/workflows/clean-workflow-logs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
# repo: ${{ github.event.repository.name }}
# days_old: ${{ github.event.inputs.days_old }}
- name: Clean workflow runs
uses: dmvict/clean-workflow-runs@v1.2.1
uses: dmvict/clean-workflow-runs@v1
with:
token: ${{ secrets.MCKIT_GITHUB_TOKEN }}
save_period: 30
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/combine-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
console.log('Combined: ' + combined);
return combined
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- uses: actions/checkout@v4.1.2
with:
fetch-depth: 0
# Creates a branch with other PR branches merged together
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ jobs:
strategy:
matrix:
# ubuntu-20.04 is required to build wheels for older OS (clusters...)
os: [ubuntu-20.04, ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
os: [ubuntu-20.04, ubuntu-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12']
steps:
- name: Check out the repository
uses: actions/checkout@v3.5.3
uses: actions/checkout@v4.1.2
with:
fetch-depth: 1

- name: Checkout submodules
run: git submodule update --init --recursive --depth=1

- name: Set up Python
uses: actions/setup-python@v4.6.1
uses: actions/setup-python@v5.1.0
with:
python-version: ${{ matrix.python-version }}
architecture: x64
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ concurrency:
cancel-in-progress: true

env:
DEFAULT_PYTHON: "3.11"
DEFAULT_PYTHON: "3.12"

jobs:

Expand Down Expand Up @@ -141,8 +141,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
os: [ ubuntu-latest, windows-latest ]
python-version: [ '3.10', '3.11', '3.12' ]

steps:

Expand Down Expand Up @@ -247,3 +247,5 @@ jobs:
- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
48 changes: 26 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# https://github.com/pre-commit/pre-commit for more information
# https://pre-commit.com/hooks.html for more hooks
default_language_version:
python: python3.11
python: python3.12

repos:

Expand All @@ -29,7 +29,7 @@ repos:
- id: check-json
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
exclude: notebooks
exclude: notebooks # jupytext creates python scripts with shebangs but without permissions
- id: check-symlinks
- id: check-toml
- id: check-yaml
Expand Down Expand Up @@ -65,34 +65,38 @@ repos:
exclude: \.idea|\.cache|^notebooks|^extern
entry: pyupgrade
args:
- --py39-plus
- --py310-plus
language: system
types: [ python ]
stages: [ manual ]

# Nicely sort imports
- id: isort
name: isort
exclude: tools|\.idea|\.cache|^notebooks|^extern
entry: isort
# Security check
- id: bandit
name: bandit
entry: bandit
args: ["-c", "pyproject.toml"]
language: system
types: [ python ]
exclude: ^notebooks|^extern
stages: [ manual ]

# Black, the code formatter, natively supports pre-commit
- id: black
name: black
entry: black
# Lint and fix Python code (including import sort)
- id: ruff
name: ruff
entry: ruff check --force-exclude --fix --config pyproject.toml
language: system
types: [ python ]
exclude: ^notebooks|^extern

# Lint and fix Python code
# Format Python code
- id: ruff
name: ruff
entry: ruff --force-exclude --fix --config pyproject.toml
name: ruff-format
entry: ruff format --force-exclude --config pyproject.toml
language: system
types: [ python ]
exclude: ^notebooks|^extern


# CMake formatting
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: "v0.6.13"
Expand All @@ -102,16 +106,16 @@ repos:
types: [ file ]
files: (\.cmake|CMakeLists.txt)(.in)?$

# Check for common shell mistakes
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.9.0.6"
hooks:
- id: shellcheck
stages: [ manual ]

# Clang format the codebase automatically
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: "v17.0.6"
hooks:
- id: clang-format
types_or: [ c++, c, cuda ]

# Check for common shell mistakes
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.9.0.6"
hooks:
- id: shellcheck
stages: [ manual ]
3 changes: 1 addition & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ sphinx:
build:
os: ubuntu-22.04
tools:
python: "3.8"
python: "3.11"

python:
version: "3.8"
install:
- requirements: docs/requirements.txt
- path: .
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
.. image:: https://img.shields.io/github/license/MC-kit/mckit
:target: https://github.com/MC-kit/mckit

.. image:: https://img.shields.io/badge/security-bandit-yellow.svg
:target: https://github.com/PyCQA/bandit
:alt: Security Status


MCKIT: MCNP model and results processing utilities
==================================================
Expand Down
5 changes: 2 additions & 3 deletions adhoc/ep11/verify_co05_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@

import dotenv
import numpy as np
import pandas as pd
import typer

from loguru import logger
from tqdm import tqdm

import pandas as pd
import typer

from mckit.geometry import EX, EY, EZ, Box
from mckit.parser import ParseResult, from_file

Expand Down
19 changes: 2 additions & 17 deletions benchmarks/mckit_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,22 @@

from mckit.utils import get_decades, significant_digits

# def run_digits_in_fraction(a: np.ndarray) -> None:
# map(digits_in_fraction_for_str, a)
#
#
# def test_digits_in_fraction(benchmark):
# values = (np.random.rand(1000) - 0.5) * 1000.0
# benchmark(run_digits_in_fraction, values)

# Name (time in ns) Min Max Mean StdDev Median IQR Outliers OPS (Mops/s) Rounds Iterations
# test_digits_in_fraction 186.9630 720.5936 194.0950 26.6555 190.4080 1.2957 3901;10481 5.1521 192753 27


def run_significant_digits(a: np.ndarray) -> None:
map(significant_digits, a)


def test_significant_digits(benchmark):
values = (np.random.rand(1000) - 0.5) * 1000.0
values = (np.random.default_rng().random(1000) - 0.5) * 1000.0
benchmark(run_significant_digits, values)


# Name (time in ns) Min Max Mean StdDev Median IQR Outliers OPS (Mops/s) Rounds Iterations
# test_significant_digits 185.8118 811.3717 200.8212 30.4897 190.1493 21.4075 2785;2766 4.9796 193839 27


def run_get_decades(a: np.ndarray) -> None:
return np.fromiter(map(get_decades, a), np.int16)


def test_get_decades(benchmark):
values = (np.random.rand(1000) - 0.5) * 1000.0
values = (np.random.default_rng().random(1000) - 0.5) * 1000.0
benchmark(run_get_decades, values)


Expand Down
1 change: 0 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def copy_files(src_dir: Path, dest_dir: Path, pattern: str) -> None:
distutils_log.info(f"copied {src} to {dest}")


#
def save_setup_kwargs(setup_kwargs: dict[str, Any]) -> None:
"""Save resulting setup_kwargs for examining."""
kwargs_path = Path(__file__).parent / "poetry_setup_kwargs.txt"
Expand Down
2 changes: 1 addition & 1 deletion extern/nlopt
Loading

0 comments on commit f4e3a12

Please sign in to comment.