kernelforge 0.1.13__tar.gz → 0.1.16__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. kernelforge-0.1.16/.clang-format +84 -0
  2. kernelforge-0.1.16/.clang-tidy +60 -0
  3. kernelforge-0.1.16/.github/workflows/code-quality.yml +41 -0
  4. {kernelforge-0.1.13 → kernelforge-0.1.16}/.github/workflows/release.yaml +2 -1
  5. {kernelforge-0.1.13 → kernelforge-0.1.16}/.gitignore +2 -2
  6. kernelforge-0.1.16/.pre-commit-config.yaml +46 -0
  7. {kernelforge-0.1.13 → kernelforge-0.1.16}/CMakeLists.txt +47 -0
  8. {kernelforge-0.1.13 → kernelforge-0.1.16}/Makefile +19 -0
  9. {kernelforge-0.1.13 → kernelforge-0.1.16}/PKG-INFO +8 -2
  10. {kernelforge-0.1.13 → kernelforge-0.1.16}/environments/environment-dev-macos.yaml +2 -2
  11. kernelforge-0.1.16/pyproject.toml +130 -0
  12. kernelforge-0.1.16/python/kernelforge/__init__.py +8 -0
  13. kernelforge-0.1.16/python/kernelforge/cli.py +415 -0
  14. kernelforge-0.1.16/src/aligned_alloc64.hpp +34 -0
  15. kernelforge-0.1.16/src/bindings.cpp +99 -0
  16. {kernelforge-0.1.13 → kernelforge-0.1.16}/src/bindings_cholesky.cpp +74 -75
  17. kernelforge-0.1.16/src/bindings_fchl19.cpp +861 -0
  18. {kernelforge-0.1.13 → kernelforge-0.1.16}/src/bindings_kernels.cpp +115 -134
  19. kernelforge-0.1.16/src/cholesky.cpp +182 -0
  20. kernelforge-0.1.16/src/cholesky.hpp +17 -0
  21. kernelforge-0.1.16/src/constants.hpp +22 -0
  22. kernelforge-0.1.16/src/fchl19_representation.cpp +2149 -0
  23. kernelforge-0.1.16/src/fchl19_representation.hpp +114 -0
  24. {kernelforge-0.1.13 → kernelforge-0.1.16}/src/invdist.cpp +14 -20
  25. {kernelforge-0.1.13 → kernelforge-0.1.16}/src/invdist.hpp +5 -12
  26. {kernelforge-0.1.13 → kernelforge-0.1.16}/src/invdist_bindings.cpp +24 -32
  27. kernelforge-0.1.16/src/kernels.cpp +495 -0
  28. kernelforge-0.1.16/src/kernels.hpp +27 -0
  29. {kernelforge-0.1.13 → kernelforge-0.1.16}/tests/test_cholesky.py +5 -12
  30. {kernelforge-0.1.13 → kernelforge-0.1.16}/tests/test_fchl19.py +128 -67
  31. {kernelforge-0.1.13 → kernelforge-0.1.16}/tests/test_fchl19_gradient.py +1 -2
  32. {kernelforge-0.1.13 → kernelforge-0.1.16}/tests/test_hessian.py +16 -14
  33. {kernelforge-0.1.13 → kernelforge-0.1.16}/tests/test_invdist.py +1 -2
  34. {kernelforge-0.1.13 → kernelforge-0.1.16}/tests/test_jacobian.py +1 -2
  35. {kernelforge-0.1.13 → kernelforge-0.1.16}/tests/test_kernels.py +17 -8
  36. {kernelforge-0.1.13 → kernelforge-0.1.16}/tests/test_rfp.py +6 -6
  37. kernelforge-0.1.16/wheelhouse/kernelforge-0.1.16-cp311-cp311-macosx_15_0_arm64.whl +0 -0
  38. kernelforge-0.1.16/wheelhouse/kernelforge-0.1.16-cp312-cp312-macosx_15_0_arm64.whl +0 -0
  39. kernelforge-0.1.16/wheelhouse/kernelforge-0.1.16-cp313-cp313-macosx_15_0_arm64.whl +0 -0
  40. kernelforge-0.1.13/pyproject.toml +0 -35
  41. kernelforge-0.1.13/python/kernelforge/__init__.py +0 -0
  42. kernelforge-0.1.13/src/aligned_alloc64.hpp +0 -31
  43. kernelforge-0.1.13/src/bindings.cpp +0 -114
  44. kernelforge-0.1.13/src/bindings_fchl19.cpp +0 -912
  45. kernelforge-0.1.13/src/cholesky.cpp +0 -232
  46. kernelforge-0.1.13/src/cholesky.hpp +0 -22
  47. kernelforge-0.1.13/src/fchl19_representation.cpp +0 -1984
  48. kernelforge-0.1.13/src/fchl19_representation.hpp +0 -173
  49. kernelforge-0.1.13/src/kernels.cpp +0 -1287
  50. kernelforge-0.1.13/src/kernels.hpp +0 -55
  51. kernelforge-0.1.13/wheelhouse/kernelforge-0.1.13-cp310-cp310-macosx_15_0_arm64.whl +0 -0
  52. kernelforge-0.1.13/wheelhouse/kernelforge-0.1.13-cp311-cp311-macosx_15_0_arm64.whl +0 -0
  53. kernelforge-0.1.13/wheelhouse/kernelforge-0.1.13-cp312-cp312-macosx_15_0_arm64.whl +0 -0
  54. kernelforge-0.1.13/wheelhouse/kernelforge-0.1.13-cp313-cp313-macosx_15_0_arm64.whl +0 -0
  55. {kernelforge-0.1.13 → kernelforge-0.1.16}/.github/workflows/ci.yml +0 -0
  56. {kernelforge-0.1.13 → kernelforge-0.1.16}/LICENSE +0 -0
  57. {kernelforge-0.1.13 → kernelforge-0.1.16}/README.md +0 -0
  58. {kernelforge-0.1.13 → kernelforge-0.1.16}/environments/environment-dev.yaml +0 -0
  59. {kernelforge-0.1.13 → kernelforge-0.1.16}/examples/desc_hess-gauss.ipynb +0 -0
  60. {kernelforge-0.1.13 → kernelforge-0.1.16}/examples/desc_hess.ipynb +0 -0
  61. {kernelforge-0.1.13 → kernelforge-0.1.16}/examples/ethanol.sdf +0 -0
  62. {kernelforge-0.1.13 → kernelforge-0.1.16}/examples/fchl_example.ipynb +0 -0
  63. {kernelforge-0.1.13 → kernelforge-0.1.16}/examples/fchl_hess.ipynb +0 -0
  64. {kernelforge-0.1.13 → kernelforge-0.1.16}/examples/qm7_example.ipynb +0 -0
  65. {kernelforge-0.1.13 → kernelforge-0.1.16}/examples/regression_ethanol-Copy1.ipynb +0 -0
  66. {kernelforge-0.1.13 → kernelforge-0.1.16}/examples/regression_forces.ipynb +0 -0
  67. {kernelforge-0.1.13 → kernelforge-0.1.16}/examples/sgdml.ipynb +0 -0
  68. {kernelforge-0.1.13 → kernelforge-0.1.16}/pytest.ini +0 -0
@@ -0,0 +1,84 @@
1
+ ---
2
+ # KernelForge C++ Code Style Configuration
3
+ # Based on Google style with customizations
4
+
5
+ BasedOnStyle: Google
6
+
7
+ # Core formatting preferences
8
+ IndentWidth: 4
9
+ ColumnLimit: 100
10
+ DerivePointerAlignment: false
11
+ PointerAlignment: Right # int *ptr style
12
+ UseTab: Never
13
+
14
+ # Indentation
15
+ AccessModifierOffset: -4
16
+ IndentCaseLabels: true
17
+ NamespaceIndentation: None
18
+ IndentPPDirectives: BeforeHash
19
+
20
+ # Alignment
21
+ AlignAfterOpenBracket: Align
22
+ AlignConsecutiveAssignments: None
23
+ AlignConsecutiveDeclarations: None
24
+ AlignOperands: Align
25
+ AlignTrailingComments: true
26
+
27
+ # Line breaks
28
+ AllowShortFunctionsOnASingleLine: Inline
29
+ AllowShortIfStatementsOnASingleLine: Never
30
+ AllowShortLoopsOnASingleLine: false
31
+ AllowShortBlocksOnASingleLine: Never
32
+ AllowShortCaseLabelsOnASingleLine: false
33
+ AlwaysBreakAfterReturnType: None
34
+ AlwaysBreakBeforeMultilineStrings: false
35
+
36
+ # Braces (K&R style)
37
+ BreakBeforeBraces: Attach
38
+ BraceWrapping:
39
+ AfterClass: false
40
+ AfterControlStatement: Never
41
+ AfterEnum: false
42
+ AfterFunction: false
43
+ AfterNamespace: false
44
+ AfterStruct: false
45
+ AfterUnion: false
46
+ BeforeCatch: false
47
+ BeforeElse: false
48
+
49
+ # Spaces
50
+ SpaceAfterCStyleCast: false
51
+ SpaceBeforeAssignmentOperators: true
52
+ SpaceBeforeParens: ControlStatements
53
+ SpacesInParentheses: false
54
+ SpacesInAngles: Never
55
+ SpacesInSquareBrackets: false
56
+
57
+ # Includes
58
+ SortIncludes: true
59
+ IncludeBlocks: Regroup
60
+ IncludeCategories:
61
+ # Own headers first
62
+ - Regex: '^".*\.h(pp)?"$'
63
+ Priority: 1
64
+ # C system headers
65
+ - Regex: '^<[a-z_]+\.h>$'
66
+ Priority: 2
67
+ # C++ standard library
68
+ - Regex: '^<[a-z_]+>$'
69
+ Priority: 3
70
+ # Third-party libraries (BLAS, OpenMP, pybind11)
71
+ - Regex: '^<(cblas|omp|pybind11|Accelerate).*>$'
72
+ Priority: 4
73
+ # Everything else
74
+ - Regex: '.*'
75
+ Priority: 5
76
+
77
+ # Language
78
+ Language: Cpp
79
+ Standard: c++17
80
+
81
+ # Other
82
+ MaxEmptyLinesToKeep: 1
83
+ KeepEmptyLinesAtTheStartOfBlocks: false
84
+ ReflowComments: true
@@ -0,0 +1,60 @@
1
+ ---
2
+ # KernelForge C++ Static Analysis Configuration
3
+ # Moderate checks for code quality without being overly restrictive
4
+
5
+ Checks: >
6
+ bugprone-*,
7
+ clang-analyzer-*,
8
+ cppcoreguidelines-*,
9
+ modernize-*,
10
+ performance-*,
11
+ readability-*,
12
+ -bugprone-easily-swappable-parameters,
13
+ -bugprone-implicit-widening-of-multiplication-result,
14
+ -modernize-use-trailing-return-type,
15
+ -modernize-avoid-c-arrays,
16
+ -readability-identifier-length,
17
+ -readability-function-cognitive-complexity,
18
+ -readability-magic-numbers,
19
+ -cppcoreguidelines-avoid-magic-numbers,
20
+ -cppcoreguidelines-pro-bounds-pointer-arithmetic,
21
+ -cppcoreguidelines-pro-type-reinterpret-cast,
22
+ -cppcoreguidelines-pro-type-const-cast,
23
+ -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
24
+ -cppcoreguidelines-avoid-const-or-ref-data-members,
25
+ -cppcoreguidelines-owning-memory,
26
+ -cppcoreguidelines-no-malloc,
27
+ -performance-no-int-to-ptr
28
+
29
+ CheckOptions:
30
+ # Naming conventions - snake_case for most things
31
+ - key: readability-identifier-naming.NamespaceCase
32
+ value: lower_case
33
+ - key: readability-identifier-naming.ClassCase
34
+ value: CamelCase
35
+ - key: readability-identifier-naming.StructCase
36
+ value: CamelCase
37
+ - key: readability-identifier-naming.FunctionCase
38
+ value: snake_case
39
+ - key: readability-identifier-naming.VariableCase
40
+ value: snake_case
41
+ - key: readability-identifier-naming.ParameterCase
42
+ value: snake_case
43
+ - key: readability-identifier-naming.ConstantCase
44
+ value: UPPER_CASE
45
+ - key: readability-identifier-naming.EnumConstantCase
46
+ value: UPPER_CASE
47
+ - key: readability-identifier-naming.GlobalConstantCase
48
+ value: UPPER_CASE
49
+
50
+ # Make some checks less aggressive
51
+ - key: readability-function-size.LineThreshold
52
+ value: '200'
53
+ - key: readability-function-size.StatementThreshold
54
+ value: '150'
55
+ - key: cppcoreguidelines-avoid-do-while.MaxStatements
56
+ value: '10'
57
+
58
+ WarningsAsErrors: ''
59
+ HeaderFilterRegex: 'src/.*\.(h|hpp)$'
60
+ FormatStyle: file # Use .clang-format
@@ -0,0 +1,41 @@
1
+ name: Code Quality
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ code-quality:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install black isort ruff mypy
28
+ pip install numpy pytest
29
+
30
+ - name: Check formatting with Black
31
+ run: black --check python/ tests/
32
+
33
+ - name: Check import sorting with isort
34
+ run: isort --check-only python/ tests/
35
+
36
+ - name: Lint with Ruff
37
+ run: ruff check python/ tests/
38
+
39
+ - name: Type check with mypy
40
+ run: mypy python/ tests/
41
+ continue-on-error: true # Don't fail CI on mypy errors initially
@@ -16,6 +16,8 @@ jobs:
16
16
 
17
17
  steps:
18
18
  - uses: actions/checkout@v4
19
+ with:
20
+ fetch-depth: 0 # Fetch all history for setuptools-scm to detect version from tags
19
21
 
20
22
  - uses: actions/setup-python@v5
21
23
  with:
@@ -105,4 +107,3 @@ jobs:
105
107
  - uses: pypa/gh-action-pypi-publish@v1.11.0
106
108
  with:
107
109
  packages-dir: dist/flat
108
-
@@ -185,9 +185,9 @@ cython_debug/
185
185
  .abstra/
186
186
 
187
187
  # Visual Studio Code
188
- # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
188
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
189
189
  # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
190
- # and can be added to the global gitignore or merged into this file. However, if you prefer,
190
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
191
191
  # you could uncomment the following to ignore the entire vscode folder
192
192
  # .vscode/
193
193
 
@@ -0,0 +1,46 @@
1
+ # Pre-commit hooks for code quality
2
+ # See https://pre-commit.com for more information
3
+
4
+ repos:
5
+ - repo: https://github.com/pre-commit/pre-commit-hooks
6
+ rev: v4.5.0
7
+ hooks:
8
+ - id: trailing-whitespace
9
+ - id: end-of-file-fixer
10
+ - id: check-yaml
11
+ - id: check-added-large-files
12
+ - id: check-merge-conflict
13
+ - id: mixed-line-ending
14
+
15
+ - repo: https://github.com/psf/black
16
+ rev: 24.2.0
17
+ hooks:
18
+ - id: black
19
+
20
+ - repo: https://github.com/pycqa/isort
21
+ rev: 5.13.2
22
+ hooks:
23
+ - id: isort
24
+ args: ["--profile", "black"]
25
+
26
+ - repo: https://github.com/astral-sh/ruff-pre-commit
27
+ rev: v0.3.0
28
+ hooks:
29
+ - id: ruff
30
+ args: [--fix, --exit-non-zero-on-fix]
31
+
32
+ - repo: https://github.com/pre-commit/mirrors-clang-format
33
+ rev: v19.1.6
34
+ hooks:
35
+ - id: clang-format
36
+ types_or: [c++, c]
37
+ files: ^src/.*\.(cpp|hpp|h|cc|cxx)$
38
+
39
+ # Mypy disabled in pre-commit (run manually with: pre-commit run mypy --all-files --hook-stage manual)
40
+ # - repo: https://github.com/pre-commit/mirrors-mypy
41
+ # rev: v1.9.0
42
+ # hooks:
43
+ # - id: mypy
44
+ # additional_dependencies: [numpy>=2.0, types-psutil]
45
+ # args: [--ignore-missing-imports]
46
+ # files: ^(python|tests|benchmark)/.*\.py$
@@ -1,6 +1,11 @@
1
1
  cmake_minimum_required(VERSION 3.18)
2
2
  project(kernelforge LANGUAGES C CXX)
3
3
 
4
+ # C++ standard
5
+ set(CMAKE_CXX_STANDARD 17)
6
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
7
+ set(CMAKE_CXX_EXTENSIONS OFF)
8
+
4
9
  # Platform tweaks
5
10
  if(APPLE)
6
11
 
@@ -136,3 +141,45 @@ install(TARGETS _kernels _invdist _fchl19 _cholesky
136
141
  RUNTIME DESTINATION kernelforge # Windows (.pyd)
137
142
  )
138
143
  install(FILES python/kernelforge/__init__.py DESTINATION kernelforge)
144
+
145
+ # ---- Development targets -----------------------------------------------------
146
+ # Collect all C++ source files
147
+ file(GLOB_RECURSE KF_CXX_SOURCES
148
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp
149
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp
150
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h
151
+ )
152
+
153
+ # clang-format target
154
+ find_program(CLANG_FORMAT_EXE NAMES clang-format)
155
+ if(CLANG_FORMAT_EXE)
156
+ add_custom_target(format
157
+ COMMAND ${CLANG_FORMAT_EXE} -i ${KF_CXX_SOURCES}
158
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
159
+ COMMENT "Running clang-format on all C++ source files"
160
+ VERBATIM
161
+ )
162
+ else()
163
+ add_custom_target(format
164
+ COMMAND ${CMAKE_COMMAND} -E echo "clang-format not found. Please install it to use this target."
165
+ COMMENT "clang-format not available"
166
+ )
167
+ endif()
168
+
169
+ # clang-tidy target
170
+ find_program(CLANG_TIDY_EXE NAMES clang-tidy)
171
+ if(CLANG_TIDY_EXE)
172
+ add_custom_target(tidy
173
+ COMMAND ${CLANG_TIDY_EXE} ${KF_CXX_SOURCES} --
174
+ -std=c++17
175
+ -I${CMAKE_CURRENT_SOURCE_DIR}/src
176
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
177
+ COMMENT "Running clang-tidy on all C++ source files"
178
+ VERBATIM
179
+ )
180
+ else()
181
+ add_custom_target(tidy
182
+ COMMAND ${CMAKE_COMMAND} -E echo "clang-tidy not found. Please install it to use this target."
183
+ COMMENT "clang-tidy not available"
184
+ )
185
+ endif()
@@ -10,3 +10,22 @@ test:
10
10
  environment:
11
11
  uv venv --python 3.14
12
12
  uv pip install scikit-build-core pybind11
13
+
14
+ # Code quality targets
15
+ .PHONY: format lint typecheck check
16
+
17
+ format:
18
+ black python/ tests/
19
+ isort python/ tests/
20
+
21
+ lint:
22
+ ruff check python/ tests/
23
+
24
+ lint-fix:
25
+ ruff check --fix python/ tests/
26
+
27
+ typecheck:
28
+ mypy python/ tests/
29
+
30
+ check: format lint typecheck
31
+ @echo "All code quality checks passed!"
@@ -1,18 +1,24 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: kernelforge
3
- Version: 0.1.13
3
+ Version: 0.1.16
4
4
  Summary: Optimized Kernels for ML
5
5
  Author: Anders Christensen
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/andersx/kernelforge
8
8
  Project-URL: Issues, https://github.com/andersx/kernelforge/issues
9
- Requires-Python: >=3.10
9
+ Requires-Python: >=3.11
10
10
  Requires-Dist: numpy>=2.00
11
11
  Provides-Extra: test
12
12
  Requires-Dist: pytest>=8; extra == "test"
13
13
  Requires-Dist: pytest-xdist; extra == "test"
14
14
  Requires-Dist: pytest-cov; extra == "test"
15
15
  Requires-Dist: pytest-timeout; extra == "test"
16
+ Provides-Extra: dev
17
+ Requires-Dist: black>=24.0.0; extra == "dev"
18
+ Requires-Dist: isort>=5.13.0; extra == "dev"
19
+ Requires-Dist: ruff>=0.3.0; extra == "dev"
20
+ Requires-Dist: mypy>=1.9.0; extra == "dev"
21
+ Requires-Dist: pre-commit>=3.6.0; extra == "dev"
16
22
  Description-Content-Type: text/markdown
17
23
 
18
24
  # KernelForge - Optimized Kernels for ML
@@ -28,6 +28,6 @@ dependencies:
28
28
  - pytest-cov
29
29
  - pytest-xdist
30
30
  - pytest-timeout
31
- - clang_arm64
32
- - clangxx_arm64
31
+ - clang_arm64
32
+ - clangxx_arm64
33
33
  - llvm-openmp
@@ -0,0 +1,130 @@
1
+ [build-system]
2
+ requires = ["scikit-build-core>=0.9", "setuptools-scm>=8.0", "pybind11", "setuptools", "wheel"]
3
+ build-backend = "scikit_build_core.build"
4
+
5
+ [project]
6
+ name = "kernelforge"
7
+ dynamic = ["version"]
8
+ description = "Optimized Kernels for ML"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [{name = "Anders Christensen"}]
12
+ requires-python = ">=3.11"
13
+ dependencies = [
14
+ "numpy>=2.00",
15
+ ]
16
+
17
+ [project.optional-dependencies]
18
+ test = ["pytest>=8", "pytest-xdist", "pytest-cov", "pytest-timeout"]
19
+ dev = [
20
+ "black>=24.0.0",
21
+ "isort>=5.13.0",
22
+ "ruff>=0.3.0",
23
+ "mypy>=1.9.0",
24
+ "pre-commit>=3.6.0",
25
+ ]
26
+
27
+ [project.scripts]
28
+ qmlbench = "kernelforge.cli:main"
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/andersx/kernelforge"
32
+ Issues = "https://github.com/andersx/kernelforge/issues"
33
+
34
+ [tool.scikit-build]
35
+ wheel.expand-macos-universal-tags = true
36
+ cmake.build-type = "Release"
37
+ build.verbose = true
38
+ wheel.packages = ["python/kernelforge"]
39
+
40
+ [tool.scikit-build.metadata.version]
41
+ provider = "scikit_build_core.metadata.setuptools_scm"
42
+
43
+ [tool.scikit-build.cmake.define]
44
+ CMAKE_VERBOSE_MAKEFILE = "ON"
45
+ CMAKE_BUILD_TYPE = "Release"
46
+
47
+ [tool.uv.extra-build-dependencies]
48
+ kernelforge = ["scikit_build_core"]
49
+
50
+ [tool.setuptools_scm]
51
+ # Use git tags with 'v' prefix (e.g., v0.1.14)
52
+ version_scheme = "python-simplified-semver"
53
+ local_scheme = "no-local-version"
54
+ tag_regex = "^v?(?P<version>[0-9.]+)$"
55
+ fallback_version = "0.0.0.dev0"
56
+
57
+ [tool.black]
58
+ line-length = 100
59
+ target-version = ["py311", "py312"] # Black doesn't support py313/py314 yet
60
+ exclude = '''
61
+ /(
62
+ \.git
63
+ | \.venv
64
+ | _build
65
+ | build
66
+ | dist
67
+ )/
68
+ '''
69
+
70
+ [tool.isort]
71
+ profile = "black"
72
+ line_length = 100
73
+ multi_line_output = 3
74
+ include_trailing_comma = true
75
+ force_grid_wrap = 0
76
+ use_parentheses = true
77
+ ensure_newline_before_comments = true
78
+ skip_gitignore = true
79
+
80
+ [tool.ruff]
81
+ line-length = 100
82
+ target-version = "py311"
83
+ exclude = [
84
+ ".git",
85
+ ".venv",
86
+ "__pycache__",
87
+ "build",
88
+ "dist",
89
+ ]
90
+
91
+ [tool.ruff.lint]
92
+ select = [
93
+ "E", # pycodestyle errors
94
+ "W", # pycodestyle warnings
95
+ "F", # pyflakes
96
+ "N", # pep8-naming
97
+ "UP", # pyupgrade
98
+ "B", # flake8-bugbear
99
+ "C4", # flake8-comprehensions
100
+ "PTH", # flake8-use-pathlib
101
+ ]
102
+ ignore = [
103
+ "E501", # line too long (handled by black)
104
+ "B008", # do not perform function calls in argument defaults
105
+ "PTH123", # use pathlib for open (not always needed)
106
+ ]
107
+
108
+ [tool.ruff.lint.per-file-ignores]
109
+ "tests/*" = ["F401", "F811", "N803", "N806", "F841", "B017", "B023", "C408"] # Test-specific ignores
110
+ "python/kernelforge/cli.py" = ["N806", "F841", "B905"] # CLI benchmarking code - allow scientific variable names
111
+
112
+ [tool.mypy]
113
+ python_version = "3.11"
114
+ warn_return_any = true
115
+ warn_unused_configs = true
116
+ disallow_untyped_defs = true
117
+ check_untyped_defs = true
118
+ warn_redundant_casts = true
119
+ warn_unused_ignores = true
120
+ warn_no_return = true
121
+ strict_optional = true
122
+ no_implicit_optional = true
123
+
124
+ [[tool.mypy.overrides]]
125
+ module = ["numpy.*", "pytest.*", "typer.*", "psutil.*", "cpuinfo.*"]
126
+ ignore_missing_imports = true
127
+
128
+ [[tool.mypy.overrides]]
129
+ module = "kernelforge.*"
130
+ ignore_errors = true
@@ -0,0 +1,8 @@
1
+ """KernelForge - Optimized kernels for machine learning."""
2
+
3
+ try:
4
+ from importlib.metadata import version
5
+
6
+ __version__ = version("kernelforge")
7
+ except Exception:
8
+ __version__ = "unknown"