From 009c28d4500a5aa6a1ff061b51e20150add70162 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Thu, 26 Feb 2026 18:21:05 -0500 Subject: [PATCH 01/42] Unify ruff config across sub-repos Merge cuda_pathfinder's [tool.ruff] into the top-level ruff.toml and remove the duplicate. The unified config is the union of all lint rules (adding ARG, Q, N, C4, PIE, T20, RUF, PT, DTZ) with sane per-file ignores for tests, examples, benchmarks, scripts, and CUDA naming conventions in cuda_bindings. Made-with: Cursor --- cuda_pathfinder/pyproject.toml | 41 ------------ ruff.toml | 119 ++++++++++++++++++++++++++------- 2 files changed, 93 insertions(+), 67 deletions(-) diff --git a/cuda_pathfinder/pyproject.toml b/cuda_pathfinder/pyproject.toml index 43c0090785..21299d3366 100644 --- a/cuda_pathfinder/pyproject.toml +++ b/cuda_pathfinder/pyproject.toml @@ -85,47 +85,6 @@ git_describe_command = [ "git", "describe", "--dirty", "--tags", "--long", "--ma [tool.pytest.ini_options] addopts = "--showlocals" -[tool.ruff] -line-length = 120 -preview = true - -[tool.ruff.format] -docstring-code-format = true - -[tool.ruff.lint] -select = [ - "E", # pycodestyle Error - "F", # Pyflakes - "W", # pycodestyle Warning - "UP", # pyupgrade - "B", # flake8-bugbear - "SIM", # flake8-simplify - "I", # isort - "ARG", # flake8-unused-arguments - "Q", # flake8-quotes - "N", # pep8-naming - "C4", # flake8-comprehensions - "PIE", # flake8-pie - "T20", # flake8-print - "RUF", # Ruff-specific rules - "PT", # flake8-pytest-style - "DTZ", # flake8-datetimez - "S", -] -extend-select = ["B9"] - -ignore = [ - "S101", # asserts - "S311", # allow use of the random.* even though many are not cryptographically secure - "S404", # allow importing the subprocess module -] - -[tool.ruff.lint.flake8-quotes] -inline-quotes = "double" - -[tool.ruff.lint.per-file-ignores] -"tests/**/*" = ["S101"] - [tool.mypy] # Basic settings python_version = "3.10" diff --git a/ruff.toml b/ruff.toml index beef9d07e0..3002e2d05f 100644 --- a/ruff.toml +++ b/ruff.toml @@ -6,18 +6,19 @@ respect-gitignore = true target-version = "py310" [format] +indent-style = "space" +quote-style = "double" docstring-code-format = true -docstring-code-line-length = 120 +docstring-code-line-length = "dynamic" exclude = ["**/_version.py"] [lint] select = [ - # pycodestyle Error + # pycodestyle "E", + "W", # Pyflakes "F", - # pycodestyle Warning - "W", # pyupgrade "UP", # flake8-bugbear @@ -26,41 +27,107 @@ select = [ "SIM", # isort "I", - # flake8 bandit + # flake8-bandit "S", + # flake8-unused-arguments + "ARG", + # flake8-quotes + "Q", + # pep8-naming + "N", + # flake8-comprehensions + "C4", + # flake8-pie + "PIE", + # flake8-print + "T20", + # Ruff-specific rules + "RUF", + # flake8-pytest-style + "PT", + # flake8-datetimez + "DTZ", ] ignore = [ - "UP007", - "E741", # ambiguous variable name such as I - "B007", # rename unused loop variable to _name - "UP035", # UP006, UP007, UP035 complain about deprecated Typing. use, but disregard backward compatibility of python version - "UP006", # leave old-style typing as-is, e.g., Dict is allowed instead of requiring dict - "SIM108", # ternary if/else + # typing backward compat — support older Python versions + "UP006", # non-pep585-annotation (e.g. Dict vs dict) + "UP007", # non-pep604-annotation (e.g. Union[X, Y] vs X | Y) + "UP035", # deprecated-import from typing + + # security rules too strict for this project "S101", # asserts - "S311", # allow use of the random.* even though many are not cryptographically secure - "S404", # allow importing the subprocess module - "B905", # preserve the default behavior of `zip` without the explicit `strict` argument + "S311", # allow random.* (not cryptographic) + "S404", # allow subprocess imports + + # style preferences + "E501", # line too long (formatter handles what it can; the rest is intentional) + "E741", # ambiguous variable name (I, l, O) + "B007", # unused loop control variable + "B905", # zip without explicit strict + "SIM108", # ternary if/else ] exclude = ["**/_version.py"] +[lint.isort] +known-first-party = ["cuda"] +combine-as-imports = true + +[lint.flake8-quotes] +inline-quotes = "double" + [lint.per-file-ignores] "__init__.py" = ["F401"] "setup.py" = ["F401"] -"cuda_bindings/examples/**" = [ - "E501", # line too long +"**/tests/**" = [ + "T201", # print + "ARG001", # unused function argument (fixtures) + "ARG002", # unused method argument + "RUF059", # unused unpacked variable (side-effect assignments) + "F841", # unused local variable (side-effect assignments) + "E402", # module-level import not at top of file + "N801", # CUDA naming conventions in tests + "N802", + "N803", + "N806", + "N816", + "PT006", # pytest.mark.parametrize names type + "PT007", # pytest.mark.parametrize values type + "PT011", # pytest.raises too broad + "PT012", # pytest.raises with multiple statements + "PT014", # duplicate parametrize test cases + "PT018", # composite assertion + "RUF005", # collection literal concatenation + "RUF043", # pytest.raises ambiguous regex pattern + "RUF003", # ambiguous unicode character in comment +] + +"**/examples/**" = [ + "T201", # print + "E402", # module-level import not at top of file + "RUF059", # unused unpacked variable ] -"cuda_bindings/tests/**" = [ - "UP022", - "E402", # module level import not at top of file - "F841", -] # F841 complains about unused variables, but some assignments have side-effects that could be useful for tests (func calls for example) +"**/benchmarks/**" = [ + "T201", # print + "RUF059", # unused unpacked variable + "F841", # unused local variable + "E402", # module-level import not at top of file +] + +# CUDA bindings mirror C API naming conventions (CamelCase types, camelCase functions) +"cuda_bindings/**" = [ + "N801", # invalid-class-name + "N802", # invalid-function-name + "N803", # invalid-argument-name + "N806", # non-lowercase-variable-in-function + "N816", # mixed-case-variable-in-global-scope +] -"cuda_bindings/benchmarks/**" = [ - "UP022", - "E402", # module level import not at top of file - "F841", -] # F841 complains about unused variables, but some assignments have side-effects that could be useful for tests (func calls for example) +# scripts and build tooling — print is the expected output method +"toolshed/**" = ["T201"] +"ci/**" = ["T201"] +"**/build_hooks.py" = ["T201"] +"**/docs/**/conf.py" = ["T201", "ARG001"] From 13d6ccbae8857361e00e51ef3ddd58e934f0378e Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Thu, 26 Feb 2026 18:21:17 -0500 Subject: [PATCH 02/42] Add ruff to pixi dependencies Made-with: Cursor --- pixi.lock | 941 +++++++++++++++++++++++++++++++++++++++++++++++++++++- pixi.toml | 3 + 2 files changed, 940 insertions(+), 4 deletions(-) diff --git a/pixi.lock b/pixi.lock index fa9b0c1c11..d0ee4cc5a4 100644 --- a/pixi.lock +++ b/pixi.lock @@ -5,17 +5,950 @@ environments: - url: https://conda.anaconda.org/conda-forge/ options: pypi-prerelease-mode: if-necessary-or-explicit - packages: {} + packages: + linux-64: + - conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_9.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/icu-78.2-h33c6efd_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45.1-default_hbd61a6d_101.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.4-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h3435931_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.2.0-h69a702a_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.2-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnsl-2.0.1-hb9d3cd8_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.51.2-hf4e2dac_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.41.3-h5347b49_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libxcrypt-4.4.36-hd590300_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h2d0b736_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.1-h35e630c_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.10.19-h3c07f61_3_cpython.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.10-8_cp310.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.3-h853b02a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ruff-0.15.3-h40fa522_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h366c992_103.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_6.conda + linux-aarch64: + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/bzip2-1.0.8-h4777abc_9.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/icu-78.2-hb1525cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ld_impl_linux-aarch64-2.45.1-default_h1979696_101.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libexpat-2.7.4-hfae3067_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libffi-3.5.2-h376a255_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-15.2.0-h8acb6b2_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-ng-15.2.0-he9431aa_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgomp-15.2.0-h8acb6b2_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liblzma-5.8.2-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnsl-2.0.1-h86ecc28_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsqlite-3.51.2-h10b116e_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libstdcxx-15.2.0-hef695bb_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libuuid-2.41.3-h1022ec0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxcrypt-4.4.36-h31becfc_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libzlib-1.3.1-h86ecc28_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ncurses-6.5-ha32ae93_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/openssl-3.6.1-h546c87b_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/python-3.10.19-h28be5d3_3_cpython.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.10-8_cp310.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/readline-8.3-hb682ff5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ruff-0.15.3-he9a2e21_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/tk-8.6.13-noxft_h0dc03b3_103.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/zstd-1.5.7-h85ac4a6_6.conda + win-64: + - conda: https://conda.anaconda.org/conda-forge/win-64/bzip2-1.0.8-h0ad9c76_9.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-h4c7d964_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libexpat-2.7.4-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libffi-3.5.2-h3d046cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/liblzma-5.8.2-hfd05255_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libsqlite-3.51.2-hf5d6505_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libzlib-1.3.1-h2466b09_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/openssl-3.6.1-hf411b9b_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/python-3.10.19-hc20f281_3_cpython.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.10-8_cp310.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/ruff-0.15.3-h5739096_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/tk-8.6.13-h6ed50ae_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/ucrt-10.0.26100.0-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vc-14.3-h41ae7f8_34.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vc14_runtime-14.44.35208-h818238b_34.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vcomp14-14.44.35208-h818238b_34.conda cu13: channels: - url: https://conda.anaconda.org/conda-forge/ options: pypi-prerelease-mode: if-necessary-or-explicit - packages: {} + packages: + linux-64: + - conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_9.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/icu-78.2-h33c6efd_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45.1-default_hbd61a6d_101.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.4-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h3435931_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.2.0-h69a702a_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.2-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnsl-2.0.1-hb9d3cd8_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.51.2-hf4e2dac_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.41.3-h5347b49_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libxcrypt-4.4.36-hd590300_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h2d0b736_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.1-h35e630c_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.10.19-h3c07f61_3_cpython.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.10-8_cp310.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.3-h853b02a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ruff-0.15.3-h40fa522_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h366c992_103.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_6.conda + linux-aarch64: + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/bzip2-1.0.8-h4777abc_9.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/icu-78.2-hb1525cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ld_impl_linux-aarch64-2.45.1-default_h1979696_101.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libexpat-2.7.4-hfae3067_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libffi-3.5.2-h376a255_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-15.2.0-h8acb6b2_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-ng-15.2.0-he9431aa_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgomp-15.2.0-h8acb6b2_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liblzma-5.8.2-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnsl-2.0.1-h86ecc28_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsqlite-3.51.2-h10b116e_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libstdcxx-15.2.0-hef695bb_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libuuid-2.41.3-h1022ec0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxcrypt-4.4.36-h31becfc_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libzlib-1.3.1-h86ecc28_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ncurses-6.5-ha32ae93_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/openssl-3.6.1-h546c87b_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/python-3.10.19-h28be5d3_3_cpython.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.10-8_cp310.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/readline-8.3-hb682ff5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ruff-0.15.3-he9a2e21_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/tk-8.6.13-noxft_h0dc03b3_103.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/zstd-1.5.7-h85ac4a6_6.conda + win-64: + - conda: https://conda.anaconda.org/conda-forge/win-64/bzip2-1.0.8-h0ad9c76_9.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-h4c7d964_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libexpat-2.7.4-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libffi-3.5.2-h3d046cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/liblzma-5.8.2-hfd05255_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libsqlite-3.51.2-hf5d6505_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libzlib-1.3.1-h2466b09_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/openssl-3.6.1-hf411b9b_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/python-3.10.19-hc20f281_3_cpython.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.10-8_cp310.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/ruff-0.15.3-h5739096_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/tk-8.6.13-h6ed50ae_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/ucrt-10.0.26100.0-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vc-14.3-h41ae7f8_34.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vc14_runtime-14.44.35208-h818238b_34.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vcomp14-14.44.35208-h818238b_34.conda default: channels: - url: https://conda.anaconda.org/conda-forge/ options: pypi-prerelease-mode: if-necessary-or-explicit - packages: {} -packages: [] + packages: + linux-64: + - conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_9.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/icu-78.2-h33c6efd_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45.1-default_hbd61a6d_101.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.4-hecca717_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h3435931_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.2.0-h69a702a_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.2-hb03c661_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libnsl-2.0.1-hb9d3cd8_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.51.2-hf4e2dac_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.41.3-h5347b49_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libxcrypt-4.4.36-hd590300_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h2d0b736_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.1-h35e630c_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.10.19-h3c07f61_3_cpython.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.10-8_cp310.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.3-h853b02a_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ruff-0.15.3-h40fa522_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h366c992_103.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_6.conda + linux-aarch64: + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/bzip2-1.0.8-h4777abc_9.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/icu-78.2-hb1525cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ld_impl_linux-aarch64-2.45.1-default_h1979696_101.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libexpat-2.7.4-hfae3067_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libffi-3.5.2-h376a255_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-15.2.0-h8acb6b2_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-ng-15.2.0-he9431aa_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgomp-15.2.0-h8acb6b2_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liblzma-5.8.2-he30d5cf_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnsl-2.0.1-h86ecc28_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsqlite-3.51.2-h10b116e_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libstdcxx-15.2.0-hef695bb_18.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libuuid-2.41.3-h1022ec0_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxcrypt-4.4.36-h31becfc_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libzlib-1.3.1-h86ecc28_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ncurses-6.5-ha32ae93_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/openssl-3.6.1-h546c87b_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/python-3.10.19-h28be5d3_3_cpython.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.10-8_cp310.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/readline-8.3-hb682ff5_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ruff-0.15.3-he9a2e21_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/tk-8.6.13-noxft_h0dc03b3_103.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/zstd-1.5.7-h85ac4a6_6.conda + win-64: + - conda: https://conda.anaconda.org/conda-forge/win-64/bzip2-1.0.8-h0ad9c76_9.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-h4c7d964_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libexpat-2.7.4-hac47afa_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libffi-3.5.2-h3d046cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/liblzma-5.8.2-hfd05255_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libsqlite-3.51.2-hf5d6505_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/libzlib-1.3.1-h2466b09_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/openssl-3.6.1-hf411b9b_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/python-3.10.19-hc20f281_3_cpython.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.10-8_cp310.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/ruff-0.15.3-h5739096_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/tk-8.6.13-h6ed50ae_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/ucrt-10.0.26100.0-h57928b3_0.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vc-14.3-h41ae7f8_34.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vc14_runtime-14.44.35208-h818238b_34.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/vcomp14-14.44.35208-h818238b_34.conda +packages: +- conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-20_gnu.conda + build_number: 20 + sha256: 1dd3fffd892081df9726d7eb7e0dea6198962ba775bd88842135a4ddb4deb3c9 + md5: a9f577daf3de00bca7c3c76c0ecbd1de + depends: + - __glibc >=2.17,<3.0.a0 + - libgomp >=7.5.0 + constrains: + - openmp_impl <0.0a0 + license: BSD-3-Clause + license_family: BSD + size: 28948 + timestamp: 1770939786096 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/_openmp_mutex-4.5-20_gnu.conda + build_number: 20 + sha256: a2527b1d81792a0ccd2c05850960df119c2b6d8f5fdec97f2db7d25dc23b1068 + md5: 468fd3bb9e1f671d36c2cbc677e56f1d + depends: + - libgomp >=7.5.0 + constrains: + - openmp_impl <0.0a0 + license: BSD-3-Clause + license_family: BSD + size: 28926 + timestamp: 1770939656741 +- conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_9.conda + sha256: 0b75d45f0bba3e95dc693336fa51f40ea28c980131fec438afb7ce6118ed05f6 + md5: d2ffd7602c02f2b316fd921d39876885 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: bzip2-1.0.6 + license_family: BSD + size: 260182 + timestamp: 1771350215188 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/bzip2-1.0.8-h4777abc_9.conda + sha256: b3495077889dde6bb370938e7db82be545c73e8589696ad0843a32221520ad4c + md5: 840d8fc0d7b3209be93080bc20e07f2d + depends: + - libgcc >=14 + license: bzip2-1.0.6 + license_family: BSD + size: 192412 + timestamp: 1771350241232 +- conda: https://conda.anaconda.org/conda-forge/win-64/bzip2-1.0.8-h0ad9c76_9.conda + sha256: 76dfb71df5e8d1c4eded2dbb5ba15bb8fb2e2b0fe42d94145d5eed4c75c35902 + md5: 4cb8e6b48f67de0b018719cdf1136306 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: bzip2-1.0.6 + license_family: BSD + size: 56115 + timestamp: 1771350256444 +- conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-h4c7d964_0.conda + sha256: 37950019c59b99585cee5d30dbc2cc9696ed4e11f5742606a4db1621ed8f94d6 + md5: f001e6e220355b7f87403a4d0e5bf1ca + depends: + - __win + license: ISC + size: 147734 + timestamp: 1772006322223 +- conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-hbd8a1cb_0.conda + sha256: 67cc7101b36421c5913a1687ef1b99f85b5d6868da3abbf6ec1a4181e79782fc + md5: 4492fd26db29495f0ba23f146cd5638d + depends: + - __unix + license: ISC + size: 147413 + timestamp: 1772006283803 +- conda: https://conda.anaconda.org/conda-forge/linux-64/icu-78.2-h33c6efd_0.conda + sha256: 142a722072fa96cf16ff98eaaf641f54ab84744af81754c292cb81e0881c0329 + md5: 186a18e3ba246eccfc7cff00cd19a870 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 12728445 + timestamp: 1767969922681 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/icu-78.2-hb1525cb_0.conda + sha256: 09f7f9213eb68e7e4291cd476e72b37f3ded99ed957528567f32f5ba6b611043 + md5: 15b35dc33e185e7d2aac1cfcd6778627 + depends: + - libgcc >=14 + - libstdcxx >=14 + license: MIT + license_family: MIT + size: 12852963 + timestamp: 1767975394622 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45.1-default_hbd61a6d_101.conda + sha256: 565941ac1f8b0d2f2e8f02827cbca648f4d18cd461afc31f15604cd291b5c5f3 + md5: 12bd9a3f089ee6c9266a37dab82afabd + depends: + - __glibc >=2.17,<3.0.a0 + - zstd >=1.5.7,<1.6.0a0 + constrains: + - binutils_impl_linux-64 2.45.1 + license: GPL-3.0-only + license_family: GPL + size: 725507 + timestamp: 1770267139900 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ld_impl_linux-aarch64-2.45.1-default_h1979696_101.conda + sha256: 44527364aa333be631913451c32eb0cae1e09343827e9ce3ccabd8d962584226 + md5: 35b2ae7fadf364b8e5fb8185aaeb80e5 + depends: + - zstd >=1.5.7,<1.6.0a0 + constrains: + - binutils_impl_linux-aarch64 2.45.1 + license: GPL-3.0-only + license_family: GPL + size: 875924 + timestamp: 1770267209884 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.4-hecca717_0.conda + sha256: d78f1d3bea8c031d2f032b760f36676d87929b18146351c4464c66b0869df3f5 + md5: e7f7ce06ec24cfcfb9e36d28cf82ba57 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + constrains: + - expat 2.7.4.* + license: MIT + license_family: MIT + size: 76798 + timestamp: 1771259418166 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libexpat-2.7.4-hfae3067_0.conda + sha256: 995ce3ad96d0f4b5ed6296b051a0d7b6377718f325bc0e792fbb96b0e369dad7 + md5: 57f3b3da02a50a1be2a6fe847515417d + depends: + - libgcc >=14 + constrains: + - expat 2.7.4.* + license: MIT + license_family: MIT + size: 76564 + timestamp: 1771259530958 +- conda: https://conda.anaconda.org/conda-forge/win-64/libexpat-2.7.4-hac47afa_0.conda + sha256: b31f6fb629c4e17885aaf2082fb30384156d16b48b264e454de4a06a313b533d + md5: 1c1ced969021592407f16ada4573586d + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - expat 2.7.4.* + license: MIT + license_family: MIT + size: 70323 + timestamp: 1771259521393 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h3435931_0.conda + sha256: 31f19b6a88ce40ebc0d5a992c131f57d919f73c0b92cd1617a5bec83f6e961e6 + md5: a360c33a5abe61c07959e449fa1453eb + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: MIT + license_family: MIT + size: 58592 + timestamp: 1769456073053 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libffi-3.5.2-h376a255_0.conda + sha256: 3df4c539449aabc3443bbe8c492c01d401eea894603087fca2917aa4e1c2dea9 + md5: 2f364feefb6a7c00423e80dcb12db62a + depends: + - libgcc >=14 + license: MIT + license_family: MIT + size: 55952 + timestamp: 1769456078358 +- conda: https://conda.anaconda.org/conda-forge/win-64/libffi-3.5.2-h3d046cb_0.conda + sha256: 59d01f2dfa8b77491b5888a5ab88ff4e1574c9359f7e229da254cdfe27ddc190 + md5: 720b39f5ec0610457b725eb3f396219a + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: MIT + license_family: MIT + size: 45831 + timestamp: 1769456418774 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_18.conda + sha256: faf7d2017b4d718951e3a59d081eb09759152f93038479b768e3d612688f83f5 + md5: 0aa00f03f9e39fb9876085dee11a85d4 + depends: + - __glibc >=2.17,<3.0.a0 + - _openmp_mutex >=4.5 + constrains: + - libgcc-ng ==15.2.0=*_18 + - libgomp 15.2.0 he0feb66_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 1041788 + timestamp: 1771378212382 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-15.2.0-h8acb6b2_18.conda + sha256: 43df385bedc1cab11993c4369e1f3b04b4ca5d0ea16cba6a0e7f18dbc129fcc9 + md5: 552567ea2b61e3a3035759b2fdb3f9a6 + depends: + - _openmp_mutex >=4.5 + constrains: + - libgcc-ng ==15.2.0=*_18 + - libgomp 15.2.0 h8acb6b2_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 622900 + timestamp: 1771378128706 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.2.0-h69a702a_18.conda + sha256: e318a711400f536c81123e753d4c797a821021fb38970cebfb3f454126016893 + md5: d5e96b1ed75ca01906b3d2469b4ce493 + depends: + - libgcc 15.2.0 he0feb66_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 27526 + timestamp: 1771378224552 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgcc-ng-15.2.0-he9431aa_18.conda + sha256: 83bb0415f59634dccfa8335d4163d1f6db00a27b36666736f9842b650b92cf2f + md5: 4feebd0fbf61075a1a9c2e9b3936c257 + depends: + - libgcc 15.2.0 h8acb6b2_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 27568 + timestamp: 1771378136019 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_18.conda + sha256: 21337ab58e5e0649d869ab168d4e609b033509de22521de1bfed0c031bfc5110 + md5: 239c5e9546c38a1e884d69effcf4c882 + depends: + - __glibc >=2.17,<3.0.a0 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 603262 + timestamp: 1771378117851 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libgomp-15.2.0-h8acb6b2_18.conda + sha256: fc716f11a6a8525e27a5d332ef6a689210b0d2a4dd1133edc0f530659aa9faa6 + md5: 4faa39bf919939602e594253bd673958 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 588060 + timestamp: 1771378040807 +- conda: https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.2-hb03c661_0.conda + sha256: 755c55ebab181d678c12e49cced893598f2bab22d582fbbf4d8b83c18be207eb + md5: c7c83eecbb72d88b940c249af56c8b17 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + constrains: + - xz 5.8.2.* + license: 0BSD + size: 113207 + timestamp: 1768752626120 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/liblzma-5.8.2-he30d5cf_0.conda + sha256: 843c46e20519651a3e357a8928352b16c5b94f4cd3d5481acc48be2e93e8f6a3 + md5: 96944e3c92386a12755b94619bae0b35 + depends: + - libgcc >=14 + constrains: + - xz 5.8.2.* + license: 0BSD + size: 125916 + timestamp: 1768754941722 +- conda: https://conda.anaconda.org/conda-forge/win-64/liblzma-5.8.2-hfd05255_0.conda + sha256: f25bf293f550c8ed2e0c7145eb404324611cfccff37660869d97abf526eb957c + md5: ba0bfd4c3cf73f299ffe46ff0eaeb8e3 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - xz 5.8.2.* + license: 0BSD + size: 106169 + timestamp: 1768752763559 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libnsl-2.0.1-hb9d3cd8_1.conda + sha256: 927fe72b054277cde6cb82597d0fcf6baf127dcbce2e0a9d8925a68f1265eef5 + md5: d864d34357c3b65a4b731f78c0801dc4 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + license: LGPL-2.1-only + license_family: GPL + size: 33731 + timestamp: 1750274110928 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libnsl-2.0.1-h86ecc28_1.conda + sha256: c0dc4d84198e3eef1f37321299e48e2754ca83fd12e6284754e3cb231357c3a5 + md5: d5d58b2dc3e57073fe22303f5fed4db7 + depends: + - libgcc >=13 + license: LGPL-2.1-only + license_family: GPL + size: 34831 + timestamp: 1750274211 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.51.2-hf4e2dac_0.conda + sha256: 04596fcee262a870e4b7c9807224680ff48d4d0cc0dac076a602503d3dc6d217 + md5: da5be73701eecd0e8454423fd6ffcf30 + depends: + - __glibc >=2.17,<3.0.a0 + - icu >=78.2,<79.0a0 + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + license: blessing + size: 942808 + timestamp: 1768147973361 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libsqlite-3.51.2-h10b116e_0.conda + sha256: 5f8230ccaf9ffaab369adc894ef530699e96111dac0a8ff9b735a871f8ba8f8b + md5: 4e3ba0d5d192f99217b85f07a0761e64 + depends: + - icu >=78.2,<79.0a0 + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + license: blessing + size: 944688 + timestamp: 1768147991301 +- conda: https://conda.anaconda.org/conda-forge/win-64/libsqlite-3.51.2-hf5d6505_0.conda + sha256: 756478128e3e104bd7e7c3ce6c1b0efad7e08c7320c69fdc726e039323c63fbb + md5: 903979414b47d777d548e5f0165e6cd8 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: blessing + size: 1291616 + timestamp: 1768148278261 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_18.conda + sha256: 78668020064fdaa27e9ab65cd2997e2c837b564ab26ce3bf0e58a2ce1a525c6e + md5: 1b08cd684f34175e4514474793d44bcb + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc 15.2.0 he0feb66_18 + constrains: + - libstdcxx-ng ==15.2.0=*_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 5852330 + timestamp: 1771378262446 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libstdcxx-15.2.0-hef695bb_18.conda + sha256: 31fdb9ffafad106a213192d8319b9f810e05abca9c5436b60e507afb35a6bc40 + md5: f56573d05e3b735cb03efeb64a15f388 + depends: + - libgcc 15.2.0 h8acb6b2_18 + constrains: + - libstdcxx-ng ==15.2.0=*_18 + license: GPL-3.0-only WITH GCC-exception-3.1 + license_family: GPL + size: 5541411 + timestamp: 1771378162499 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.41.3-h5347b49_0.conda + sha256: 1a7539cfa7df00714e8943e18de0b06cceef6778e420a5ee3a2a145773758aee + md5: db409b7c1720428638e7c0d509d3e1b5 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + license: BSD-3-Clause + license_family: BSD + size: 40311 + timestamp: 1766271528534 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libuuid-2.41.3-h1022ec0_0.conda + sha256: c37a8e89b700646f3252608f8368e7eb8e2a44886b92776e57ad7601fc402a11 + md5: cf2861212053d05f27ec49c3784ff8bb + depends: + - libgcc >=14 + license: BSD-3-Clause + license_family: BSD + size: 43453 + timestamp: 1766271546875 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libxcrypt-4.4.36-hd590300_1.conda + sha256: 6ae68e0b86423ef188196fff6207ed0c8195dd84273cb5623b85aa08033a410c + md5: 5aa797f8787fe7a17d1b0821485b5adc + depends: + - libgcc-ng >=12 + license: LGPL-2.1-or-later + size: 100393 + timestamp: 1702724383534 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libxcrypt-4.4.36-h31becfc_1.conda + sha256: 6b46c397644091b8a26a3048636d10b989b1bf266d4be5e9474bf763f828f41f + md5: b4df5d7d4b63579d081fd3a4cf99740e + depends: + - libgcc-ng >=12 + license: LGPL-2.1-or-later + size: 114269 + timestamp: 1702724369203 +- conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda + sha256: d4bfe88d7cb447768e31650f06257995601f89076080e76df55e3112d4e47dc4 + md5: edb0dca6bc32e4f4789199455a1dbeb8 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + constrains: + - zlib 1.3.1 *_2 + license: Zlib + license_family: Other + size: 60963 + timestamp: 1727963148474 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/libzlib-1.3.1-h86ecc28_2.conda + sha256: 5a2c1eeef69342e88a98d1d95bff1603727ab1ff4ee0e421522acd8813439b84 + md5: 08aad7cbe9f5a6b460d0976076b6ae64 + depends: + - libgcc >=13 + constrains: + - zlib 1.3.1 *_2 + license: Zlib + license_family: Other + size: 66657 + timestamp: 1727963199518 +- conda: https://conda.anaconda.org/conda-forge/win-64/libzlib-1.3.1-h2466b09_2.conda + sha256: ba945c6493449bed0e6e29883c4943817f7c79cbff52b83360f7b341277c6402 + md5: 41fbfac52c601159df6c01f875de31b9 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + constrains: + - zlib 1.3.1 *_2 + license: Zlib + license_family: Other + size: 55476 + timestamp: 1727963768015 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h2d0b736_3.conda + sha256: 3fde293232fa3fca98635e1167de6b7c7fda83caf24b9d6c91ec9eefb4f4d586 + md5: 47e340acb35de30501a76c7c799c41d7 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + license: X11 AND BSD-3-Clause + size: 891641 + timestamp: 1738195959188 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ncurses-6.5-ha32ae93_3.conda + sha256: 91cfb655a68b0353b2833521dc919188db3d8a7f4c64bea2c6a7557b24747468 + md5: 182afabe009dc78d8b73100255ee6868 + depends: + - libgcc >=13 + license: X11 AND BSD-3-Clause + size: 926034 + timestamp: 1738196018799 +- conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.1-h35e630c_1.conda + sha256: 44c877f8af015332a5d12f5ff0fb20ca32f896526a7d0cdb30c769df1144fb5c + md5: f61eb8cd60ff9057122a3d338b99c00f + depends: + - __glibc >=2.17,<3.0.a0 + - ca-certificates + - libgcc >=14 + license: Apache-2.0 + license_family: Apache + size: 3164551 + timestamp: 1769555830639 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/openssl-3.6.1-h546c87b_1.conda + sha256: 7f8048c0e75b2620254218d72b4ae7f14136f1981c5eb555ef61645a9344505f + md5: 25f5885f11e8b1f075bccf4a2da91c60 + depends: + - ca-certificates + - libgcc >=14 + license: Apache-2.0 + license_family: Apache + size: 3692030 + timestamp: 1769557678657 +- conda: https://conda.anaconda.org/conda-forge/win-64/openssl-3.6.1-hf411b9b_1.conda + sha256: 53a5ad2e5553b8157a91bb8aa375f78c5958f77cb80e9d2ce59471ea8e5c0bd6 + md5: eb585509b815415bc964b2c7e11c7eb3 + depends: + - ca-certificates + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: Apache-2.0 + license_family: Apache + size: 9343023 + timestamp: 1769557547888 +- conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.10.19-h3c07f61_3_cpython.conda + build_number: 3 + sha256: 2d8b5566d82c3872f057661e056d696f2f77a17ee5a36d9ae6ec43052c4d1c51 + md5: be48679ccfbc8710dea1d5970600fa04 + depends: + - __glibc >=2.17,<3.0.a0 + - bzip2 >=1.0.8,<2.0a0 + - ld_impl_linux-64 >=2.36.1 + - libexpat >=2.7.3,<3.0a0 + - libffi >=3.4,<4.0a0 + - libgcc >=14 + - liblzma >=5.8.2,<6.0a0 + - libnsl >=2.0.1,<2.1.0a0 + - libsqlite >=3.51.2,<4.0a0 + - libuuid >=2.41.3,<3.0a0 + - libxcrypt >=4.4.36 + - libzlib >=1.3.1,<2.0a0 + - ncurses >=6.5,<7.0a0 + - openssl >=3.5.4,<4.0a0 + - readline >=8.3,<9.0a0 + - tk >=8.6.13,<8.7.0a0 + - tzdata + constrains: + - python_abi 3.10.* *_cp310 + license: Python-2.0 + size: 25358312 + timestamp: 1769471983988 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/python-3.10.19-h28be5d3_3_cpython.conda + build_number: 3 + sha256: bac10b5d508aabeb72ab3581dd82e6735a80b4d041bb74a0ff6fe159092e8289 + md5: 70940652d78d90e8c4d1f7987519b597 + depends: + - bzip2 >=1.0.8,<2.0a0 + - ld_impl_linux-aarch64 >=2.36.1 + - libexpat >=2.7.3,<3.0a0 + - libffi >=3.4,<4.0a0 + - libgcc >=14 + - liblzma >=5.8.2,<6.0a0 + - libnsl >=2.0.1,<2.1.0a0 + - libsqlite >=3.51.2,<4.0a0 + - libuuid >=2.41.3,<3.0a0 + - libxcrypt >=4.4.36 + - libzlib >=1.3.1,<2.0a0 + - ncurses >=6.5,<7.0a0 + - openssl >=3.5.4,<4.0a0 + - readline >=8.3,<9.0a0 + - tk >=8.6.13,<8.7.0a0 + - tzdata + constrains: + - python_abi 3.10.* *_cp310 + license: Python-2.0 + size: 13233848 + timestamp: 1769471007934 +- conda: https://conda.anaconda.org/conda-forge/win-64/python-3.10.19-hc20f281_3_cpython.conda + build_number: 3 + sha256: 77cbf9ab8e6c9f67e645b00a3224f35c92333fd9a737f5e53ef7060d0604c4cb + md5: 7be098c303e842443528587a5b2297f1 + depends: + - bzip2 >=1.0.8,<2.0a0 + - libexpat >=2.7.3,<3.0a0 + - libffi >=3.4,<4.0a0 + - liblzma >=5.8.2,<6.0a0 + - libsqlite >=3.51.2,<4.0a0 + - libzlib >=1.3.1,<2.0a0 + - openssl >=3.5.4,<4.0a0 + - tk >=8.6.13,<8.7.0a0 + - tzdata + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + constrains: + - python_abi 3.10.* *_cp310 + license: Python-2.0 + size: 16076382 + timestamp: 1769471071119 +- conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.10-8_cp310.conda + build_number: 8 + sha256: 7ad76fa396e4bde336872350124c0819032a9e8a0a40590744ff9527b54351c1 + md5: 05e00f3b21e88bb3d658ac700b2ce58c + constrains: + - python 3.10.* *_cpython + license: BSD-3-Clause + license_family: BSD + size: 6999 + timestamp: 1752805924192 +- conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.3-h853b02a_0.conda + sha256: 12ffde5a6f958e285aa22c191ca01bbd3d6e710aa852e00618fa6ddc59149002 + md5: d7d95fc8287ea7bf33e0e7116d2b95ec + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - ncurses >=6.5,<7.0a0 + license: GPL-3.0-only + license_family: GPL + size: 345073 + timestamp: 1765813471974 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/readline-8.3-hb682ff5_0.conda + sha256: fe695f9d215e9a2e3dd0ca7f56435ab4df24f5504b83865e3d295df36e88d216 + md5: 3d49cad61f829f4f0e0611547a9cda12 + depends: + - libgcc >=14 + - ncurses >=6.5,<7.0a0 + license: GPL-3.0-only + license_family: GPL + size: 357597 + timestamp: 1765815673644 +- conda: https://conda.anaconda.org/conda-forge/linux-64/ruff-0.15.3-h40fa522_0.conda + noarch: python + sha256: 7efb518e43aa52256814e2763c20861439539bbff68f4d736c955e845a10515c + md5: fd4c06615a54e05debebde95befd2ac3 + depends: + - python + - libgcc >=14 + - __glibc >=2.17,<3.0.a0 + - python_abi 3.10.* *_cp310 + constrains: + - __glibc >=2.17 + license: MIT + size: 9236513 + timestamp: 1772130957537 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/ruff-0.15.3-he9a2e21_0.conda + noarch: python + sha256: 674f22dcbb3742e3330c5911ba713f30e64d6ddb2af49939854ec10c03c3e324 + md5: 503124fb0aa3f0a62e3ac750753344a8 + depends: + - python + - libgcc >=14 + - python_abi 3.10.* *_cp310 + constrains: + - __glibc >=2.17 + license: MIT + size: 8870486 + timestamp: 1772130972884 +- conda: https://conda.anaconda.org/conda-forge/win-64/ruff-0.15.3-h5739096_0.conda + noarch: python + sha256: d7f65d9c95f54d3b9f84b0b535cfa6a6302fb4c28ec5a2a3ead932ebecee73b8 + md5: 1054ec7f90c1fc9dbdc89e5616b6a626 + depends: + - python + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + - ucrt >=10.0.20348.0 + - python_abi 3.10.* *_cp310 + license: MIT + size: 9704267 + timestamp: 1772130978536 +- conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h366c992_103.conda + sha256: cafeec44494f842ffeca27e9c8b0c27ed714f93ac77ddadc6aaf726b5554ebac + md5: cffd3bdd58090148f4cfcd831f4b26ab + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + constrains: + - xorg-libx11 >=1.8.12,<2.0a0 + license: TCL + license_family: BSD + size: 3301196 + timestamp: 1769460227866 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/tk-8.6.13-noxft_h0dc03b3_103.conda + sha256: e25c314b52764219f842b41aea2c98a059f06437392268f09b03561e4f6e5309 + md5: 7fc6affb9b01e567d2ef1d05b84aa6ed + depends: + - libgcc >=14 + - libzlib >=1.3.1,<2.0a0 + constrains: + - xorg-libx11 >=1.8.12,<2.0a0 + license: TCL + license_family: BSD + size: 3368666 + timestamp: 1769464148928 +- conda: https://conda.anaconda.org/conda-forge/win-64/tk-8.6.13-h6ed50ae_3.conda + sha256: 0e79810fae28f3b69fe7391b0d43f5474d6bd91d451d5f2bde02f55ae481d5e3 + md5: 0481bfd9814bf525bd4b3ee4b51494c4 + depends: + - ucrt >=10.0.20348.0 + - vc >=14.3,<15 + - vc14_runtime >=14.44.35208 + license: TCL + license_family: BSD + size: 3526350 + timestamp: 1769460339384 +- conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda + sha256: 1d30098909076af33a35017eed6f2953af1c769e273a0626a04722ac4acaba3c + md5: ad659d0a2b3e47e38d829aa8cad2d610 + license: LicenseRef-Public-Domain + size: 119135 + timestamp: 1767016325805 +- conda: https://conda.anaconda.org/conda-forge/win-64/ucrt-10.0.26100.0-h57928b3_0.conda + sha256: 3005729dce6f3d3f5ec91dfc49fc75a0095f9cd23bab49efb899657297ac91a5 + md5: 71b24316859acd00bdb8b38f5e2ce328 + constrains: + - vc14_runtime >=14.29.30037 + - vs2015_runtime >=14.29.30037 + license: LicenseRef-MicrosoftWindowsSDK10 + size: 694692 + timestamp: 1756385147981 +- conda: https://conda.anaconda.org/conda-forge/win-64/vc-14.3-h41ae7f8_34.conda + sha256: 9dc40c2610a6e6727d635c62cced5ef30b7b30123f5ef67d6139e23d21744b3a + md5: 1e610f2416b6acdd231c5f573d754a0f + depends: + - vc14_runtime >=14.44.35208 + track_features: + - vc14 + license: BSD-3-Clause + license_family: BSD + size: 19356 + timestamp: 1767320221521 +- conda: https://conda.anaconda.org/conda-forge/win-64/vc14_runtime-14.44.35208-h818238b_34.conda + sha256: 02732f953292cce179de9b633e74928037fa3741eb5ef91c3f8bae4f761d32a5 + md5: 37eb311485d2d8b2c419449582046a42 + depends: + - ucrt >=10.0.20348.0 + - vcomp14 14.44.35208 h818238b_34 + constrains: + - vs2015_runtime 14.44.35208.* *_34 + license: LicenseRef-MicrosoftVisualCpp2015-2022Runtime + license_family: Proprietary + size: 683233 + timestamp: 1767320219644 +- conda: https://conda.anaconda.org/conda-forge/win-64/vcomp14-14.44.35208-h818238b_34.conda + sha256: 878d5d10318b119bd98ed3ed874bd467acbe21996e1d81597a1dbf8030ea0ce6 + md5: 242d9f25d2ae60c76b38a5e42858e51d + depends: + - ucrt >=10.0.20348.0 + constrains: + - vs2015_runtime 14.44.35208.* *_34 + license: LicenseRef-MicrosoftVisualCpp2015-2022Runtime + license_family: Proprietary + size: 115235 + timestamp: 1767320173250 +- conda: https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_6.conda + sha256: 68f0206ca6e98fea941e5717cec780ed2873ffabc0e1ed34428c061e2c6268c7 + md5: 4a13eeac0b5c8e5b8ab496e6c4ddd829 + depends: + - __glibc >=2.17,<3.0.a0 + - libzlib >=1.3.1,<2.0a0 + license: BSD-3-Clause + license_family: BSD + size: 601375 + timestamp: 1764777111296 +- conda: https://conda.anaconda.org/conda-forge/linux-aarch64/zstd-1.5.7-h85ac4a6_6.conda + sha256: 569990cf12e46f9df540275146da567d9c618c1e9c7a0bc9d9cfefadaed20b75 + md5: c3655f82dcea2aa179b291e7099c1fcc + depends: + - libzlib >=1.3.1,<2.0a0 + license: BSD-3-Clause + license_family: BSD + size: 614429 + timestamp: 1764777145593 diff --git a/pixi.toml b/pixi.toml index c85559e8a7..e035d2ac64 100644 --- a/pixi.toml +++ b/pixi.toml @@ -48,3 +48,6 @@ depends-on = [ { task = "test-bindings" }, { task = "test-core" }, ] + +[dependencies] +ruff = ">=0.15.3,<0.16" From 3ff3b9ba5d1c983acb7f466d797775e6b6bbded8 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:45:35 -0500 Subject: [PATCH 03/42] Update ruff config with review feedback - Remove combine-as-imports (keep as-imports separate from bare imports) - Add C408 to global ignores (dict()/list()/tuple() calls are fine) - Add RUF005 to global ignores (list concatenation is fine) - Add E402, F403, F405 to __init__.py per-file-ignores - Add E702, B028 to test per-file-ignores - Add T201 for canary_probe_subprocess.py Made-with: Cursor --- ruff.toml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ruff.toml b/ruff.toml index 3002e2d05f..91446cda97 100644 --- a/ruff.toml +++ b/ruff.toml @@ -61,24 +61,25 @@ ignore = [ "S404", # allow subprocess imports # style preferences + "C408", # unnecessary dict/list/tuple call (dict() is fine) "E501", # line too long (formatter handles what it can; the rest is intentional) "E741", # ambiguous variable name (I, l, O) "B007", # unused loop control variable "B905", # zip without explicit strict "SIM108", # ternary if/else + "RUF005", # collection literal concatenation (list + list is fine) ] exclude = ["**/_version.py"] [lint.isort] known-first-party = ["cuda"] -combine-as-imports = true [lint.flake8-quotes] inline-quotes = "double" [lint.per-file-ignores] -"__init__.py" = ["F401"] +"__init__.py" = ["F401", "E402", "F403", "F405"] "setup.py" = ["F401"] "**/tests/**" = [ @@ -88,6 +89,7 @@ inline-quotes = "double" "RUF059", # unused unpacked variable (side-effect assignments) "F841", # unused local variable (side-effect assignments) "E402", # module-level import not at top of file + "E702", # multiple statements on one line (compact test tables) "N801", # CUDA naming conventions in tests "N802", "N803", @@ -102,6 +104,7 @@ inline-quotes = "double" "RUF005", # collection literal concatenation "RUF043", # pytest.raises ambiguous regex pattern "RUF003", # ambiguous unicode character in comment + "B028", # no explicit stacklevel in warnings (test code) ] "**/examples/**" = [ @@ -131,3 +134,4 @@ inline-quotes = "double" "ci/**" = ["T201"] "**/build_hooks.py" = ["T201"] "**/docs/**/conf.py" = ["T201", "ARG001"] +"cuda_pathfinder/**/canary_probe_subprocess.py" = ["T201"] From 4c472f37b03b45f88ad1f2b8f945ef76a35d7920 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:46:38 -0500 Subject: [PATCH 04/42] fix(ruff/cuda_core): I001 sort imports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - I001: unsorted imports — 48 fixed across 48 files Made-with: Cursor --- cuda_core/examples/cuda_graphs.py | 1 + cuda_core/examples/gl_interop_plasma.py | 1 + cuda_core/examples/jit_lto_fractal.py | 1 + cuda_core/examples/memory_ops.py | 1 + cuda_core/examples/pytorch_example.py | 1 + cuda_core/examples/saxpy.py | 1 + cuda_core/examples/simple_multi_gpu_example.py | 1 + cuda_core/examples/strided_memory_view_cpu.py | 1 + cuda_core/examples/strided_memory_view_gpu.py | 1 + cuda_core/examples/thread_block_cluster.py | 1 + cuda_core/examples/vector_add.py | 1 + .../tests/example_tests/test_basic_examples.py | 1 + cuda_core/tests/graph/test_advanced.py | 3 ++- cuda_core/tests/graph/test_basic.py | 3 ++- cuda_core/tests/graph/test_capture_alloc.py | 5 +++-- cuda_core/tests/graph/test_conditional.py | 3 ++- cuda_core/tests/graph/test_device_launch.py | 1 + cuda_core/tests/graph/test_options.py | 3 ++- cuda_core/tests/helpers/__init__.py | 1 - cuda_core/tests/helpers/latch.py | 4 ++-- cuda_core/tests/memory_ipc/test_errors.py | 1 + cuda_core/tests/memory_ipc/test_event_ipc.py | 3 ++- .../memory_ipc/test_ipc_duplicate_import.py | 3 ++- cuda_core/tests/memory_ipc/test_memory_ipc.py | 3 ++- cuda_core/tests/memory_ipc/test_peer_access.py | 3 ++- cuda_core/tests/memory_ipc/test_send_buffers.py | 3 ++- cuda_core/tests/memory_ipc/test_serialize.py | 3 ++- cuda_core/tests/memory_ipc/test_workerpool.py | 3 ++- cuda_core/tests/system/conftest.py | 1 + cuda_core/tests/system/test_system_device.py | 1 + cuda_core/tests/system/test_system_events.py | 1 + cuda_core/tests/test_context.py | 3 ++- cuda_core/tests/test_cuda_utils.py | 1 + cuda_core/tests/test_device.py | 3 ++- cuda_core/tests/test_event.py | 7 ++++--- cuda_core/tests/test_graphics.py | 1 + cuda_core/tests/test_helpers.py | 2 +- cuda_core/tests/test_launcher.py | 4 ++-- cuda_core/tests/test_linker.py | 1 + cuda_core/tests/test_managed_memory_warning.py | 3 ++- cuda_core/tests/test_memory.py | 16 ++++++++-------- cuda_core/tests/test_memory_peer_access.py | 5 +++-- cuda_core/tests/test_module.py | 3 ++- cuda_core/tests/test_object_protocols.py | 1 + cuda_core/tests/test_program.py | 1 + cuda_core/tests/test_stream.py | 3 ++- cuda_core/tests/test_strided_layout.py | 3 ++- cuda_core/tests/test_utils.py | 3 ++- 48 files changed, 81 insertions(+), 39 deletions(-) diff --git a/cuda_core/examples/cuda_graphs.py b/cuda_core/examples/cuda_graphs.py index 9cc759b500..32313fb182 100644 --- a/cuda_core/examples/cuda_graphs.py +++ b/cuda_core/examples/cuda_graphs.py @@ -13,6 +13,7 @@ import time import cupy as cp + from cuda.core import Device, LaunchConfig, Program, ProgramOptions, launch diff --git a/cuda_core/examples/gl_interop_plasma.py b/cuda_core/examples/gl_interop_plasma.py index 09e955efdf..282c9b8320 100644 --- a/cuda_core/examples/gl_interop_plasma.py +++ b/cuda_core/examples/gl_interop_plasma.py @@ -62,6 +62,7 @@ import time import numpy as np + from cuda.core import ( Device, GraphicsResource, diff --git a/cuda_core/examples/jit_lto_fractal.py b/cuda_core/examples/jit_lto_fractal.py index b0040708b6..5fdbfdc3dc 100644 --- a/cuda_core/examples/jit_lto_fractal.py +++ b/cuda_core/examples/jit_lto_fractal.py @@ -25,6 +25,7 @@ import sys import cupy as cp + from cuda.core import Device, LaunchConfig, Linker, LinkerOptions, Program, ProgramOptions, launch diff --git a/cuda_core/examples/memory_ops.py b/cuda_core/examples/memory_ops.py index 123b1f6a11..43e42f7c6e 100644 --- a/cuda_core/examples/memory_ops.py +++ b/cuda_core/examples/memory_ops.py @@ -16,6 +16,7 @@ import cupy as cp import numpy as np + from cuda.core import ( Device, LaunchConfig, diff --git a/cuda_core/examples/pytorch_example.py b/cuda_core/examples/pytorch_example.py index 433d63c9eb..cdc4374291 100644 --- a/cuda_core/examples/pytorch_example.py +++ b/cuda_core/examples/pytorch_example.py @@ -15,6 +15,7 @@ import sys import torch + from cuda.core import Device, LaunchConfig, Program, ProgramOptions, launch # SAXPY kernel - passing a as a pointer to avoid any type issues diff --git a/cuda_core/examples/saxpy.py b/cuda_core/examples/saxpy.py index aa0d77eff9..799300fb25 100644 --- a/cuda_core/examples/saxpy.py +++ b/cuda_core/examples/saxpy.py @@ -14,6 +14,7 @@ import sys import cupy as cp + from cuda.core import Device, LaunchConfig, Program, ProgramOptions, launch # compute out = a * x + y diff --git a/cuda_core/examples/simple_multi_gpu_example.py b/cuda_core/examples/simple_multi_gpu_example.py index 497a4309cf..5001636b7c 100644 --- a/cuda_core/examples/simple_multi_gpu_example.py +++ b/cuda_core/examples/simple_multi_gpu_example.py @@ -12,6 +12,7 @@ import sys import cupy as cp + from cuda.core import Device, LaunchConfig, Program, launch, system if system.get_num_devices() < 2: diff --git a/cuda_core/examples/strided_memory_view_cpu.py b/cuda_core/examples/strided_memory_view_cpu.py index a20377cc76..c7ea00fd2e 100644 --- a/cuda_core/examples/strided_memory_view_cpu.py +++ b/cuda_core/examples/strided_memory_view_cpu.py @@ -26,6 +26,7 @@ print("cffi is not installed, the CPU example will be skipped", file=sys.stderr) FFI = None import numpy as np + from cuda.core.utils import StridedMemoryView, args_viewable_as_strided_memory # ################################################################################ diff --git a/cuda_core/examples/strided_memory_view_gpu.py b/cuda_core/examples/strided_memory_view_gpu.py index e91ddc25cc..21a25ab84f 100644 --- a/cuda_core/examples/strided_memory_view_gpu.py +++ b/cuda_core/examples/strided_memory_view_gpu.py @@ -23,6 +23,7 @@ print("cupy is not installed, the GPU example will be skipped", file=sys.stderr) cp = None import numpy as np + from cuda.core import Device, LaunchConfig, Program, ProgramOptions, launch from cuda.core.utils import StridedMemoryView, args_viewable_as_strided_memory diff --git a/cuda_core/examples/thread_block_cluster.py b/cuda_core/examples/thread_block_cluster.py index f1ea8b8579..a9e0b5847f 100644 --- a/cuda_core/examples/thread_block_cluster.py +++ b/cuda_core/examples/thread_block_cluster.py @@ -13,6 +13,7 @@ import sys import numpy as np + from cuda.core import ( Device, LaunchConfig, diff --git a/cuda_core/examples/vector_add.py b/cuda_core/examples/vector_add.py index d31ab77208..e5d602f932 100644 --- a/cuda_core/examples/vector_add.py +++ b/cuda_core/examples/vector_add.py @@ -10,6 +10,7 @@ # ################################################################################ import cupy as cp + from cuda.core import Device, LaunchConfig, Program, ProgramOptions, launch # compute c = a + b diff --git a/cuda_core/tests/example_tests/test_basic_examples.py b/cuda_core/tests/example_tests/test_basic_examples.py index 640b53c2fc..48f16813df 100644 --- a/cuda_core/tests/example_tests/test_basic_examples.py +++ b/cuda_core/tests/example_tests/test_basic_examples.py @@ -7,6 +7,7 @@ import os import pytest + from cuda.core import Device from .utils import run_example diff --git a/cuda_core/tests/graph/test_advanced.py b/cuda_core/tests/graph/test_advanced.py index 68b6dbd0d2..9d4f1b3040 100644 --- a/cuda_core/tests/graph/test_advanced.py +++ b/cuda_core/tests/graph/test_advanced.py @@ -5,9 +5,10 @@ import numpy as np import pytest -from cuda.core import Device, LaunchConfig, LegacyPinnedMemoryResource, launch from helpers.graph_kernels import compile_common_kernels, compile_conditional_kernels +from cuda.core import Device, LaunchConfig, LegacyPinnedMemoryResource, launch + @pytest.mark.skipif(tuple(int(i) for i in np.__version__.split(".")[:2]) < (2, 1), reason="need numpy 2.1.0+") def test_graph_child_graph(init_cuda): diff --git a/cuda_core/tests/graph/test_basic.py b/cuda_core/tests/graph/test_basic.py index a1447c6b58..9de1880b5c 100644 --- a/cuda_core/tests/graph/test_basic.py +++ b/cuda_core/tests/graph/test_basic.py @@ -5,9 +5,10 @@ import numpy as np import pytest -from cuda.core import Device, GraphBuilder, LaunchConfig, LegacyPinnedMemoryResource, launch from helpers.graph_kernels import compile_common_kernels +from cuda.core import Device, GraphBuilder, LaunchConfig, LegacyPinnedMemoryResource, launch + def test_graph_is_building(init_cuda): gb = Device().create_graph_builder() diff --git a/cuda_core/tests/graph/test_capture_alloc.py b/cuda_core/tests/graph/test_capture_alloc.py index 1ac80c0a35..5cb23fd022 100644 --- a/cuda_core/tests/graph/test_capture_alloc.py +++ b/cuda_core/tests/graph/test_capture_alloc.py @@ -5,6 +5,9 @@ """Graph memory resource tests.""" import pytest +from helpers import IS_WINDOWS, IS_WSL +from helpers.buffers import compare_buffer_to_constant, make_scratch_buffer, set_buffer + from cuda.core import ( Device, DeviceMemoryResource, @@ -16,8 +19,6 @@ launch, ) from cuda.core._utils.cuda_utils import CUDAError -from helpers import IS_WINDOWS, IS_WSL -from helpers.buffers import compare_buffer_to_constant, make_scratch_buffer, set_buffer def _common_kernels_alloc(): diff --git a/cuda_core/tests/graph/test_conditional.py b/cuda_core/tests/graph/test_conditional.py index 25975b5e60..157d23e4f5 100644 --- a/cuda_core/tests/graph/test_conditional.py +++ b/cuda_core/tests/graph/test_conditional.py @@ -7,9 +7,10 @@ import numpy as np import pytest -from cuda.core import Device, GraphBuilder, LaunchConfig, LegacyPinnedMemoryResource, launch from helpers.graph_kernels import compile_conditional_kernels +from cuda.core import Device, GraphBuilder, LaunchConfig, LegacyPinnedMemoryResource, launch + @pytest.mark.parametrize( "condition_value", [True, False, ctypes.c_bool(True), ctypes.c_bool(False), np.bool_(True), np.bool_(False), 1, 0] diff --git a/cuda_core/tests/graph/test_device_launch.py b/cuda_core/tests/graph/test_device_launch.py index 757d831294..d302978028 100644 --- a/cuda_core/tests/graph/test_device_launch.py +++ b/cuda_core/tests/graph/test_device_launch.py @@ -12,6 +12,7 @@ import numpy as np import pytest + from cuda.core import ( Device, GraphCompleteOptions, diff --git a/cuda_core/tests/graph/test_options.py b/cuda_core/tests/graph/test_options.py index 3e3f9de1f0..1b2483e47a 100644 --- a/cuda_core/tests/graph/test_options.py +++ b/cuda_core/tests/graph/test_options.py @@ -4,9 +4,10 @@ """Graph options and build mode tests.""" import pytest -from cuda.core import Device, GraphBuilder, GraphCompleteOptions, GraphDebugPrintOptions, LaunchConfig, launch from helpers.graph_kernels import compile_common_kernels, compile_conditional_kernels +from cuda.core import Device, GraphBuilder, GraphCompleteOptions, GraphDebugPrintOptions, LaunchConfig, launch + def test_graph_dot_print_options(init_cuda, tmp_path): mod = compile_conditional_kernels(bool) diff --git a/cuda_core/tests/helpers/__init__.py b/cuda_core/tests/helpers/__init__.py index ea9146ca15..bebc00f407 100644 --- a/cuda_core/tests/helpers/__init__.py +++ b/cuda_core/tests/helpers/__init__.py @@ -6,7 +6,6 @@ from typing import Union from cuda.core._utils.cuda_utils import handle_return - from cuda_python_test_helpers import * # noqa: F403 CUDA_PATH = os.environ.get("CUDA_PATH") diff --git a/cuda_core/tests/helpers/latch.py b/cuda_core/tests/helpers/latch.py index e35ee3325b..c28fb22264 100644 --- a/cuda_core/tests/helpers/latch.py +++ b/cuda_core/tests/helpers/latch.py @@ -4,6 +4,8 @@ import ctypes import pytest + +import helpers from cuda.core import ( LaunchConfig, LegacyPinnedMemoryResource, @@ -12,8 +14,6 @@ launch, ) -import helpers - class LatchKernel: """ diff --git a/cuda_core/tests/memory_ipc/test_errors.py b/cuda_core/tests/memory_ipc/test_errors.py index fbf45f5fcc..1156f30dfe 100644 --- a/cuda_core/tests/memory_ipc/test_errors.py +++ b/cuda_core/tests/memory_ipc/test_errors.py @@ -6,6 +6,7 @@ import re import pytest + from cuda.core import Buffer, Device, DeviceMemoryResource, DeviceMemoryResourceOptions from cuda.core._utils.cuda_utils import CUDAError diff --git a/cuda_core/tests/memory_ipc/test_event_ipc.py b/cuda_core/tests/memory_ipc/test_event_ipc.py index a2636ddff5..793ae0744c 100644 --- a/cuda_core/tests/memory_ipc/test_event_ipc.py +++ b/cuda_core/tests/memory_ipc/test_event_ipc.py @@ -4,11 +4,12 @@ import multiprocessing as mp import pytest -from cuda.core import Device, EventOptions from helpers.buffers import compare_equal_buffers, make_scratch_buffer from helpers.latch import LatchKernel from helpers.logging import TimestampedLogger +from cuda.core import Device, EventOptions + ENABLE_LOGGING = False # Set True for test debugging and development CHILD_TIMEOUT_SEC = 30 NBYTES = 64 diff --git a/cuda_core/tests/memory_ipc/test_ipc_duplicate_import.py b/cuda_core/tests/memory_ipc/test_ipc_duplicate_import.py index 148339c7ae..0808a191dd 100644 --- a/cuda_core/tests/memory_ipc/test_ipc_duplicate_import.py +++ b/cuda_core/tests/memory_ipc/test_ipc_duplicate_import.py @@ -13,9 +13,10 @@ import multiprocessing as mp import pytest -from cuda.core import Buffer, Device from helpers.logging import TimestampedLogger +from cuda.core import Buffer, Device + CHILD_TIMEOUT_SEC = 30 NBYTES = 64 POOL_SIZE = 2097152 diff --git a/cuda_core/tests/memory_ipc/test_memory_ipc.py b/cuda_core/tests/memory_ipc/test_memory_ipc.py index 0d1c50bfbd..1b320fa6f2 100644 --- a/cuda_core/tests/memory_ipc/test_memory_ipc.py +++ b/cuda_core/tests/memory_ipc/test_memory_ipc.py @@ -4,9 +4,10 @@ import multiprocessing as mp import pytest -from cuda.core import Buffer, DeviceMemoryResource from helpers.buffers import PatternGen +from cuda.core import Buffer, DeviceMemoryResource + CHILD_TIMEOUT_SEC = 30 NBYTES = 64 NWORKERS = 2 diff --git a/cuda_core/tests/memory_ipc/test_peer_access.py b/cuda_core/tests/memory_ipc/test_peer_access.py index e2a4e6c5b2..a3f8398670 100644 --- a/cuda_core/tests/memory_ipc/test_peer_access.py +++ b/cuda_core/tests/memory_ipc/test_peer_access.py @@ -4,9 +4,10 @@ import multiprocessing as mp import pytest +from helpers.buffers import PatternGen + from cuda.core import Device, DeviceMemoryResource, DeviceMemoryResourceOptions from cuda.core._utils.cuda_utils import CUDAError -from helpers.buffers import PatternGen CHILD_TIMEOUT_SEC = 30 NBYTES = 64 diff --git a/cuda_core/tests/memory_ipc/test_send_buffers.py b/cuda_core/tests/memory_ipc/test_send_buffers.py index a645ec93d9..db107ebff4 100644 --- a/cuda_core/tests/memory_ipc/test_send_buffers.py +++ b/cuda_core/tests/memory_ipc/test_send_buffers.py @@ -5,9 +5,10 @@ from itertools import cycle import pytest -from cuda.core import Device, DeviceMemoryResource, DeviceMemoryResourceOptions from helpers.buffers import PatternGen +from cuda.core import Device, DeviceMemoryResource, DeviceMemoryResourceOptions + CHILD_TIMEOUT_SEC = 30 NBYTES = 64 NMRS = 3 diff --git a/cuda_core/tests/memory_ipc/test_serialize.py b/cuda_core/tests/memory_ipc/test_serialize.py index 3e31db19e4..c562c91c90 100644 --- a/cuda_core/tests/memory_ipc/test_serialize.py +++ b/cuda_core/tests/memory_ipc/test_serialize.py @@ -6,9 +6,10 @@ import os import pytest -from cuda.core import Buffer, Device, DeviceMemoryResource from helpers.buffers import PatternGen +from cuda.core import Buffer, Device, DeviceMemoryResource + CHILD_TIMEOUT_SEC = 30 NBYTES = 64 POOL_SIZE = 2097152 diff --git a/cuda_core/tests/memory_ipc/test_workerpool.py b/cuda_core/tests/memory_ipc/test_workerpool.py index 25e63dddc5..ed66c95d33 100644 --- a/cuda_core/tests/memory_ipc/test_workerpool.py +++ b/cuda_core/tests/memory_ipc/test_workerpool.py @@ -6,9 +6,10 @@ from itertools import cycle import pytest -from cuda.core import Buffer, Device, DeviceMemoryResource, DeviceMemoryResourceOptions from helpers.buffers import PatternGen +from cuda.core import Buffer, Device, DeviceMemoryResource, DeviceMemoryResourceOptions + CHILD_TIMEOUT_SEC = 30 NBYTES = 64 NWORKERS = 2 diff --git a/cuda_core/tests/system/conftest.py b/cuda_core/tests/system/conftest.py index 594f2ba925..6cae2991d2 100644 --- a/cuda_core/tests/system/conftest.py +++ b/cuda_core/tests/system/conftest.py @@ -4,6 +4,7 @@ import pytest + from cuda.core import system SHOULD_SKIP_NVML_TESTS = not system.CUDA_BINDINGS_NVML_IS_COMPATIBLE diff --git a/cuda_core/tests/system/test_system_device.py b/cuda_core/tests/system/test_system_device.py index 2f88806838..74a5160cc6 100644 --- a/cuda_core/tests/system/test_system_device.py +++ b/cuda_core/tests/system/test_system_device.py @@ -16,6 +16,7 @@ import helpers import pytest + from cuda.core import system if system.CUDA_BINDINGS_NVML_IS_COMPATIBLE: diff --git a/cuda_core/tests/system/test_system_events.py b/cuda_core/tests/system/test_system_events.py index 6a1b25d0bd..b676cbe925 100644 --- a/cuda_core/tests/system/test_system_events.py +++ b/cuda_core/tests/system/test_system_events.py @@ -10,6 +10,7 @@ import helpers import pytest + from cuda.core import system diff --git a/cuda_core/tests/test_context.py b/cuda_core/tests/test_context.py index 5183aa1a85..66f7582ea7 100644 --- a/cuda_core/tests/test_context.py +++ b/cuda_core/tests/test_context.py @@ -1,8 +1,9 @@ # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -import cuda.core import pytest + +import cuda.core from cuda.core import Device diff --git a/cuda_core/tests/test_cuda_utils.py b/cuda_core/tests/test_cuda_utils.py index c68f8fb841..1111e3c8d4 100644 --- a/cuda_core/tests/test_cuda_utils.py +++ b/cuda_core/tests/test_cuda_utils.py @@ -3,6 +3,7 @@ # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE import pytest + from cuda.bindings import driver, runtime from cuda.core._utils import cuda_utils diff --git a/cuda_core/tests/test_device.py b/cuda_core/tests/test_device.py index d561f92b9e..83b71d617a 100644 --- a/cuda_core/tests/test_device.py +++ b/cuda_core/tests/test_device.py @@ -6,8 +6,9 @@ except ImportError: from cuda import cuda as driver from cuda import cudart as runtime -import cuda.core import pytest + +import cuda.core from cuda.core import Device from cuda.core._utils.cuda_utils import ComputeCapability, get_binding_version, handle_return diff --git a/cuda_core/tests/test_event.py b/cuda_core/tests/test_event.py index ef075d8580..ddceacd77c 100644 --- a/cuda_core/tests/test_event.py +++ b/cuda_core/tests/test_event.py @@ -4,15 +4,16 @@ import math -import cuda.core import pytest +from helpers.latch import LatchKernel +from helpers.nanosleep_kernel import NanosleepKernel + +import cuda.core from cuda.core import ( Device, Event, EventOptions, ) -from helpers.latch import LatchKernel -from helpers.nanosleep_kernel import NanosleepKernel def test_event_init_disabled(): diff --git a/cuda_core/tests/test_graphics.py b/cuda_core/tests/test_graphics.py index a0dfc73edc..6474c38be4 100644 --- a/cuda_core/tests/test_graphics.py +++ b/cuda_core/tests/test_graphics.py @@ -11,6 +11,7 @@ import numpy as np import pytest + from cuda.core import ( Buffer, Device, diff --git a/cuda_core/tests/test_helpers.py b/cuda_core/tests/test_helpers.py index 76712e8432..d0c8f8d66c 100644 --- a/cuda_core/tests/test_helpers.py +++ b/cuda_core/tests/test_helpers.py @@ -5,12 +5,12 @@ import time import pytest -from cuda.core import Device from helpers import IS_WINDOWS, IS_WSL from helpers.buffers import PatternGen, compare_equal_buffers, make_scratch_buffer from helpers.latch import LatchKernel from helpers.logging import TimestampedLogger +from cuda.core import Device from cuda_python_test_helpers import under_compute_sanitizer ENABLE_LOGGING = False # Set True for test debugging and development diff --git a/cuda_core/tests/test_launcher.py b/cuda_core/tests/test_launcher.py index ab304bb9bc..23affe756d 100644 --- a/cuda_core/tests/test_launcher.py +++ b/cuda_core/tests/test_launcher.py @@ -12,6 +12,8 @@ cp = None import numpy as np import pytest + +from conftest import skipif_need_cuda_headers from cuda.core import ( Device, DeviceMemoryResource, @@ -24,8 +26,6 @@ from cuda.core._memory import _SynchronousMemoryResource from cuda.core._utils.cuda_utils import CUDAError -from conftest import skipif_need_cuda_headers - def test_launch_config_init(init_cuda): config = LaunchConfig(grid=(1, 1, 1), block=(1, 1, 1), shmem_size=0) diff --git a/cuda_core/tests/test_linker.py b/cuda_core/tests/test_linker.py index 0cb3b8e95f..0ba914ca8f 100644 --- a/cuda_core/tests/test_linker.py +++ b/cuda_core/tests/test_linker.py @@ -3,6 +3,7 @@ # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE import pytest + from cuda.core import Device, Linker, LinkerOptions, Program, ProgramOptions, _linker from cuda.core._module import ObjectCode from cuda.core._utils.cuda_utils import CUDAError diff --git a/cuda_core/tests/test_managed_memory_warning.py b/cuda_core/tests/test_managed_memory_warning.py index 8bafea492e..1f13f06f30 100644 --- a/cuda_core/tests/test_managed_memory_warning.py +++ b/cuda_core/tests/test_managed_memory_warning.py @@ -10,8 +10,9 @@ import warnings -import cuda.bindings import pytest + +import cuda.bindings from cuda.core import Device, ManagedMemoryResource, ManagedMemoryResourceOptions from cuda.core._memory._managed_memory_resource import reset_concurrent_access_warning diff --git a/cuda_core/tests/test_memory.py b/cuda_core/tests/test_memory.py index 65230944ad..0cc0f4aafc 100644 --- a/cuda_core/tests/test_memory.py +++ b/cuda_core/tests/test_memory.py @@ -17,6 +17,14 @@ import re import pytest +from helpers import IS_WINDOWS, supports_ipc_mempool +from helpers.buffers import DummyUnifiedMemoryResource, TrackingMR + +from conftest import ( + create_managed_memory_resource_or_skip, + skip_if_managed_memory_unsupported, + skip_if_pinned_memory_unsupported, +) from cuda.core import ( Buffer, Device, @@ -38,14 +46,6 @@ from cuda.core._memory import IPCBufferDescriptor from cuda.core._utils.cuda_utils import CUDAError, handle_return from cuda.core.utils import StridedMemoryView -from helpers import IS_WINDOWS, supports_ipc_mempool -from helpers.buffers import DummyUnifiedMemoryResource, TrackingMR - -from conftest import ( - create_managed_memory_resource_or_skip, - skip_if_managed_memory_unsupported, - skip_if_pinned_memory_unsupported, -) POOL_SIZE = 2097152 # 2MB size diff --git a/cuda_core/tests/test_memory_peer_access.py b/cuda_core/tests/test_memory_peer_access.py index bcae9576da..db9fb4885e 100644 --- a/cuda_core/tests/test_memory_peer_access.py +++ b/cuda_core/tests/test_memory_peer_access.py @@ -1,11 +1,12 @@ # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -import cuda.core import pytest +from helpers.buffers import PatternGen, compare_buffer_to_constant, make_scratch_buffer + +import cuda.core from cuda.core import DeviceMemoryResource from cuda.core._utils.cuda_utils import CUDAError -from helpers.buffers import PatternGen, compare_buffer_to_constant, make_scratch_buffer NBYTES = 1024 diff --git a/cuda_core/tests/test_module.py b/cuda_core/tests/test_module.py index cd14cbfff4..9293cda2ba 100644 --- a/cuda_core/tests/test_module.py +++ b/cuda_core/tests/test_module.py @@ -5,8 +5,9 @@ import pickle import warnings -import cuda.core import pytest + +import cuda.core from cuda.core import Device, Kernel, ObjectCode, Program, ProgramOptions from cuda.core._program import _can_load_generated_ptx from cuda.core._utils.cuda_utils import CUDAError, driver, get_binding_version, handle_return diff --git a/cuda_core/tests/test_object_protocols.py b/cuda_core/tests/test_object_protocols.py index 7c3e272f49..e456b3e81e 100644 --- a/cuda_core/tests/test_object_protocols.py +++ b/cuda_core/tests/test_object_protocols.py @@ -12,6 +12,7 @@ import weakref import pytest + from cuda.core import Buffer, Device, Kernel, LaunchConfig, Program, Stream, system from cuda.core._program import _can_load_generated_ptx diff --git a/cuda_core/tests/test_program.py b/cuda_core/tests/test_program.py index 0005777b52..5eb83f9118 100644 --- a/cuda_core/tests/test_program.py +++ b/cuda_core/tests/test_program.py @@ -6,6 +6,7 @@ import warnings import pytest + from cuda.core import _linker from cuda.core._device import Device from cuda.core._module import Kernel, ObjectCode diff --git a/cuda_core/tests/test_stream.py b/cuda_core/tests/test_stream.py index 925daa7cd5..6c843bca00 100644 --- a/cuda_core/tests/test_stream.py +++ b/cuda_core/tests/test_stream.py @@ -2,11 +2,12 @@ # SPDX-License-Identifier: Apache-2.0 import pytest +from helpers.misc import StreamWrapper + from cuda.core import Device, Stream, StreamOptions from cuda.core._event import Event from cuda.core._stream import LEGACY_DEFAULT_STREAM, PER_THREAD_DEFAULT_STREAM from cuda.core._utils.cuda_utils import driver -from helpers.misc import StreamWrapper def test_stream_init_disabled(): diff --git a/cuda_core/tests/test_strided_layout.py b/cuda_core/tests/test_strided_layout.py index d897f78cfe..7c17ded7f3 100644 --- a/cuda_core/tests/test_strided_layout.py +++ b/cuda_core/tests/test_strided_layout.py @@ -9,7 +9,6 @@ import numpy as np import pytest -from cuda.core._layout import _StridedLayout from helpers.layout import ( DenseOrder, LayoutSpec, @@ -23,6 +22,8 @@ random_permutations, ) +from cuda.core._layout import _StridedLayout + _ITEMSIZES = [1, 2, 4, 8, 16] _S = np.s_ diff --git a/cuda_core/tests/test_utils.py b/cuda_core/tests/test_utils.py index 15b4d963d1..e7dd140d96 100644 --- a/cuda_core/tests/test_utils.py +++ b/cuda_core/tests/test_utils.py @@ -26,11 +26,12 @@ ml_dtypes = None import numpy as np import pytest +from pytest import param + from cuda.core import Device from cuda.core._dlpack import DLDeviceType from cuda.core._layout import _StridedLayout from cuda.core.utils import StridedMemoryView, args_viewable_as_strided_memory -from pytest import param _PyCapsule_IsValid = ctypes.pythonapi.PyCapsule_IsValid _PyCapsule_IsValid.argtypes = (ctypes.py_object, ctypes.c_char_p) From deb8828a420e19e953ea05da3f7964df07bd5d46 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:46:58 -0500 Subject: [PATCH 05/42] fix(ruff/cuda_core): RUF100 remove stale noqa comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - RUF100: unused-noqa — 80 fixed across 24 files Made-with: Cursor --- cuda_core/cuda/core/__init__.py | 32 +++++++++---------- cuda_core/cuda/core/_memory/__init__.py | 16 +++++----- .../core/_memory/_virtual_memory_resource.py | 2 +- .../_utils/driver_cu_result_explanations.py | 1 - .../_utils/runtime_cuda_error_explanations.py | 1 - cuda_core/cuda/core/experimental/__init__.py | 24 +++++++------- cuda_core/cuda/core/system/__init__.py | 1 - cuda_core/cuda/core/utils.py | 4 +-- cuda_core/tests/example_tests/utils.py | 2 +- cuda_core/tests/helpers/__init__.py | 4 +-- cuda_core/tests/memory_ipc/test_errors.py | 4 +-- cuda_core/tests/memory_ipc/test_serialize.py | 2 +- cuda_core/tests/memory_ipc/test_workerpool.py | 2 +- cuda_core/tests/system/test_nvml_context.py | 1 - cuda_core/tests/system/test_system_device.py | 3 +- cuda_core/tests/system/test_system_events.py | 1 - cuda_core/tests/system/test_system_system.py | 1 - cuda_core/tests/test_graphics.py | 12 +++---- cuda_core/tests/test_memory.py | 2 +- cuda_core/tests/test_memory_peer_access.py | 14 ++++---- cuda_core/tests/test_module.py | 2 +- cuda_core/tests/test_object_protocols.py | 2 +- cuda_core/tests/test_program.py | 16 +++++----- cuda_core/tests/test_utils.py | 4 +-- 24 files changed, 73 insertions(+), 80 deletions(-) diff --git a/cuda_core/cuda/core/__init__.py b/cuda_core/cuda/core/__init__.py index 94cb68006c..dfba887144 100644 --- a/cuda_core/cuda/core/__init__.py +++ b/cuda_core/cuda/core/__init__.py @@ -28,21 +28,21 @@ finally: del bindings, importlib, subdir, cuda_major, cuda_minor -from cuda.core import system, utils # noqa: E402 -from cuda.core._device import Device # noqa: E402 -from cuda.core._event import Event, EventOptions # noqa: E402 -from cuda.core._graph import ( # noqa: E402 +from cuda.core import system, utils +from cuda.core._device import Device +from cuda.core._event import Event, EventOptions +from cuda.core._graph import ( Graph, GraphBuilder, GraphCompleteOptions, GraphDebugPrintOptions, ) -from cuda.core._graphics import GraphicsResource # noqa: E402 -from cuda.core._launch_config import LaunchConfig # noqa: E402 -from cuda.core._launcher import launch # noqa: E402 -from cuda.core._layout import _StridedLayout # noqa: E402 -from cuda.core._linker import Linker, LinkerOptions # noqa: E402 -from cuda.core._memory import ( # noqa: E402 +from cuda.core._graphics import GraphicsResource +from cuda.core._launch_config import LaunchConfig +from cuda.core._launcher import launch +from cuda.core._layout import _StridedLayout +from cuda.core._linker import Linker, LinkerOptions +from cuda.core._memory import ( Buffer, DeviceMemoryResource, DeviceMemoryResourceOptions, @@ -56,13 +56,13 @@ VirtualMemoryResource, VirtualMemoryResourceOptions, ) -from cuda.core._memoryview import ( # noqa: E402 - StridedMemoryView, # noqa: E402 - args_viewable_as_strided_memory, # noqa: E402 +from cuda.core._memoryview import ( + StridedMemoryView, + args_viewable_as_strided_memory, ) -from cuda.core._module import Kernel, ObjectCode # noqa: E402 -from cuda.core._program import Program, ProgramOptions # noqa: E402 -from cuda.core._stream import ( # noqa: E402 +from cuda.core._module import Kernel, ObjectCode +from cuda.core._program import Program, ProgramOptions +from cuda.core._stream import ( LEGACY_DEFAULT_STREAM, PER_THREAD_DEFAULT_STREAM, Stream, diff --git a/cuda_core/cuda/core/_memory/__init__.py b/cuda_core/cuda/core/_memory/__init__.py index 9d141ebca2..068a6526b7 100644 --- a/cuda_core/cuda/core/_memory/__init__.py +++ b/cuda_core/cuda/core/_memory/__init__.py @@ -2,11 +2,11 @@ # # SPDX-License-Identifier: Apache-2.0 -from ._buffer import * # noqa: F403 -from ._device_memory_resource import * # noqa: F403 -from ._graph_memory_resource import * # noqa: F403 -from ._ipc import * # noqa: F403 -from ._legacy import * # noqa: F403 -from ._managed_memory_resource import * # noqa: F403 -from ._pinned_memory_resource import * # noqa: F403 -from ._virtual_memory_resource import * # noqa: F403 +from ._buffer import * +from ._device_memory_resource import * +from ._graph_memory_resource import * +from ._ipc import * +from ._legacy import * +from ._managed_memory_resource import * +from ._pinned_memory_resource import * +from ._virtual_memory_resource import * diff --git a/cuda_core/cuda/core/_memory/_virtual_memory_resource.py b/cuda_core/cuda/core/_memory/_virtual_memory_resource.py index b515b6a4be..1e98734e8d 100644 --- a/cuda_core/cuda/core/_memory/_virtual_memory_resource.py +++ b/cuda_core/cuda/core/_memory/_virtual_memory_resource.py @@ -389,7 +389,7 @@ def _remap_old(): try: (res,) = driver.cuMemMap(int(buf.handle), aligned_prev_size, 0, old_handle, 0) raise_if_driver_error(res) - except Exception: # noqa: S110 + except Exception: # TODO: consider logging this exception pass diff --git a/cuda_core/cuda/core/_utils/driver_cu_result_explanations.py b/cuda_core/cuda/core/_utils/driver_cu_result_explanations.py index a025fc044c..cbd2412a2e 100644 --- a/cuda_core/cuda/core/_utils/driver_cu_result_explanations.py +++ b/cuda_core/cuda/core/_utils/driver_cu_result_explanations.py @@ -6,7 +6,6 @@ # Replace the dictionary below with the output. # Also update the CUDA Toolkit version number below. -# ruff: noqa: E501 # CUDA Toolkit v13.1.0 DRIVER_CU_RESULT_EXPLANATIONS = { 0: ( diff --git a/cuda_core/cuda/core/_utils/runtime_cuda_error_explanations.py b/cuda_core/cuda/core/_utils/runtime_cuda_error_explanations.py index dd73e36cc8..442b39a6fc 100644 --- a/cuda_core/cuda/core/_utils/runtime_cuda_error_explanations.py +++ b/cuda_core/cuda/core/_utils/runtime_cuda_error_explanations.py @@ -6,7 +6,6 @@ # Replace the dictionary below with the output. # Also update the CUDA Toolkit version number below. -# ruff: noqa: E501 # CUDA Toolkit v13.1.0 RUNTIME_CUDA_ERROR_EXPLANATIONS = { 0: ( diff --git a/cuda_core/cuda/core/experimental/__init__.py b/cuda_core/cuda/core/experimental/__init__.py index 7f5c5caf21..e7989f0f26 100644 --- a/cuda_core/cuda/core/experimental/__init__.py +++ b/cuda_core/cuda/core/experimental/__init__.py @@ -38,25 +38,25 @@ def _warn_deprecated(): _warn_deprecated() -from cuda.core import system, utils # noqa: E402 +from cuda.core import system, utils # Make utils accessible as a submodule for backward compatibility __import__("sys").modules[__spec__.name + ".utils"] = utils -from cuda.core._device import Device # noqa: E402 -from cuda.core._event import Event, EventOptions # noqa: E402 -from cuda.core._graph import ( # noqa: E402 +from cuda.core._device import Device +from cuda.core._event import Event, EventOptions +from cuda.core._graph import ( Graph, GraphBuilder, GraphCompleteOptions, GraphDebugPrintOptions, ) -from cuda.core._launch_config import LaunchConfig # noqa: E402 -from cuda.core._launcher import launch # noqa: E402 -from cuda.core._layout import _StridedLayout # noqa: E402 -from cuda.core._linker import Linker, LinkerOptions # noqa: E402 -from cuda.core._memory import ( # noqa: E402 +from cuda.core._launch_config import LaunchConfig +from cuda.core._launcher import launch +from cuda.core._layout import _StridedLayout +from cuda.core._linker import Linker, LinkerOptions +from cuda.core._memory import ( Buffer, DeviceMemoryResource, DeviceMemoryResourceOptions, @@ -70,6 +70,6 @@ def _warn_deprecated(): VirtualMemoryResource, VirtualMemoryResourceOptions, ) -from cuda.core._module import Kernel, ObjectCode # noqa: E402 -from cuda.core._program import Program, ProgramOptions # noqa: E402 -from cuda.core._stream import Stream, StreamOptions # noqa: E402 +from cuda.core._module import Kernel, ObjectCode +from cuda.core._program import Program, ProgramOptions +from cuda.core._stream import Stream, StreamOptions diff --git a/cuda_core/cuda/core/system/__init__.py b/cuda_core/cuda/core/system/__init__.py index 8c1953c5d7..6357b348bb 100644 --- a/cuda_core/cuda/core/system/__init__.py +++ b/cuda_core/cuda/core/system/__init__.py @@ -2,7 +2,6 @@ # # SPDX-License-Identifier: Apache-2.0 -# ruff: noqa: F403, F405 # NOTE: We must maintain that it is always possible to import this module diff --git a/cuda_core/cuda/core/utils.py b/cuda_core/cuda/core/utils.py index f15d924277..d59bf4b876 100644 --- a/cuda_core/cuda/core/utils.py +++ b/cuda_core/cuda/core/utils.py @@ -3,6 +3,6 @@ # SPDX-License-Identifier: Apache-2.0 from cuda.core._memoryview import ( - StridedMemoryView, # noqa: F401 - args_viewable_as_strided_memory, # noqa: F401 + StridedMemoryView, + args_viewable_as_strided_memory, ) diff --git a/cuda_core/tests/example_tests/utils.py b/cuda_core/tests/example_tests/utils.py index 9b5dc57e5f..4ccc0213b4 100644 --- a/cuda_core/tests/example_tests/utils.py +++ b/cuda_core/tests/example_tests/utils.py @@ -29,7 +29,7 @@ def run_example(samples_path, filename, env=None): old_sys_path = sys.path.copy() sys.path.append(samples_path) # TODO: Refactor the examples to give them a common callable `main()` to avoid needing to use exec here? - exec(script, env if env else {}) # noqa: S102 + exec(script, env if env else {}) except ImportError as e: # for samples requiring any of optional dependencies for m in ("cupy", "torch"): diff --git a/cuda_core/tests/helpers/__init__.py b/cuda_core/tests/helpers/__init__.py index bebc00f407..efe41f7015 100644 --- a/cuda_core/tests/helpers/__init__.py +++ b/cuda_core/tests/helpers/__init__.py @@ -6,7 +6,7 @@ from typing import Union from cuda.core._utils.cuda_utils import handle_return -from cuda_python_test_helpers import * # noqa: F403 +from cuda_python_test_helpers import * CUDA_PATH = os.environ.get("CUDA_PATH") CUDA_INCLUDE_PATH = None @@ -29,7 +29,7 @@ def supports_ipc_mempool(device_id: Union[int, object]) -> bool: to check for CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR support. Does not require an active CUDA context. """ - if IS_WSL: # noqa: F405 + if IS_WSL: return False try: diff --git a/cuda_core/tests/memory_ipc/test_errors.py b/cuda_core/tests/memory_ipc/test_errors.py index 1156f30dfe..37e565e5a0 100644 --- a/cuda_core/tests/memory_ipc/test_errors.py +++ b/cuda_core/tests/memory_ipc/test_errors.py @@ -118,13 +118,13 @@ def PARENT_ACTION(self, queue): options = DeviceMemoryResourceOptions(max_size=POOL_SIZE, ipc_enabled=True) mr2 = DeviceMemoryResource(self.device, options=options) self.buffer = mr2.allocate(NBYTES) - buffer_s = pickle.dumps(self.buffer) # noqa: S301 + buffer_s = pickle.dumps(self.buffer) queue.put(buffer_s) # Note: mr2 not sent def CHILD_ACTION(self, queue): Device().set_current() buffer_s = queue.get(timeout=CHILD_TIMEOUT_SEC) - pickle.loads(buffer_s) # noqa: S301 + pickle.loads(buffer_s) def ASSERT(self, exc_type, exc_msg): assert exc_type is RuntimeError diff --git a/cuda_core/tests/memory_ipc/test_serialize.py b/cuda_core/tests/memory_ipc/test_serialize.py index c562c91c90..c3be38d078 100644 --- a/cuda_core/tests/memory_ipc/test_serialize.py +++ b/cuda_core/tests/memory_ipc/test_serialize.py @@ -159,7 +159,7 @@ def test_main(self, ipc_device, ipc_memory_resource): def child_main(self, alloc_handle, mr1, buffer_desc, buffer): device = Device() device.set_current() - mr2 = DeviceMemoryResource.from_allocation_handle(device, alloc_handle) # noqa: F841 + mr2 = DeviceMemoryResource.from_allocation_handle(device, alloc_handle) pgen = PatternGen(device, NBYTES) # Verify initial content diff --git a/cuda_core/tests/memory_ipc/test_workerpool.py b/cuda_core/tests/memory_ipc/test_workerpool.py index ed66c95d33..a55151b2a0 100644 --- a/cuda_core/tests/memory_ipc/test_workerpool.py +++ b/cuda_core/tests/memory_ipc/test_workerpool.py @@ -127,7 +127,7 @@ def test_main(self, ipc_device, nmrs): def process_buffer(self, device, buffer_s): device.set_current() - buffer = pickle.loads(buffer_s) # noqa: S301 + buffer = pickle.loads(buffer_s) pgen = PatternGen(device, NBYTES) pgen.fill_buffer(buffer, seed=True) buffer.close() diff --git a/cuda_core/tests/system/test_nvml_context.py b/cuda_core/tests/system/test_nvml_context.py index 199b4a67ad..16bc97f385 100644 --- a/cuda_core/tests/system/test_nvml_context.py +++ b/cuda_core/tests/system/test_nvml_context.py @@ -2,7 +2,6 @@ # # SPDX-License-Identifier: Apache-2.0 -# ruff: noqa: E402 from .conftest import skip_if_nvml_unsupported diff --git a/cuda_core/tests/system/test_system_device.py b/cuda_core/tests/system/test_system_device.py index 74a5160cc6..1fa9204081 100644 --- a/cuda_core/tests/system/test_system_device.py +++ b/cuda_core/tests/system/test_system_device.py @@ -2,7 +2,6 @@ # # SPDX-License-Identifier: Apache-2.0 -# ruff: noqa: E402 from .conftest import skip_if_nvml_unsupported, unsupported_before @@ -40,7 +39,7 @@ def test_devices_are_the_same_architecture(): all_arches = set(device.arch for device in system.Device.get_all_devices()) if len(all_arches) > 1: - warnings.warn( # noqa: B028 + warnings.warn( f"System has devices of multiple architectures ({', '.join(x.name for x in all_arches)}). " f" Some tests may be skipped unexpectedly", UserWarning, diff --git a/cuda_core/tests/system/test_system_events.py b/cuda_core/tests/system/test_system_events.py index b676cbe925..8cdb10a4e9 100644 --- a/cuda_core/tests/system/test_system_events.py +++ b/cuda_core/tests/system/test_system_events.py @@ -2,7 +2,6 @@ # # SPDX-License-Identifier: Apache-2.0 -# ruff: noqa: E402 from .conftest import skip_if_nvml_unsupported diff --git a/cuda_core/tests/system/test_system_system.py b/cuda_core/tests/system/test_system_system.py index ebc8af12bb..cb260a0e0a 100644 --- a/cuda_core/tests/system/test_system_system.py +++ b/cuda_core/tests/system/test_system_system.py @@ -2,7 +2,6 @@ # # SPDX-License-Identifier: Apache-2.0 -# ruff: noqa: E402 import os diff --git a/cuda_core/tests/test_graphics.py b/cuda_core/tests/test_graphics.py index 6474c38be4..9e2418209c 100644 --- a/cuda_core/tests/test_graphics.py +++ b/cuda_core/tests/test_graphics.py @@ -47,7 +47,7 @@ def _gl_context_and_buffer(nbytes=1024): win = pyglet.window.Window(visible=False, config=config) win.switch_to() else: - from pyglet.gl import headless # noqa: F401 + from pyglet.gl import headless from pyglet.gl import gl as _gl @@ -66,12 +66,12 @@ def _gl_context_and_buffer(nbytes=1024): if buf_id is not None and buf_id.value: _gl.glDeleteBuffers(1, ctypes.byref(buf_id)) - except Exception: # noqa: S110 + except Exception: pass try: if win is not None: win.close() - except Exception: # noqa: S110 + except Exception: pass @@ -98,7 +98,7 @@ def _gl_context_and_texture(width=16, height=16): win = pyglet.window.Window(visible=False, config=config) win.switch_to() else: - from pyglet.gl import headless # noqa: F401 + from pyglet.gl import headless from pyglet.gl import gl as _gl @@ -130,12 +130,12 @@ def _gl_context_and_texture(width=16, height=16): if tex_id is not None and tex_id.value: _gl.glDeleteTextures(1, ctypes.byref(tex_id)) - except Exception: # noqa: S110 + except Exception: pass try: if win is not None: win.close() - except Exception: # noqa: S110 + except Exception: pass diff --git a/cuda_core/tests/test_memory.py b/cuda_core/tests/test_memory.py index 0cc0f4aafc..a5bd25a9d1 100644 --- a/cuda_core/tests/test_memory.py +++ b/cuda_core/tests/test_memory.py @@ -148,7 +148,7 @@ def test_package_contents(): "VirtualMemoryResource", ] d = {} - exec("from cuda.core._memory import *", d) # noqa: S102 + exec("from cuda.core._memory import *", d) d = {k: v for k, v in d.items() if not k.startswith("__")} assert sorted(expected) == sorted(d.keys()) diff --git a/cuda_core/tests/test_memory_peer_access.py b/cuda_core/tests/test_memory_peer_access.py index db9fb4885e..4da1a3ffb4 100644 --- a/cuda_core/tests/test_memory_peer_access.py +++ b/cuda_core/tests/test_memory_peer_access.py @@ -61,13 +61,13 @@ def check(expected): # No access to begin with. check(expected=()) # fmt: off - dmr.peer_accessible_by = (0,) ; check(expected=()) # noqa: E702 - dmr.peer_accessible_by = (1,) ; check(expected=(1,)) # noqa: E702 - dmr.peer_accessible_by = (0, 1) ; check(expected=(1,)) # noqa: E702 - dmr.peer_accessible_by = () ; check(expected=()) # noqa: E702 - dmr.peer_accessible_by = [0, 1] ; check(expected=(1,)) # noqa: E702 - dmr.peer_accessible_by = set() ; check(expected=()) # noqa: E702 - dmr.peer_accessible_by = [1, 1, 1, 1, 1] ; check(expected=(1,)) # noqa: E702 + dmr.peer_accessible_by = (0,) ; check(expected=()) + dmr.peer_accessible_by = (1,) ; check(expected=(1,)) + dmr.peer_accessible_by = (0, 1) ; check(expected=(1,)) + dmr.peer_accessible_by = () ; check(expected=()) + dmr.peer_accessible_by = [0, 1] ; check(expected=(1,)) + dmr.peer_accessible_by = set() ; check(expected=()) + dmr.peer_accessible_by = [1, 1, 1, 1, 1] ; check(expected=(1,)) # fmt: on with pytest.raises(ValueError, match=r"device_id must be \>\= 0"): diff --git a/cuda_core/tests/test_module.py b/cuda_core/tests/test_module.py index 9293cda2ba..b7d1334417 100644 --- a/cuda_core/tests/test_module.py +++ b/cuda_core/tests/test_module.py @@ -415,7 +415,7 @@ def test_occupancy_max_potential_cluster_size(get_saxpy_kernel_cubin): def test_module_serialization_roundtrip(get_saxpy_kernel_cubin): _, objcode = get_saxpy_kernel_cubin - result = pickle.loads(pickle.dumps(objcode)) # noqa: S403, S301 + result = pickle.loads(pickle.dumps(objcode)) assert isinstance(result, ObjectCode) assert objcode.code == result.code diff --git a/cuda_core/tests/test_object_protocols.py b/cuda_core/tests/test_object_protocols.py index e456b3e81e..3eada96049 100644 --- a/cuda_core/tests/test_object_protocols.py +++ b/cuda_core/tests/test_object_protocols.py @@ -340,7 +340,7 @@ def test_equality_basic(fixture_name, request): """Object equality: reflexive, not equal to None or other types.""" obj = request.getfixturevalue(fixture_name) assert obj == obj - assert obj != None # noqa: E711 + assert obj != None assert obj != "string" if hasattr(obj, "handle"): assert obj != obj.handle diff --git a/cuda_core/tests/test_program.py b/cuda_core/tests/test_program.py index 5eb83f9118..7bc5f5529e 100644 --- a/cuda_core/tests/test_program.py +++ b/cuda_core/tests/test_program.py @@ -90,7 +90,7 @@ def _has_nvrtc_pch_apis_for_tests(): !nvvmir.version = !{{!1}} !1 = !{{i32 {major}, i32 {minor}, i32 {debug_major}, i32 {debug_minor}}} -""" # noqa: E501 +""" def _get_libnvvm_version_for_tests(): @@ -196,7 +196,7 @@ def nvvm_ir(): !nvvmir.version = !{{!1}} !1 = !{{i32 {major}, i32 {minor}, i32 {debug_major}, i32 {debug_minor}}} -""" # noqa: E501 +""" return nvvm_ir_template.format(major=major, minor=minor, debug_major=debug_major, debug_minor=debug_minor) @@ -464,7 +464,7 @@ def test_nvvm_program_creation_compilation(nvvm_ir): assert program.handle is not None obj = program.compile("ptx") try: - ker = obj.get_kernel("simple") # noqa: F841 + ker = obj.get_kernel("simple") except CUDAError as e: if re.search(r"CUDA_ERROR_UNSUPPORTED_PTX_VERSION", str(e)): pytest.xfail("PTX version not supported by current CUDA Driver") @@ -568,7 +568,7 @@ def test_nvvm_program_with_single_extra_source(nvvm_ir): !nvvmir.version = !{{!0}} !0 = !{{i32 {major}, i32 {minor}, i32 {debug_major}, i32 {debug_minor}}} -""" # noqa: E501 +""" options = ProgramOptions( name="multi_module_test", @@ -621,7 +621,7 @@ def test_nvvm_program_with_multiple_extra_sources(): !nvvmir.version = !{{!1}} !1 = !{{i32 {major}, i32 {minor}, i32 {debug_major}, i32 {debug_minor}}} -""" # noqa: E501 +""" helper1_ir = f"""target triple = "nvptx64-unknown-cuda" target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-i128:128:128-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64" @@ -634,7 +634,7 @@ def test_nvvm_program_with_multiple_extra_sources(): !nvvmir.version = !{{!0}} !0 = !{{i32 {major}, i32 {minor}, i32 {debug_major}, i32 {debug_minor}}} -""" # noqa: E501 +""" helper2_ir = f"""target triple = "nvptx64-unknown-cuda" target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-i128:128:128-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64" @@ -647,7 +647,7 @@ def test_nvvm_program_with_multiple_extra_sources(): !nvvmir.version = !{{!0}} !0 = !{{i32 {major}, i32 {minor}, i32 {debug_major}, i32 {debug_minor}}} -""" # noqa: E501 +""" options = ProgramOptions( name="nvvm_multi_helper_test", @@ -671,7 +671,7 @@ def test_nvvm_program_with_multiple_extra_sources(): @nvvm_available -def test_bitcode_format(minimal_nvvmir): # noqa: F811 +def test_bitcode_format(minimal_nvvmir): from contextlib import ExitStack, closing if len(minimal_nvvmir) < 4: diff --git a/cuda_core/tests/test_utils.py b/cuda_core/tests/test_utils.py index e7dd140d96..22bfbde1b6 100644 --- a/cuda_core/tests/test_utils.py +++ b/cuda_core/tests/test_utils.py @@ -584,7 +584,7 @@ def test_from_array_interface_unsupported_strides(init_cuda): smv = StridedMemoryView.from_array_interface(b) with pytest.raises(ValueError, match="strides must be divisible by itemsize"): # TODO: ideally this would raise on construction - smv.strides # noqa: B018 + smv.strides @pytest.mark.parametrize( @@ -668,4 +668,4 @@ def test_ml_dtypes_bfloat16_dlpack_requires_ml_dtypes(init_cuda, no_ml_dtypes, a a = cp.array([1, 2, 3], dtype="bfloat16") smv = api(a, stream_ptr=0) with pytest.raises(NotImplementedError, match=r"requires `ml_dtypes`"): - smv.dtype # noqa: B018 + smv.dtype From c01fa303a6e26bb44dcc57ea925428cd010ea3c2 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:47:12 -0500 Subject: [PATCH 06/42] fix(ruff/cuda_core): C4 simplify comprehensions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - C416: unnecessary-comprehension — use set()/list() directly - C401: unnecessary-generator-set — use set comprehension - C419: unnecessary-comprehension-in-call — use generator in all()/any() - C400: unnecessary-generator-list — use list comprehension - C414: unnecessary-double-cast-or-process — remove redundant list() - C420: unnecessary-dict-comprehension — use dict.fromkeys() 40 fixed across 10 files Made-with: Cursor --- cuda_core/build_hooks.py | 2 +- cuda_core/tests/graph/test_options.py | 2 +- cuda_core/tests/helpers/layout.py | 2 +- cuda_core/tests/system/test_system_device.py | 8 ++-- cuda_core/tests/test_device.py | 4 +- cuda_core/tests/test_memory.py | 6 +-- cuda_core/tests/test_module.py | 4 +- cuda_core/tests/test_program.py | 2 +- cuda_core/tests/test_strided_layout.py | 40 ++++++++++---------- cuda_core/tests/test_utils.py | 2 +- 10 files changed, 36 insertions(+), 36 deletions(-) diff --git a/cuda_core/build_hooks.py b/cuda_core/build_hooks.py index 5d615ad003..4c4635f19d 100644 --- a/cuda_core/build_hooks.py +++ b/cuda_core/build_hooks.py @@ -132,7 +132,7 @@ def get_sources(mod_name): return sources - all_include_dirs = list(os.path.join(root, "include") for root in _get_cuda_paths()) + all_include_dirs = [os.path.join(root, "include") for root in _get_cuda_paths()] extra_compile_args = [] if COMPILE_FOR_COVERAGE: # CYTHON_TRACE_NOGIL indicates to trace nogil functions. It is not diff --git a/cuda_core/tests/graph/test_options.py b/cuda_core/tests/graph/test_options.py index 1b2483e47a..33d647f6fe 100644 --- a/cuda_core/tests/graph/test_options.py +++ b/cuda_core/tests/graph/test_options.py @@ -38,7 +38,7 @@ def test_graph_dot_print_options(init_cuda, tmp_path): # Print using all options path = bytes(str(tmp_path / "vlad.dot"), "utf-8") - options = GraphDebugPrintOptions(**{field: True for field in GraphDebugPrintOptions.__dataclass_fields__}) + options = GraphDebugPrintOptions(**dict.fromkeys(GraphDebugPrintOptions.__dataclass_fields__, True)) gb.debug_dot_print(path, options) diff --git a/cuda_core/tests/helpers/layout.py b/cuda_core/tests/helpers/layout.py index 4067eaa6a9..e4102f4d45 100644 --- a/cuda_core/tests/helpers/layout.py +++ b/cuda_core/tests/helpers/layout.py @@ -117,7 +117,7 @@ def flatten_mask2str(mask, ndim): def random_permutations(rng, perm_len, cutoff_len=3, sample_size=6): if perm_len <= cutoff_len: - return [perm for perm in itertools.permutations(range(perm_len))] + return list(itertools.permutations(range(perm_len))) perms = [] for _ in range(sample_size): perm = list(range(perm_len)) diff --git a/cuda_core/tests/system/test_system_device.py b/cuda_core/tests/system/test_system_device.py index 1fa9204081..83a71a13ec 100644 --- a/cuda_core/tests/system/test_system_device.py +++ b/cuda_core/tests/system/test_system_device.py @@ -36,7 +36,7 @@ def test_devices_are_the_same_architecture(): # they won't be tested properly. This tests for the (hopefully rare) case # where a system has devices of different architectures and produces a warning. - all_arches = set(device.arch for device in system.Device.get_all_devices()) + all_arches = {device.arch for device in system.Device.get_all_devices()} if len(all_arches) > 1: warnings.warn( @@ -129,7 +129,7 @@ def test_device_cuda_compute_capability(): cuda_compute_capability = device.cuda_compute_capability assert isinstance(cuda_compute_capability, tuple) assert len(cuda_compute_capability) == 2 - assert all([isinstance(i, int) for i in cuda_compute_capability]) + assert all(isinstance(i, int) for i in cuda_compute_capability) assert 3 <= cuda_compute_capability[0] <= 99 assert 0 <= cuda_compute_capability[1] <= 9 @@ -241,13 +241,13 @@ def test_device_uuid(): [ { "input": [1152920405096267775, 0], - "output": [i for i in range(20)] + [i + 40 for i in range(20)], + "output": list(range(20)) + [i + 40 for i in range(20)], }, { "input": [17293823668613283840, 65535], "output": [i + 20 for i in range(20)] + [i + 60 for i in range(20)], }, - {"input": [18446744073709551615, 0], "output": [i for i in range(64)]}, + {"input": [18446744073709551615, 0], "output": list(range(64))}, {"input": [0, 18446744073709551615], "output": [i + 64 for i in range(64)]}, ], ) diff --git a/cuda_core/tests/test_device.py b/cuda_core/tests/test_device.py index 83b71d617a..95e47ce8d9 100644 --- a/cuda_core/tests/test_device.py +++ b/cuda_core/tests/test_device.py @@ -319,8 +319,8 @@ def test_device_property_types(property_name, expected_type): def test_device_properties_complete(): device = Device() - live_props = set(attr for attr in dir(device.properties) if not attr.startswith("_")) - tab_props = set(attr for attr, _ in cuda_base_properties) + live_props = {attr for attr in dir(device.properties) if not attr.startswith("_")} + tab_props = {attr for attr, _ in cuda_base_properties} excluded_props = set() # Exclude CUDA 13+ specific properties when not available diff --git a/cuda_core/tests/test_memory.py b/cuda_core/tests/test_memory.py index a5bd25a9d1..62e71ac869 100644 --- a/cuda_core/tests/test_memory.py +++ b/cuda_core/tests/test_memory.py @@ -1223,11 +1223,11 @@ def test_mempool_attributes_ownership(memory_resource_factory): device.set_current() if MR is DeviceMemoryResource: - mr = MR(device, dict(max_size=POOL_SIZE)) + mr = MR(device, {"max_size": POOL_SIZE}) elif MR is PinnedMemoryResource: - mr = MR(dict(max_size=POOL_SIZE)) + mr = MR({"max_size": POOL_SIZE}) elif MR is ManagedMemoryResource: - mr = create_managed_memory_resource_or_skip(dict()) + mr = create_managed_memory_resource_or_skip({}) attributes = mr.attributes mr.close() diff --git a/cuda_core/tests/test_module.py b/cuda_core/tests/test_module.py index b7d1334417..f841d74884 100644 --- a/cuda_core/tests/test_module.py +++ b/cuda_core/tests/test_module.py @@ -276,8 +276,8 @@ class ExpectedStruct(ctypes.Structure): members = tuple(getattr(ExpectedStruct, f"arg_{i}") for i in range(nargs)) arg_info = krn.arguments_info - assert all([actual.offset == expected.offset for actual, expected in zip(arg_info, members)]) - assert all([actual.size == expected.size for actual, expected in zip(arg_info, members)]) + assert all(actual.offset == expected.offset for actual, expected in zip(arg_info, members)) + assert all(actual.size == expected.size for actual, expected in zip(arg_info, members)) def test_num_args_error_handling(deinit_all_contexts_function, cuda12_4_prerequisite_check): diff --git a/cuda_core/tests/test_program.py b/cuda_core/tests/test_program.py index 7bc5f5529e..565305a1e3 100644 --- a/cuda_core/tests/test_program.py +++ b/cuda_core/tests/test_program.py @@ -325,7 +325,7 @@ def test_cpp_program_with_pch_options(init_cuda, tmp_path): path = str(tmp_path / "test.pch") - for opts in (dict(create_pch=path), dict(use_pch=path)): + for opts in ({"create_pch": path}, {"use_pch": path}): options = ProgramOptions(**opts) program = Program(code, "c++", options) assert program.backend == "NVRTC" diff --git a/cuda_core/tests/test_strided_layout.py b/cuda_core/tests/test_strided_layout.py index 7c17ded7f3..67c25d07f8 100644 --- a/cuda_core/tests/test_strided_layout.py +++ b/cuda_core/tests/test_strided_layout.py @@ -162,7 +162,7 @@ def _cmp_slice_offset( "layout_spec", [ LayoutSpec(shape, py_rng.choice(_ITEMSIZES), stride_order) - for shape in [tuple(), (5,), (7, 9), (2, 3, 4)] + for shape in [(), (5,), (7, 9), (2, 3, 4)] for stride_order in random_permutations(py_rng, len(shape)) ], ids=pretty_name, @@ -183,7 +183,7 @@ def test_dense_with_permutation_as_stride_order(layout_spec): [ LayoutSpec(shape, py_rng.choice(_ITEMSIZES), stride_order, perm=permutation) for shape in [ - tuple(), + (), (1,), (2, 3), (5, 6, 7), @@ -233,7 +233,7 @@ class PermutedErr(Enum): error_msg, ) for shape, permutation, error_msg in [ - (tuple(), (5,), PermutedErr.WRONG_LEN), + ((), (5,), PermutedErr.WRONG_LEN), ((1,), (0, 0), PermutedErr.WRONG_LEN), ((2, 5, 3), (1, 0, 1), PermutedErr.REPEATED_AXIS), ((5, 6, 7), (1, 3, 0), PermutedErr.OUT_OF_RANGE), @@ -264,7 +264,7 @@ class SliceErr(Enum): error_msg, ) for shape, slices, error_msg in [ - (tuple(), tuple(), None), + ((), (), None), ((12,), _S[:], None), ((13,), _S[::-1], None), ((13,), [_S[::-1], _S[::-1]], None), @@ -339,12 +339,12 @@ class ReshapeErr(Enum): error_msg, ) for shape, permutation, slices, new_shape, error_msg in [ - (tuple(), None, None, tuple(), None), - (tuple(), None, None, (1,), None), - (tuple(), None, None, (-1,), None), - (tuple(), None, None, (1, -1, 1), None), + ((), None, None, (), None), + ((), None, None, (1,), None), + ((), None, None, (-1,), None), + ((), None, None, (1, -1, 1), None), ((1,), None, None, (-1,), None), - ((1,), None, None, tuple(), None), + ((1,), None, None, (), None), ((12,), None, _S[:], (12,), None), ((12,), None, None, (11,), ReshapeErr.VOLUME_MISMATCH), ((12,), None, _S[1:], (11,), None), @@ -471,7 +471,7 @@ def test_reshape(layout_spec, new_shape, error_msg): NamedParam("axes_range", axes_range), ) for shape, permutation, slices, expected_shape, expected_strides, expected_axis_mask, axes_range in [ - (tuple(), None, None, (1,), (1,), "", None), + ((), None, None, (1,), (1,), "", None), ((12,), None, _S[:], (12,), (1,), "0", None), ((1, 2, 3, 4, 5), None, None, (120,), (1,), "01111", None), ((1, 2, 3, 0, 5), None, None, (0,), (0,), "01111", None), @@ -544,14 +544,14 @@ def test_flatten( ) for layout_spec_0, layout_spec_1, expected_layout_spec_0, expected_layout_spec_1 in [ ( - LayoutSpec(tuple(), 2, DenseOrder.C), - LayoutSpec(tuple(), 4, DenseOrder.C), + LayoutSpec((), 2, DenseOrder.C), + LayoutSpec((), 4, DenseOrder.C), LayoutSpec((1,), 2, DenseOrder.C), LayoutSpec((1,), 4, DenseOrder.C), ), ( - LayoutSpec(tuple(), 2, DenseOrder.IMPLICIT_C), - LayoutSpec(tuple(), 4, DenseOrder.IMPLICIT_C), + LayoutSpec((), 2, DenseOrder.IMPLICIT_C), + LayoutSpec((), 4, DenseOrder.IMPLICIT_C), LayoutSpec((1,), 2, DenseOrder.C), LayoutSpec((1,), 4, DenseOrder.C), ), @@ -652,7 +652,7 @@ def test_flatten_together( ), ) for shape, permutation, slices in [ - (tuple(), None, None), + ((), None, None), ((12,), None, None), ((1, 5, 4, 3), None, None), ((1, 5, 1, 4, 3), None, _S[:, -1:, :]), @@ -697,7 +697,7 @@ def test_squeezed(layout_spec): NamedParam("axes", axes), ) for shape, slices in [ - (tuple(), None), + ((), None), ((7,), None), ((4, 5, 7, 11), _S[1:-1, ::-1, 2:-1, ::3]), ] @@ -813,9 +813,9 @@ def test_packed_unpacked( NamedParam("new_shape", new_shape), ) for shape, slices, new_shape in [ - (tuple(), None, tuple()), - (tuple(), None, (1,)), - (tuple(), None, (17, 1, 5)), + ((), None, ()), + ((), None, (1,)), + ((), None, (17, 1, 5)), ((1,), None, (5,)), ((1,), None, (3, 5, 2)), ((7,), None, (7,)), @@ -875,7 +875,7 @@ def test_broadcast_layout( NamedParam("new_stride_order", new_stride_order), ) for shape, permutation, slices in [ - (tuple(), None, None), + ((), None, None), ((1,), None, None), ((7,), None, None), ((7,), None, _S[3:6]), diff --git a/cuda_core/tests/test_utils.py b/cuda_core/tests/test_utils.py index 22bfbde1b6..dd27542528 100644 --- a/cuda_core/tests/test_utils.py +++ b/cuda_core/tests/test_utils.py @@ -294,7 +294,7 @@ def _dense_strides(shape, stride_order): return tuple(strides) -@pytest.mark.parametrize("shape", [tuple(), (2, 3), (10, 10), (10, 13, 11)], ids=str) +@pytest.mark.parametrize("shape", [(), (2, 3), (10, 10), (10, 13, 11)], ids=str) @pytest.mark.parametrize("dtype", [np.dtype(np.int8), np.dtype(np.uint32)], ids=str) @pytest.mark.parametrize("stride_order", ["C", "F"]) @pytest.mark.parametrize("readonly", [True, False]) From 28a59770e151079afdae4d4d613a1c4db62fa539 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:47:22 -0500 Subject: [PATCH 07/42] fix(ruff/cuda_core): PIE misc cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PIE808: unnecessary-range-start — remove redundant range(0, n) - PIE790: unnecessary-placeholder — remove pass after docstring - PIE810: multiple-starts-ends-with — consolidate into tuple arg 3 fixed across 3 files Made-with: Cursor --- cuda_core/cuda/core/_memory/_virtual_memory_resource.py | 1 - cuda_core/tests/memory_ipc/test_leaks.py | 1 - cuda_core/tests/test_helpers.py | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cuda_core/cuda/core/_memory/_virtual_memory_resource.py b/cuda_core/cuda/core/_memory/_virtual_memory_resource.py index 1e98734e8d..ccfad88f71 100644 --- a/cuda_core/cuda/core/_memory/_virtual_memory_resource.py +++ b/cuda_core/cuda/core/_memory/_virtual_memory_resource.py @@ -97,7 +97,6 @@ class VirtualMemoryResourceOptions: "host_numa_current": _l.CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT, } # CUDA 13+ exposes MANAGED in CUmemAllocationType; older 12.x does not - _a = driver.CUmemAllocationType _allocation_type = {"pinned": _a.CU_MEM_ALLOCATION_TYPE_PINNED} ver_major, ver_minor = get_binding_version() if ver_major >= 13: diff --git a/cuda_core/tests/memory_ipc/test_leaks.py b/cuda_core/tests/memory_ipc/test_leaks.py index 0122dd4904..b89f198699 100644 --- a/cuda_core/tests/memory_ipc/test_leaks.py +++ b/cuda_core/tests/memory_ipc/test_leaks.py @@ -59,7 +59,6 @@ def exec_launch_failure(obj, number=1): def child_main_bad(): """Fails when passed arguments.""" - pass def exec_reduce_failure(obj, number=1): diff --git a/cuda_core/tests/test_helpers.py b/cuda_core/tests/test_helpers.py index d0c8f8d66c..bd13ed5067 100644 --- a/cuda_core/tests/test_helpers.py +++ b/cuda_core/tests/test_helpers.py @@ -61,7 +61,7 @@ def test_patterngen_seeds(): # We test a sampling of values because exhaustive testing is too slow, # especially on Windows. See https://github.com/NVIDIA/cuda-python/issues/1455 pgen = PatternGen(device, NBYTES) - for i in (ii for ii in range(0, 256) if ii < 5 or ii % 17 == 0): + for i in (ii for ii in range(256) if ii < 5 or ii % 17 == 0): pgen.fill_buffer(buffer, seed=i) pgen.verify_buffer(buffer, seed=i) for j in (jj for jj in range(i + 1, 256) if jj < 5 or jj % 19 == 0): From 63702cff8a1903c68ebbdbba43d928e778ca65d5 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:47:55 -0500 Subject: [PATCH 08/42] fix(ruff/cuda_core): PT pytest-style fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PT003: extraneous-scope-function — remove default scope="function" - PT022: pytest-useless-yield-fixture — convert yield fixture to return - PT001: pytest-fixture-incorrect-parentheses — remove empty parentheses - PT013: pytest-incorrect-pytest-import — use pytest.param instead of from pytest import param 18 fixed across 4 files Made-with: Cursor --- cuda_core/tests/conftest.py | 6 +-- cuda_core/tests/test_linker.py | 4 +- cuda_core/tests/test_module.py | 6 +-- cuda_core/tests/test_utils.py | 75 +++++++++++++++++----------------- 4 files changed, 45 insertions(+), 46 deletions(-) diff --git a/cuda_core/tests/conftest.py b/cuda_core/tests/conftest.py index 4e1500b491..b771d04276 100644 --- a/cuda_core/tests/conftest.py +++ b/cuda_core/tests/conftest.py @@ -77,7 +77,7 @@ def session_setup(): multiprocessing.set_start_method("spawn", force=True) -@pytest.fixture(scope="function") +@pytest.fixture def init_cuda(): # TODO: rename this to e.g. init_context device = Device(0) @@ -108,14 +108,14 @@ def _device_unset_current() -> bool: return True -@pytest.fixture(scope="function") +@pytest.fixture def deinit_cuda(): # TODO: rename this to e.g. deinit_context yield _ = _device_unset_current() -@pytest.fixture(scope="function") +@pytest.fixture def deinit_all_contexts_function(): def pop_all_contexts(): max_iters = 256 diff --git a/cuda_core/tests/test_linker.py b/cuda_core/tests/test_linker.py index 0ba914ca8f..302a3172d0 100644 --- a/cuda_core/tests/test_linker.py +++ b/cuda_core/tests/test_linker.py @@ -29,7 +29,7 @@ class nvJitLinkError(Exception): pass -@pytest.fixture(scope="function") +@pytest.fixture def compile_ptx_functions(init_cuda): # Without -rdc (relocatable device code) option, the generated ptx will not included any unreferenced # device functions, causing the link to fail @@ -40,7 +40,7 @@ def compile_ptx_functions(init_cuda): return object_code_a_ptx, object_code_b_ptx, object_code_c_ptx -@pytest.fixture(scope="function") +@pytest.fixture def compile_ltoir_functions(init_cuda): object_code_a_ltoir = Program(kernel_a, "c++", ProgramOptions(link_time_optimization=True)).compile("ltoir") object_code_b_ltoir = Program(device_function_b, "c++", ProgramOptions(link_time_optimization=True)).compile( diff --git a/cuda_core/tests/test_module.py b/cuda_core/tests/test_module.py index f841d74884..b66e8eaf9e 100644 --- a/cuda_core/tests/test_module.py +++ b/cuda_core/tests/test_module.py @@ -61,7 +61,7 @@ def test_object_code_init_disabled(): ObjectCode() # Reject at front door. -@pytest.fixture(scope="function") +@pytest.fixture def get_saxpy_kernel_cubin(init_cuda): # prepare program prog = Program(SAXPY_KERNEL, code_type="c++") @@ -73,7 +73,7 @@ def get_saxpy_kernel_cubin(init_cuda): return mod.get_kernel("saxpy"), mod -@pytest.fixture(scope="function") +@pytest.fixture def get_saxpy_kernel_ptx(init_cuda): # prepare program prog = Program(SAXPY_KERNEL, code_type="c++") @@ -85,7 +85,7 @@ def get_saxpy_kernel_ptx(init_cuda): return ptx, mod -@pytest.fixture(scope="function") +@pytest.fixture def get_saxpy_kernel_ltoir(init_cuda): # Create LTOIR code using link-time optimization prog = Program(SAXPY_KERNEL, code_type="c++", options=ProgramOptions(link_time_optimization=True)) diff --git a/cuda_core/tests/test_utils.py b/cuda_core/tests/test_utils.py index dd27542528..221ed65704 100644 --- a/cuda_core/tests/test_utils.py +++ b/cuda_core/tests/test_utils.py @@ -26,7 +26,6 @@ ml_dtypes = None import numpy as np import pytest -from pytest import param from cuda.core import Device from cuda.core._dlpack import DLDeviceType @@ -84,7 +83,7 @@ def convert_strides_to_counts(strides, itemsize): np.empty((3, 4), order="F"), np.empty((), dtype=np.float16), # readonly is fixed recently (numpy/numpy#26501) - pytest.param( + pytest.pytest.param( np.frombuffer(b""), marks=pytest.mark.skipif( tuple(int(i) for i in np.__version__.split(".")[:2]) < (2, 1), reason="need numpy 2.1.0+" @@ -132,16 +131,16 @@ def gpu_array_samples(): samples = [] if cp is not None: samples += [ - pytest.param(cp.empty(3, dtype=cp.complex64), False, id="cupy-complex64"), - pytest.param(cp.empty((6, 6), dtype=cp.float64)[::2, ::2], True, id="cupy-float64"), - pytest.param(cp.empty((3, 4), order="F"), True, id="cupy-fortran"), + pytest.pytest.param(cp.empty(3, dtype=cp.complex64), False, id="cupy-complex64"), + pytest.pytest.param(cp.empty((6, 6), dtype=cp.float64)[::2, ::2], True, id="cupy-float64"), + pytest.pytest.param(cp.empty((3, 4), order="F"), True, id="cupy-fortran"), ] # Numba's device_array is the only known array container that does not # support DLPack (so that we get to test the CAI coverage). if numba_cuda is not None: samples += [ - pytest.param(numba_cuda.device_array((2,), dtype=np.int8), False, id="numba-cuda-int8"), - pytest.param(numba_cuda.device_array((4, 2), dtype=np.float32), True, id="numba-cuda-float32"), + pytest.pytest.param(numba_cuda.device_array((2,), dtype=np.int8), False, id="numba-cuda-int8"), + pytest.pytest.param(numba_cuda.device_array((4, 2), dtype=np.float32), True, id="numba-cuda-float32"), ] return samples @@ -528,38 +527,38 @@ def test_struct_array(init_cuda): ("x", "expected_dtype"), [ # 1D arrays with different dtypes - param(np.array([1, 2, 3], dtype=np.int32), "int32", id="1d-int32"), - param(np.array([1.0, 2.0, 3.0], dtype=np.float64), "float64", id="1d-float64"), - param(np.array([1 + 2j, 3 + 4j], dtype=np.complex128), "complex128", id="1d-complex128"), - param(np.array([1 + 2j, 3 + 4j, 5 + 6j], dtype=np.complex64), "complex64", id="1d-complex64"), - param(np.array([1, 2, 3, 4, 5], dtype=np.uint8), "uint8", id="1d-uint8"), - param(np.array([1, 2], dtype=np.int64), "int64", id="1d-int64"), - param(np.array([100, 200, 300], dtype=np.int16), "int16", id="1d-int16"), - param(np.array([1000, 2000, 3000], dtype=np.uint16), "uint16", id="1d-uint16"), - param(np.array([10000, 20000, 30000], dtype=np.uint64), "uint64", id="1d-uint64"), + pytest.param(np.array([1, 2, 3], dtype=np.int32), "int32", id="1d-int32"), + pytest.param(np.array([1.0, 2.0, 3.0], dtype=np.float64), "float64", id="1d-float64"), + pytest.param(np.array([1 + 2j, 3 + 4j], dtype=np.complex128), "complex128", id="1d-complex128"), + pytest.param(np.array([1 + 2j, 3 + 4j, 5 + 6j], dtype=np.complex64), "complex64", id="1d-complex64"), + pytest.param(np.array([1, 2, 3, 4, 5], dtype=np.uint8), "uint8", id="1d-uint8"), + pytest.param(np.array([1, 2], dtype=np.int64), "int64", id="1d-int64"), + pytest.param(np.array([100, 200, 300], dtype=np.int16), "int16", id="1d-int16"), + pytest.param(np.array([1000, 2000, 3000], dtype=np.uint16), "uint16", id="1d-uint16"), + pytest.param(np.array([10000, 20000, 30000], dtype=np.uint64), "uint64", id="1d-uint64"), # 2D arrays - C-contiguous - param(np.array([[1, 2, 3], [4, 5, 6]], dtype=np.int32), "int32", id="2d-c-int32"), - param(np.array([[1.0, 2.0], [3.0, 4.0]], dtype=np.float32), "float32", id="2d-c-float32"), + pytest.param(np.array([[1, 2, 3], [4, 5, 6]], dtype=np.int32), "int32", id="2d-c-int32"), + pytest.param(np.array([[1.0, 2.0], [3.0, 4.0]], dtype=np.float32), "float32", id="2d-c-float32"), # 2D arrays - Fortran-contiguous - param(np.array([[1, 2, 3], [4, 5, 6]], dtype=np.int32, order="F"), "int32", id="2d-f-int32"), - param(np.array([[1.0, 2.0], [3.0, 4.0]], dtype=np.float64, order="F"), "float64", id="2d-f-float64"), + pytest.param(np.array([[1, 2, 3], [4, 5, 6]], dtype=np.int32, order="F"), "int32", id="2d-f-int32"), + pytest.param(np.array([[1.0, 2.0], [3.0, 4.0]], dtype=np.float64, order="F"), "float64", id="2d-f-float64"), # 3D arrays - param(np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]], dtype=np.int32), "int32", id="3d-int32"), - param(np.ones((2, 3, 4), dtype=np.float64), "float64", id="3d-float64"), + pytest.param(np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]], dtype=np.int32), "int32", id="3d-int32"), + pytest.param(np.ones((2, 3, 4), dtype=np.float64), "float64", id="3d-float64"), # Sliced/strided arrays - param(np.array([1, 2, 3, 4, 5, 6], dtype=np.int32)[::2], "int32", id="1d-strided-int32"), - param(np.array([[1, 2, 3, 4], [5, 6, 7, 8]], dtype=np.float64)[:, ::2], "float64", id="2d-strided-float64"), - param(np.arange(20, dtype=np.int32).reshape(4, 5)[::2, ::2], "int32", id="2d-strided-2x2-int32"), + pytest.param(np.array([1, 2, 3, 4, 5, 6], dtype=np.int32)[::2], "int32", id="1d-strided-int32"), + pytest.param(np.array([[1, 2, 3, 4], [5, 6, 7, 8]], dtype=np.float64)[:, ::2], "float64", id="2d-strided-float64"), + pytest.param(np.arange(20, dtype=np.int32).reshape(4, 5)[::2, ::2], "int32", id="2d-strided-2x2-int32"), # Scalar (0-D array) - param(np.array(42, dtype=np.int32), "int32", id="scalar-int32"), - param(np.array(3.14, dtype=np.float64), "float64", id="scalar-float64"), + pytest.param(np.array(42, dtype=np.int32), "int32", id="scalar-int32"), + pytest.param(np.array(3.14, dtype=np.float64), "float64", id="scalar-float64"), # Empty arrays - param(np.array([], dtype=np.int32), "int32", id="empty-1d-int32"), - param(np.empty((0, 3), dtype=np.float64), "float64", id="empty-2d-float64"), + pytest.param(np.array([], dtype=np.int32), "int32", id="empty-1d-int32"), + pytest.param(np.empty((0, 3), dtype=np.float64), "float64", id="empty-2d-float64"), # Single element - param(np.array([1], dtype=np.int32), "int32", id="single-element"), + pytest.param(np.array([1], dtype=np.int32), "int32", id="single-element"), # Structured dtype - param(np.array([(1, 2.0), (3, 4.0)], dtype=[("a", "i4"), ("b", "f8")]), "V12", id="structured-dtype"), + pytest.param(np.array([(1, 2.0), (3, 4.0)], dtype=[("a", "i4"), ("b", "f8")]), "V12", id="structured-dtype"), ], ) def test_from_array_interface(x, init_cuda, expected_dtype): @@ -590,8 +589,8 @@ def test_from_array_interface_unsupported_strides(init_cuda): @pytest.mark.parametrize( "slices", [ - param((slice(None), slice(None)), id="contiguous"), - param((slice(None, None, 2), slice(1, None, 2)), id="strided"), + pytest.param((slice(None), slice(None)), id="contiguous"), + pytest.param((slice(None, None, 2), slice(1, None, 2)), id="strided"), ], ) @pytest.mark.skipif(ml_dtypes is None, reason="ml_dtypes is not installed") @@ -621,8 +620,8 @@ def test_ml_dtypes_bfloat16_dlpack(init_cuda, slices): @pytest.mark.parametrize( "slices", [ - param((slice(None), slice(None)), id="contiguous"), - param((slice(None, None, 2), slice(1, None, 2)), id="strided"), + pytest.param((slice(None), slice(None)), id="contiguous"), + pytest.param((slice(None, None, 2), slice(1, None, 2)), id="strided"), ], ) @pytest.mark.skipif(ml_dtypes is None, reason="ml_dtypes is not installed") @@ -652,14 +651,14 @@ def test_ml_dtypes_bfloat16_torch_dlpack(init_cuda, slices): @pytest.fixture def no_ml_dtypes(monkeypatch): monkeypatch.setattr("cuda.core._memoryview.bfloat16", None) - yield + return @pytest.mark.parametrize( "api", [ - param(StridedMemoryView.from_dlpack, id="from_dlpack"), - param(StridedMemoryView.from_any_interface, id="from_any_interface"), + pytest.param(StridedMemoryView.from_dlpack, id="from_dlpack"), + pytest.param(StridedMemoryView.from_any_interface, id="from_any_interface"), ], ) @pytest.mark.skipif(cp is None, reason="CuPy is not installed") From a730ec1b00681a52089ebb4537975d4e202d9c61 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:49:52 -0500 Subject: [PATCH 09/42] fix(ruff/cuda_core): RUF ruff-specific fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - RUF022: unsorted-dunder-all — sort __all__ entries (4 fixes across 4 files) - RUF023: unsorted-dunder-slots — sort __slots__ entries (3 fixes across 1 file) - RUF012: mutable-class-default — suppress with noqa for lookup tables (5 fixes in 1 file) Made-with: Cursor --- cuda_core/cuda/core/_graph.py | 4 +- cuda_core/cuda/core/_linker.py | 2 +- .../core/_memory/_virtual_memory_resource.py | 12 ++--- cuda_core/cuda/core/system/__init__.py | 2 +- cuda_core/cuda/core/system/exceptions.py | 44 +++++++++---------- cuda_core/tests/helpers/buffers.py | 6 +-- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/cuda_core/cuda/core/_graph.py b/cuda_core/cuda/core/_graph.py index 79ab859741..80482c38ac 100644 --- a/cuda_core/cuda/core/_graph.py +++ b/cuda_core/cuda/core/_graph.py @@ -132,7 +132,7 @@ class GraphBuilder: """ class _MembersNeededForFinalize: - __slots__ = ("stream", "is_stream_owner", "graph", "conditional_graph", "is_join_required") + __slots__ = ("conditional_graph", "graph", "is_join_required", "is_stream_owner", "stream") def __init__(self, graph_builder_obj, stream_obj, is_stream_owner, conditional_graph, is_join_required): self.stream = stream_obj @@ -161,7 +161,7 @@ def close(self): self.graph = None self.conditional_graph = None - __slots__ = ("__weakref__", "_mnff", "_building_ended") + __slots__ = ("__weakref__", "_building_ended", "_mnff") def __init__(self): raise NotImplementedError( diff --git a/cuda_core/cuda/core/_linker.py b/cuda_core/cuda/core/_linker.py index 6490e87b07..029bdec021 100644 --- a/cuda_core/cuda/core/_linker.py +++ b/cuda_core/cuda/core/_linker.py @@ -402,7 +402,7 @@ class Linker: """ class _MembersNeededForFinalize: - __slots__ = ("handle", "use_nvjitlink", "const_char_keep_alive", "formatted_options", "option_keys") + __slots__ = ("const_char_keep_alive", "formatted_options", "handle", "option_keys", "use_nvjitlink") def __init__(self, program_obj, handle, use_nvjitlink): self.handle = handle diff --git a/cuda_core/cuda/core/_memory/_virtual_memory_resource.py b/cuda_core/cuda/core/_memory/_virtual_memory_resource.py index ccfad88f71..fb0b8cad81 100644 --- a/cuda_core/cuda/core/_memory/_virtual_memory_resource.py +++ b/cuda_core/cuda/core/_memory/_virtual_memory_resource.py @@ -22,7 +22,7 @@ _check_driver_error as raise_if_driver_error, ) -__all__ = ["VirtualMemoryResourceOptions", "VirtualMemoryResource"] +__all__ = ["VirtualMemoryResource", "VirtualMemoryResourceOptions"] VirtualMemoryHandleTypeT = Literal["posix_fd", "generic", "win32_kmt", "fabric"] | None VirtualMemoryLocationTypeT = Literal["device", "host", "host_numa", "host_numa_current"] @@ -76,28 +76,28 @@ class VirtualMemoryResourceOptions: peer_access: VirtualMemoryAccessTypeT = "rw" _a = driver.CUmemAccess_flags - _access_flags = {"rw": _a.CU_MEM_ACCESS_FLAGS_PROT_READWRITE, "r": _a.CU_MEM_ACCESS_FLAGS_PROT_READ, None: 0} + _access_flags = {"rw": _a.CU_MEM_ACCESS_FLAGS_PROT_READWRITE, "r": _a.CU_MEM_ACCESS_FLAGS_PROT_READ, None: 0} # noqa: RUF012 _h = driver.CUmemAllocationHandleType - _handle_types = { + _handle_types = { # noqa: RUF012 None: _h.CU_MEM_HANDLE_TYPE_NONE, "posix_fd": _h.CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR, "win32_kmt": _h.CU_MEM_HANDLE_TYPE_WIN32_KMT, "fabric": _h.CU_MEM_HANDLE_TYPE_FABRIC, } _g = driver.CUmemAllocationGranularity_flags - _granularity = { + _granularity = { # noqa: RUF012 "recommended": _g.CU_MEM_ALLOC_GRANULARITY_RECOMMENDED, "minimum": _g.CU_MEM_ALLOC_GRANULARITY_MINIMUM, } _l = driver.CUmemLocationType - _location_type = { + _location_type = { # noqa: RUF012 "device": _l.CU_MEM_LOCATION_TYPE_DEVICE, "host": _l.CU_MEM_LOCATION_TYPE_HOST, "host_numa": _l.CU_MEM_LOCATION_TYPE_HOST_NUMA, "host_numa_current": _l.CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT, } # CUDA 13+ exposes MANAGED in CUmemAllocationType; older 12.x does not - _allocation_type = {"pinned": _a.CU_MEM_ALLOCATION_TYPE_PINNED} + _allocation_type = {"pinned": _a.CU_MEM_ALLOCATION_TYPE_PINNED} # noqa: RUF012 ver_major, ver_minor = get_binding_version() if ver_major >= 13: _allocation_type["managed"] = _a.CU_MEM_ALLOCATION_TYPE_MANAGED diff --git a/cuda_core/cuda/core/system/__init__.py b/cuda_core/cuda/core/system/__init__.py index 6357b348bb..4e85c8d5fc 100644 --- a/cuda_core/cuda/core/system/__init__.py +++ b/cuda_core/cuda/core/system/__init__.py @@ -11,11 +11,11 @@ __all__ = [ + "CUDA_BINDINGS_NVML_IS_COMPATIBLE", "get_driver_version", "get_driver_version_full", "get_num_devices", "get_process_name", - "CUDA_BINDINGS_NVML_IS_COMPATIBLE", ] diff --git a/cuda_core/cuda/core/system/exceptions.py b/cuda_core/cuda/core/system/exceptions.py index 990648e531..21f258edb1 100644 --- a/cuda_core/cuda/core/system/exceptions.py +++ b/cuda_core/cuda/core/system/exceptions.py @@ -40,36 +40,36 @@ __all__ = [ - "NvmlError", - "UninitializedError", - "InvalidArgumentError", - "NotSupportedError", - "NoPermissionError", "AlreadyInitializedError", - "NotFoundError", - "InsufficientSizeError", - "InsufficientPowerError", + "ArgumentVersionMismatchError", + "CorruptedInforomError", + "DeprecatedError", "DriverNotLoadedError", - "TimeoutError", - "IrqIssueError", - "LibraryNotFoundError", + "FreqNotSupportedError", "FunctionNotFoundError", - "CorruptedInforomError", "GpuIsLostError", - "ResetRequiredError", - "OperatingSystemError", - "LibRmVersionMismatchError", + "GpuNotFoundError", "InUseError", + "InsufficientPowerError", + "InsufficientResourcesError", + "InsufficientSizeError", + "InvalidArgumentError", + "InvalidStateError", + "IrqIssueError", + "LibRmVersionMismatchError", + "LibraryNotFoundError", "MemoryError", "NoDataError", - "VgpuEccNotSupportedError", - "InsufficientResourcesError", - "FreqNotSupportedError", - "ArgumentVersionMismatchError", - "DeprecatedError", + "NoPermissionError", + "NotFoundError", "NotReadyError", - "GpuNotFoundError", - "InvalidStateError", + "NotSupportedError", + "NvmlError", + "OperatingSystemError", + "ResetRequiredError", "ResetTypeNotSupportedError", + "TimeoutError", + "UninitializedError", "UnknownError", + "VgpuEccNotSupportedError", ] diff --git a/cuda_core/tests/helpers/buffers.py b/cuda_core/tests/helpers/buffers.py index 68d3161fc3..fbd5428c28 100644 --- a/cuda_core/tests/helpers/buffers.py +++ b/cuda_core/tests/helpers/buffers.py @@ -9,12 +9,12 @@ from . import libc __all__ = [ - "compare_buffer_to_constant", - "compare_equal_buffers", "DummyUnifiedMemoryResource", - "make_scratch_buffer", "PatternGen", "TrackingMR", + "compare_buffer_to_constant", + "compare_equal_buffers", + "make_scratch_buffer", ] From 48fabbd0725c987bdb9d5b354d2d13f368f31fe8 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:50:22 -0500 Subject: [PATCH 10/42] fix(ruff/cuda_core): E pycodestyle fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - E711: none-comparison — use 'is not None' instead of '!= None' (1 fix in 1 file) Made-with: Cursor --- cuda_core/tests/test_object_protocols.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cuda_core/tests/test_object_protocols.py b/cuda_core/tests/test_object_protocols.py index 3eada96049..fa35a3887e 100644 --- a/cuda_core/tests/test_object_protocols.py +++ b/cuda_core/tests/test_object_protocols.py @@ -340,7 +340,7 @@ def test_equality_basic(fixture_name, request): """Object equality: reflexive, not equal to None or other types.""" obj = request.getfixturevalue(fixture_name) assert obj == obj - assert obj != None + assert obj is not None assert obj != "string" if hasattr(obj, "handle"): assert obj != obj.handle From b675201ca17f70c1e637b5ea5cb69e8f5cbcde71 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:51:27 -0500 Subject: [PATCH 11/42] fix(ruff/cuda_core): N naming convention fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - N806: non-lowercase-variable-in-function — rename CUDA_PATH to cuda_path (2 fixes in 1 file) - N816: mixed-case-variable-in-global-scope — suppress for CUDA API naming (1 noqa in 1 file) - N801: invalid-class-name — suppress for setuptools convention (1 noqa in 1 file) Made-with: Cursor --- cuda_core/build_hooks.py | 10 +++++----- cuda_core/cuda/core/_linker.py | 2 +- cuda_core/setup.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cuda_core/build_hooks.py b/cuda_core/build_hooks.py index 4c4635f19d..befdf09b90 100644 --- a/cuda_core/build_hooks.py +++ b/cuda_core/build_hooks.py @@ -30,12 +30,12 @@ @functools.cache def _get_cuda_paths() -> list[str]: - CUDA_PATH = os.environ.get("CUDA_PATH", os.environ.get("CUDA_HOME", None)) - if not CUDA_PATH: + cuda_path = os.environ.get("CUDA_PATH", os.environ.get("CUDA_HOME", None)) + if not cuda_path: raise RuntimeError("Environment variable CUDA_PATH or CUDA_HOME is not set") - CUDA_PATH = CUDA_PATH.split(os.pathsep) - print("CUDA paths:", CUDA_PATH) - return CUDA_PATH + cuda_path = cuda_path.split(os.pathsep) + print("CUDA paths:", cuda_path) + return cuda_path @functools.cache diff --git a/cuda_core/cuda/core/_linker.py b/cuda_core/cuda/core/_linker.py index 029bdec021..9ff5feb2f6 100644 --- a/cuda_core/cuda/core/_linker.py +++ b/cuda_core/cuda/core/_linker.py @@ -382,7 +382,7 @@ def _exception_manager(self): raise e -nvJitLinkHandleT = int +nvJitLinkHandleT = int # noqa: N816 LinkerHandleT = Union[nvJitLinkHandleT, "cuda.bindings.driver.CUlinkState"] diff --git a/cuda_core/setup.py b/cuda_core/setup.py index 4a501edc17..16d53edb79 100644 --- a/cuda_core/setup.py +++ b/cuda_core/setup.py @@ -11,7 +11,7 @@ nthreads = int(os.environ.get("CUDA_PYTHON_PARALLEL_LEVEL", os.cpu_count() // 2)) -class build_ext(_build_ext): +class build_ext(_build_ext): # noqa: N801 def build_extensions(self): self.parallel = nthreads super().build_extensions() From b2c657819860de0ac61ba24e93988f5babac9c3f Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:52:03 -0500 Subject: [PATCH 12/42] fix(ruff/cuda_core): ARG unused argument suppression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ARG002: unused-method-argument — suppress for interface method (1 noqa in 1 file) Made-with: Cursor --- cuda_core/cuda/core/_memory/_virtual_memory_resource.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cuda_core/cuda/core/_memory/_virtual_memory_resource.py b/cuda_core/cuda/core/_memory/_virtual_memory_resource.py index fb0b8cad81..76bd500f6d 100644 --- a/cuda_core/cuda/core/_memory/_virtual_memory_resource.py +++ b/cuda_core/cuda/core/_memory/_virtual_memory_resource.py @@ -554,7 +554,7 @@ def allocate(self, size: int, stream: Stream | None = None) -> Buffer: buf = Buffer.from_handle(ptr=ptr, size=aligned_size, mr=self) return buf - def deallocate(self, ptr: int, size: int, stream: Stream | None = None) -> None: + def deallocate(self, ptr: int, size: int, stream: Stream | None = None) -> None: # noqa: ARG002 """ Deallocate memory on the device using CUDA VMM APIs. """ From 4b33abd1b0cdbfe6bdc1141d4e86a34fb51d7325 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:52:49 -0500 Subject: [PATCH 13/42] fix(ruff/cuda_core): F pyflakes fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - F401: unused-import — suppress for re-exports and side-effect imports (4 noqa in 2 files) Made-with: Cursor --- cuda_core/cuda/core/utils.py | 4 ++-- cuda_core/tests/test_graphics.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cuda_core/cuda/core/utils.py b/cuda_core/cuda/core/utils.py index d59bf4b876..f15d924277 100644 --- a/cuda_core/cuda/core/utils.py +++ b/cuda_core/cuda/core/utils.py @@ -3,6 +3,6 @@ # SPDX-License-Identifier: Apache-2.0 from cuda.core._memoryview import ( - StridedMemoryView, - args_viewable_as_strided_memory, + StridedMemoryView, # noqa: F401 + args_viewable_as_strided_memory, # noqa: F401 ) diff --git a/cuda_core/tests/test_graphics.py b/cuda_core/tests/test_graphics.py index 9e2418209c..faec9f0954 100644 --- a/cuda_core/tests/test_graphics.py +++ b/cuda_core/tests/test_graphics.py @@ -47,7 +47,7 @@ def _gl_context_and_buffer(nbytes=1024): win = pyglet.window.Window(visible=False, config=config) win.switch_to() else: - from pyglet.gl import headless + from pyglet.gl import headless # noqa: F401 from pyglet.gl import gl as _gl @@ -98,7 +98,7 @@ def _gl_context_and_texture(width=16, height=16): win = pyglet.window.Window(visible=False, config=config) win.switch_to() else: - from pyglet.gl import headless + from pyglet.gl import headless # noqa: F401 from pyglet.gl import gl as _gl From c94d839f18e8be10a097619b4edb569f2a77dd88 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:53:06 -0500 Subject: [PATCH 14/42] fix(ruff/cuda_core): B bugbear fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - B018: useless-expression — suppress for property access expected to raise (2 noqa in 1 file) Made-with: Cursor --- cuda_core/tests/test_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cuda_core/tests/test_utils.py b/cuda_core/tests/test_utils.py index 221ed65704..79982427f6 100644 --- a/cuda_core/tests/test_utils.py +++ b/cuda_core/tests/test_utils.py @@ -583,7 +583,7 @@ def test_from_array_interface_unsupported_strides(init_cuda): smv = StridedMemoryView.from_array_interface(b) with pytest.raises(ValueError, match="strides must be divisible by itemsize"): # TODO: ideally this would raise on construction - smv.strides + smv.strides # noqa: B018 @pytest.mark.parametrize( @@ -667,4 +667,4 @@ def test_ml_dtypes_bfloat16_dlpack_requires_ml_dtypes(init_cuda, no_ml_dtypes, a a = cp.array([1, 2, 3], dtype="bfloat16") smv = api(a, stream_ptr=0) with pytest.raises(NotImplementedError, match=r"requires `ml_dtypes`"): - smv.dtype + smv.dtype # noqa: B018 From da79bdc1f33ea4b49bc971397db5873d2e900c26 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 12:03:03 -0500 Subject: [PATCH 15/42] fix(ruff/cuda_core): S bandit security suppressions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - S110: try-except-pass — suppress for best-effort cleanup (5 noqa in 2 files) - S102: exec-builtin — suppress in test code (2 noqa in 2 files) - S301: suspicious-pickle-usage — suppress in test code (3 noqa in 3 files) Made-with: Cursor --- cuda_core/cuda/core/_memory/_virtual_memory_resource.py | 2 +- cuda_core/tests/example_tests/utils.py | 2 +- cuda_core/tests/memory_ipc/test_errors.py | 2 +- cuda_core/tests/memory_ipc/test_workerpool.py | 2 +- cuda_core/tests/test_graphics.py | 8 ++++---- cuda_core/tests/test_memory.py | 2 +- cuda_core/tests/test_module.py | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cuda_core/cuda/core/_memory/_virtual_memory_resource.py b/cuda_core/cuda/core/_memory/_virtual_memory_resource.py index 76bd500f6d..2b12edb776 100644 --- a/cuda_core/cuda/core/_memory/_virtual_memory_resource.py +++ b/cuda_core/cuda/core/_memory/_virtual_memory_resource.py @@ -388,7 +388,7 @@ def _remap_old(): try: (res,) = driver.cuMemMap(int(buf.handle), aligned_prev_size, 0, old_handle, 0) raise_if_driver_error(res) - except Exception: + except Exception: # noqa: S110 # TODO: consider logging this exception pass diff --git a/cuda_core/tests/example_tests/utils.py b/cuda_core/tests/example_tests/utils.py index 4ccc0213b4..9b5dc57e5f 100644 --- a/cuda_core/tests/example_tests/utils.py +++ b/cuda_core/tests/example_tests/utils.py @@ -29,7 +29,7 @@ def run_example(samples_path, filename, env=None): old_sys_path = sys.path.copy() sys.path.append(samples_path) # TODO: Refactor the examples to give them a common callable `main()` to avoid needing to use exec here? - exec(script, env if env else {}) + exec(script, env if env else {}) # noqa: S102 except ImportError as e: # for samples requiring any of optional dependencies for m in ("cupy", "torch"): diff --git a/cuda_core/tests/memory_ipc/test_errors.py b/cuda_core/tests/memory_ipc/test_errors.py index 37e565e5a0..4fdc80c41e 100644 --- a/cuda_core/tests/memory_ipc/test_errors.py +++ b/cuda_core/tests/memory_ipc/test_errors.py @@ -124,7 +124,7 @@ def PARENT_ACTION(self, queue): def CHILD_ACTION(self, queue): Device().set_current() buffer_s = queue.get(timeout=CHILD_TIMEOUT_SEC) - pickle.loads(buffer_s) + pickle.loads(buffer_s) # noqa: S301 def ASSERT(self, exc_type, exc_msg): assert exc_type is RuntimeError diff --git a/cuda_core/tests/memory_ipc/test_workerpool.py b/cuda_core/tests/memory_ipc/test_workerpool.py index a55151b2a0..ed66c95d33 100644 --- a/cuda_core/tests/memory_ipc/test_workerpool.py +++ b/cuda_core/tests/memory_ipc/test_workerpool.py @@ -127,7 +127,7 @@ def test_main(self, ipc_device, nmrs): def process_buffer(self, device, buffer_s): device.set_current() - buffer = pickle.loads(buffer_s) + buffer = pickle.loads(buffer_s) # noqa: S301 pgen = PatternGen(device, NBYTES) pgen.fill_buffer(buffer, seed=True) buffer.close() diff --git a/cuda_core/tests/test_graphics.py b/cuda_core/tests/test_graphics.py index faec9f0954..6474c38be4 100644 --- a/cuda_core/tests/test_graphics.py +++ b/cuda_core/tests/test_graphics.py @@ -66,12 +66,12 @@ def _gl_context_and_buffer(nbytes=1024): if buf_id is not None and buf_id.value: _gl.glDeleteBuffers(1, ctypes.byref(buf_id)) - except Exception: + except Exception: # noqa: S110 pass try: if win is not None: win.close() - except Exception: + except Exception: # noqa: S110 pass @@ -130,12 +130,12 @@ def _gl_context_and_texture(width=16, height=16): if tex_id is not None and tex_id.value: _gl.glDeleteTextures(1, ctypes.byref(tex_id)) - except Exception: + except Exception: # noqa: S110 pass try: if win is not None: win.close() - except Exception: + except Exception: # noqa: S110 pass diff --git a/cuda_core/tests/test_memory.py b/cuda_core/tests/test_memory.py index 62e71ac869..ea2e989e1a 100644 --- a/cuda_core/tests/test_memory.py +++ b/cuda_core/tests/test_memory.py @@ -148,7 +148,7 @@ def test_package_contents(): "VirtualMemoryResource", ] d = {} - exec("from cuda.core._memory import *", d) + exec("from cuda.core._memory import *", d) # noqa: S102 d = {k: v for k, v in d.items() if not k.startswith("__")} assert sorted(expected) == sorted(d.keys()) diff --git a/cuda_core/tests/test_module.py b/cuda_core/tests/test_module.py index b66e8eaf9e..e74b1fc672 100644 --- a/cuda_core/tests/test_module.py +++ b/cuda_core/tests/test_module.py @@ -415,7 +415,7 @@ def test_occupancy_max_potential_cluster_size(get_saxpy_kernel_cubin): def test_module_serialization_roundtrip(get_saxpy_kernel_cubin): _, objcode = get_saxpy_kernel_cubin - result = pickle.loads(pickle.dumps(objcode)) + result = pickle.loads(pickle.dumps(objcode)) # noqa: S301 assert isinstance(result, ObjectCode) assert objcode.code == result.code From b61030f2ed85df0e8f22111b6d2e8c3e65971fe7 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:46:18 -0500 Subject: [PATCH 16/42] fix(ruff/cuda_bindings): I001 sort imports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - I001: unsorted imports — 42 fixed across NFILES files Made-with: Cursor --- cuda_bindings/benchmarks/conftest.py | 1 + cuda_bindings/benchmarks/test_launch_latency.py | 2 +- cuda_bindings/benchmarks/test_pointer_attributes.py | 2 +- cuda_bindings/cuda/bindings/_test_helpers/arch_check.py | 1 + cuda_bindings/examples/0_Introduction/clock_nvrtc_test.py | 1 + .../examples/0_Introduction/simpleCubemapTexture_test.py | 1 + cuda_bindings/examples/0_Introduction/simpleP2P_test.py | 1 + cuda_bindings/examples/0_Introduction/simpleZeroCopy_test.py | 1 + .../examples/0_Introduction/systemWideAtomics_test.py | 1 + cuda_bindings/examples/0_Introduction/vectorAddDrv_test.py | 1 + cuda_bindings/examples/0_Introduction/vectorAddMMAP_test.py | 1 + .../streamOrderedAllocation_test.py | 1 + .../examples/3_CUDA_Features/globalToShmemAsyncCopy_test.py | 1 + .../examples/3_CUDA_Features/simpleCudaGraphs_test.py | 1 + .../4_CUDA_Libraries/conjugateGradientMultiBlockCG_test.py | 1 + cuda_bindings/examples/common/common.py | 1 + cuda_bindings/examples/common/helper_cuda.py | 1 + cuda_bindings/examples/extra/isoFDModelling_test.py | 1 + cuda_bindings/examples/extra/jit_program_test.py | 1 + cuda_bindings/examples/extra/numba_emm_plugin.py | 5 +++-- cuda_bindings/tests/conftest.py | 3 ++- cuda_bindings/tests/nvml/__init__.py | 1 + cuda_bindings/tests/nvml/conftest.py | 1 + cuda_bindings/tests/nvml/test_compute_mode.py | 1 + cuda_bindings/tests/nvml/test_device.py | 1 + cuda_bindings/tests/nvml/test_gpu.py | 1 + cuda_bindings/tests/nvml/test_init.py | 1 + cuda_bindings/tests/nvml/test_page_retirement.py | 1 + cuda_bindings/tests/nvml/test_pynvml.py | 1 + cuda_bindings/tests/test_basics.py | 1 + cuda_bindings/tests/test_cuda.py | 5 +++-- cuda_bindings/tests/test_cudart.py | 5 +++-- cuda_bindings/tests/test_cufile.py | 3 ++- cuda_bindings/tests/test_graphics_apis.py | 1 + cuda_bindings/tests/test_interoperability.py | 5 +++-- cuda_bindings/tests/test_kernelParams.py | 5 +++-- cuda_bindings/tests/test_nvfatbin.py | 1 + cuda_bindings/tests/test_nvjitlink.py | 1 + cuda_bindings/tests/test_nvrtc.py | 1 + cuda_bindings/tests/test_nvvm.py | 1 + cuda_bindings/tests/test_utils.py | 1 + cuda_bindings/tests/test_version_check.py | 1 + 42 files changed, 54 insertions(+), 14 deletions(-) diff --git a/cuda_bindings/benchmarks/conftest.py b/cuda_bindings/benchmarks/conftest.py index 99092bb217..2787f41d11 100644 --- a/cuda_bindings/benchmarks/conftest.py +++ b/cuda_bindings/benchmarks/conftest.py @@ -3,6 +3,7 @@ import numpy as np import pytest + from cuda.bindings import driver as cuda from cuda.bindings import nvrtc from cuda.bindings import runtime as cudart diff --git a/cuda_bindings/benchmarks/test_launch_latency.py b/cuda_bindings/benchmarks/test_launch_latency.py index e2809c8d44..dd994081a0 100755 --- a/cuda_bindings/benchmarks/test_launch_latency.py +++ b/cuda_bindings/benchmarks/test_launch_latency.py @@ -4,10 +4,10 @@ import ctypes import pytest -from cuda.bindings import driver as cuda from kernels import kernel_string from conftest import ASSERT_DRV +from cuda.bindings import driver as cuda def launch(kernel, stream, args=(), arg_types=()): diff --git a/cuda_bindings/benchmarks/test_pointer_attributes.py b/cuda_bindings/benchmarks/test_pointer_attributes.py index fcf181cdef..fae72ffd79 100644 --- a/cuda_bindings/benchmarks/test_pointer_attributes.py +++ b/cuda_bindings/benchmarks/test_pointer_attributes.py @@ -4,9 +4,9 @@ import random import pytest -from cuda.bindings import driver as cuda from conftest import ASSERT_DRV +from cuda.bindings import driver as cuda random.seed(0) diff --git a/cuda_bindings/cuda/bindings/_test_helpers/arch_check.py b/cuda_bindings/cuda/bindings/_test_helpers/arch_check.py index bf66250d1e..9b1e5e23a7 100644 --- a/cuda_bindings/cuda/bindings/_test_helpers/arch_check.py +++ b/cuda_bindings/cuda/bindings/_test_helpers/arch_check.py @@ -6,6 +6,7 @@ from functools import cache import pytest + from cuda.bindings import nvml diff --git a/cuda_bindings/examples/0_Introduction/clock_nvrtc_test.py b/cuda_bindings/examples/0_Introduction/clock_nvrtc_test.py index 2786e54b3f..4d3e557a39 100644 --- a/cuda_bindings/examples/0_Introduction/clock_nvrtc_test.py +++ b/cuda_bindings/examples/0_Introduction/clock_nvrtc_test.py @@ -6,6 +6,7 @@ import numpy as np from common import common from common.helper_cuda import checkCudaErrors, findCudaDevice + from cuda.bindings import driver as cuda clock_nvrtc = """\ diff --git a/cuda_bindings/examples/0_Introduction/simpleCubemapTexture_test.py b/cuda_bindings/examples/0_Introduction/simpleCubemapTexture_test.py index 4681d29c1d..fae5cb6ad8 100644 --- a/cuda_bindings/examples/0_Introduction/simpleCubemapTexture_test.py +++ b/cuda_bindings/examples/0_Introduction/simpleCubemapTexture_test.py @@ -8,6 +8,7 @@ import numpy as np from common import common from common.helper_cuda import checkCudaErrors, findCudaDevice + from cuda.bindings import driver as cuda from cuda.bindings import runtime as cudart diff --git a/cuda_bindings/examples/0_Introduction/simpleP2P_test.py b/cuda_bindings/examples/0_Introduction/simpleP2P_test.py index ee5f4ea921..0f83370288 100644 --- a/cuda_bindings/examples/0_Introduction/simpleP2P_test.py +++ b/cuda_bindings/examples/0_Introduction/simpleP2P_test.py @@ -8,6 +8,7 @@ import numpy as np from common import common from common.helper_cuda import checkCudaErrors + from cuda.bindings import driver as cuda from cuda.bindings import runtime as cudart diff --git a/cuda_bindings/examples/0_Introduction/simpleZeroCopy_test.py b/cuda_bindings/examples/0_Introduction/simpleZeroCopy_test.py index e0ce7ae0aa..db045be677 100644 --- a/cuda_bindings/examples/0_Introduction/simpleZeroCopy_test.py +++ b/cuda_bindings/examples/0_Introduction/simpleZeroCopy_test.py @@ -11,6 +11,7 @@ from common import common from common.helper_cuda import checkCudaErrors from common.helper_string import checkCmdLineFlag, getCmdLineArgumentInt + from cuda.bindings import driver as cuda from cuda.bindings import runtime as cudart diff --git a/cuda_bindings/examples/0_Introduction/systemWideAtomics_test.py b/cuda_bindings/examples/0_Introduction/systemWideAtomics_test.py index c86b246482..8ce984826f 100644 --- a/cuda_bindings/examples/0_Introduction/systemWideAtomics_test.py +++ b/cuda_bindings/examples/0_Introduction/systemWideAtomics_test.py @@ -8,6 +8,7 @@ import numpy as np from common import common from common.helper_cuda import checkCudaErrors, findCudaDevice + from cuda.bindings import driver as cuda from cuda.bindings import runtime as cudart diff --git a/cuda_bindings/examples/0_Introduction/vectorAddDrv_test.py b/cuda_bindings/examples/0_Introduction/vectorAddDrv_test.py index 71a9c59352..05e580999a 100644 --- a/cuda_bindings/examples/0_Introduction/vectorAddDrv_test.py +++ b/cuda_bindings/examples/0_Introduction/vectorAddDrv_test.py @@ -8,6 +8,7 @@ import numpy as np from common import common from common.helper_cuda import checkCudaErrors, findCudaDeviceDRV + from cuda.bindings import driver as cuda vectorAddDrv = """\ diff --git a/cuda_bindings/examples/0_Introduction/vectorAddMMAP_test.py b/cuda_bindings/examples/0_Introduction/vectorAddMMAP_test.py index 15c6e9821c..4679dde38c 100644 --- a/cuda_bindings/examples/0_Introduction/vectorAddMMAP_test.py +++ b/cuda_bindings/examples/0_Introduction/vectorAddMMAP_test.py @@ -9,6 +9,7 @@ import numpy as np from common import common from common.helper_cuda import checkCudaErrors, findCudaDeviceDRV + from cuda.bindings import driver as cuda vectorAddMMAP = """\ diff --git a/cuda_bindings/examples/2_Concepts_and_Techniques/streamOrderedAllocation_test.py b/cuda_bindings/examples/2_Concepts_and_Techniques/streamOrderedAllocation_test.py index 682250c7c0..7eb7a0b977 100644 --- a/cuda_bindings/examples/2_Concepts_and_Techniques/streamOrderedAllocation_test.py +++ b/cuda_bindings/examples/2_Concepts_and_Techniques/streamOrderedAllocation_test.py @@ -11,6 +11,7 @@ from common import common from common.helper_cuda import checkCudaErrors, findCudaDevice from common.helper_string import checkCmdLineFlag + from cuda.bindings import driver as cuda from cuda.bindings import runtime as cudart diff --git a/cuda_bindings/examples/3_CUDA_Features/globalToShmemAsyncCopy_test.py b/cuda_bindings/examples/3_CUDA_Features/globalToShmemAsyncCopy_test.py index b82c9b02b4..f0f040cff8 100644 --- a/cuda_bindings/examples/3_CUDA_Features/globalToShmemAsyncCopy_test.py +++ b/cuda_bindings/examples/3_CUDA_Features/globalToShmemAsyncCopy_test.py @@ -11,6 +11,7 @@ from common import common from common.helper_cuda import checkCudaErrors, findCudaDevice from common.helper_string import checkCmdLineFlag, getCmdLineArgumentInt + from cuda.bindings import driver as cuda from cuda.bindings import runtime as cudart diff --git a/cuda_bindings/examples/3_CUDA_Features/simpleCudaGraphs_test.py b/cuda_bindings/examples/3_CUDA_Features/simpleCudaGraphs_test.py index 7012fc6719..37afee4015 100644 --- a/cuda_bindings/examples/3_CUDA_Features/simpleCudaGraphs_test.py +++ b/cuda_bindings/examples/3_CUDA_Features/simpleCudaGraphs_test.py @@ -7,6 +7,7 @@ import numpy as np from common import common from common.helper_cuda import checkCudaErrors, findCudaDevice + from cuda.bindings import driver as cuda from cuda.bindings import runtime as cudart diff --git a/cuda_bindings/examples/4_CUDA_Libraries/conjugateGradientMultiBlockCG_test.py b/cuda_bindings/examples/4_CUDA_Libraries/conjugateGradientMultiBlockCG_test.py index b1725bb899..8c2a0bc340 100644 --- a/cuda_bindings/examples/4_CUDA_Libraries/conjugateGradientMultiBlockCG_test.py +++ b/cuda_bindings/examples/4_CUDA_Libraries/conjugateGradientMultiBlockCG_test.py @@ -10,6 +10,7 @@ import numpy as np from common import common from common.helper_cuda import checkCudaErrors, findCudaDevice + from cuda.bindings import driver as cuda from cuda.bindings import runtime as cudart diff --git a/cuda_bindings/examples/common/common.py b/cuda_bindings/examples/common/common.py index ee1bef5acb..59e7d0a58f 100644 --- a/cuda_bindings/examples/common/common.py +++ b/cuda_bindings/examples/common/common.py @@ -4,6 +4,7 @@ import numpy as np from common.helper_cuda import checkCudaErrors + from cuda import pathfinder from cuda.bindings import driver as cuda from cuda.bindings import nvrtc diff --git a/cuda_bindings/examples/common/helper_cuda.py b/cuda_bindings/examples/common/helper_cuda.py index 405c1cfb9f..d741eb54d9 100644 --- a/cuda_bindings/examples/common/helper_cuda.py +++ b/cuda_bindings/examples/common/helper_cuda.py @@ -2,6 +2,7 @@ # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE from common.helper_string import checkCmdLineFlag, getCmdLineArgumentInt + from cuda.bindings import driver as cuda from cuda.bindings import nvrtc from cuda.bindings import runtime as cudart diff --git a/cuda_bindings/examples/extra/isoFDModelling_test.py b/cuda_bindings/examples/extra/isoFDModelling_test.py index 8d7c4538a9..148d836adf 100644 --- a/cuda_bindings/examples/extra/isoFDModelling_test.py +++ b/cuda_bindings/examples/extra/isoFDModelling_test.py @@ -6,6 +6,7 @@ import numpy as np from common import common from common.helper_cuda import checkCudaErrors + from cuda.bindings import driver as cuda from cuda.bindings import runtime as cudart diff --git a/cuda_bindings/examples/extra/jit_program_test.py b/cuda_bindings/examples/extra/jit_program_test.py index 6d7ca2e8fe..eccbd86a67 100644 --- a/cuda_bindings/examples/extra/jit_program_test.py +++ b/cuda_bindings/examples/extra/jit_program_test.py @@ -4,6 +4,7 @@ import ctypes import numpy as np + from cuda.bindings import driver as cuda from cuda.bindings import nvrtc diff --git a/cuda_bindings/examples/extra/numba_emm_plugin.py b/cuda_bindings/examples/extra/numba_emm_plugin.py index 3354a88c09..dcbf541321 100644 --- a/cuda_bindings/examples/extra/numba_emm_plugin.py +++ b/cuda_bindings/examples/extra/numba_emm_plugin.py @@ -49,8 +49,6 @@ from ctypes import c_size_t -from cuda.bindings import driver as cuda -from cuda.bindings import driver as cuda_driver from numba.cuda import ( GetIpcHandleMixin, HostOnlyCUDAMemoryManager, @@ -58,6 +56,9 @@ MemoryPointer, ) +from cuda.bindings import driver as cuda +from cuda.bindings import driver as cuda_driver + # Python functions for allocation, deallocation, and memory info via the NVIDIA # CUDA Python Driver API diff --git a/cuda_bindings/tests/conftest.py b/cuda_bindings/tests/conftest.py index 052853e0d3..f30500c134 100644 --- a/cuda_bindings/tests/conftest.py +++ b/cuda_bindings/tests/conftest.py @@ -5,9 +5,10 @@ import sys from importlib.metadata import PackageNotFoundError, distribution -import cuda.bindings.driver as cuda import pytest +import cuda.bindings.driver as cuda + # Import shared test helpers for tests across subprojects. # PLEASE KEEP IN SYNC with copies in other conftest.py in this repo. _test_helpers_root = pathlib.Path(__file__).resolve().parents[2] / "cuda_python_test_helpers" diff --git a/cuda_bindings/tests/nvml/__init__.py b/cuda_bindings/tests/nvml/__init__.py index 996effce9c..854f640766 100644 --- a/cuda_bindings/tests/nvml/__init__.py +++ b/cuda_bindings/tests/nvml/__init__.py @@ -3,6 +3,7 @@ import pytest + from cuda.bindings._test_helpers.arch_check import hardware_supports_nvml if not hardware_supports_nvml(): diff --git a/cuda_bindings/tests/nvml/conftest.py b/cuda_bindings/tests/nvml/conftest.py index 9b7ef6abd1..06c651900c 100644 --- a/cuda_bindings/tests/nvml/conftest.py +++ b/cuda_bindings/tests/nvml/conftest.py @@ -4,6 +4,7 @@ from collections import namedtuple import pytest + from cuda.bindings import nvml from cuda.bindings._test_helpers.arch_check import unsupported_before # noqa: F401 diff --git a/cuda_bindings/tests/nvml/test_compute_mode.py b/cuda_bindings/tests/nvml/test_compute_mode.py index 1eb8b08288..e9b020d32a 100644 --- a/cuda_bindings/tests/nvml/test_compute_mode.py +++ b/cuda_bindings/tests/nvml/test_compute_mode.py @@ -5,6 +5,7 @@ import sys import pytest + from cuda.bindings import nvml from .conftest import unsupported_before diff --git a/cuda_bindings/tests/nvml/test_device.py b/cuda_bindings/tests/nvml/test_device.py index fdb79b098d..f273a2a88e 100644 --- a/cuda_bindings/tests/nvml/test_device.py +++ b/cuda_bindings/tests/nvml/test_device.py @@ -5,6 +5,7 @@ from functools import cache import pytest + from cuda.bindings import nvml from .conftest import unsupported_before diff --git a/cuda_bindings/tests/nvml/test_gpu.py b/cuda_bindings/tests/nvml/test_gpu.py index a48c4ee578..6119a5f7a9 100644 --- a/cuda_bindings/tests/nvml/test_gpu.py +++ b/cuda_bindings/tests/nvml/test_gpu.py @@ -3,6 +3,7 @@ import numpy as np import pytest + from cuda.bindings import nvml from . import util diff --git a/cuda_bindings/tests/nvml/test_init.py b/cuda_bindings/tests/nvml/test_init.py index 8bf95ded0a..4721352c19 100644 --- a/cuda_bindings/tests/nvml/test_init.py +++ b/cuda_bindings/tests/nvml/test_init.py @@ -5,6 +5,7 @@ import warnings import pytest + from cuda.bindings import nvml diff --git a/cuda_bindings/tests/nvml/test_page_retirement.py b/cuda_bindings/tests/nvml/test_page_retirement.py index 2f33c46050..cded084173 100644 --- a/cuda_bindings/tests/nvml/test_page_retirement.py +++ b/cuda_bindings/tests/nvml/test_page_retirement.py @@ -2,6 +2,7 @@ # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE import pytest + from cuda.bindings import nvml from . import util diff --git a/cuda_bindings/tests/nvml/test_pynvml.py b/cuda_bindings/tests/nvml/test_pynvml.py index 645cf0948b..e94fc33138 100644 --- a/cuda_bindings/tests/nvml/test_pynvml.py +++ b/cuda_bindings/tests/nvml/test_pynvml.py @@ -7,6 +7,7 @@ import time import pytest + from cuda.bindings import nvml from . import util diff --git a/cuda_bindings/tests/test_basics.py b/cuda_bindings/tests/test_basics.py index 3cc3891abc..cb3732f534 100644 --- a/cuda_bindings/tests/test_basics.py +++ b/cuda_bindings/tests/test_basics.py @@ -5,6 +5,7 @@ import sys import pytest + from cuda.bindings._internal import _fast_enum # Test both with the FastEnum implementation and the stdlib enum.IntEnum (even diff --git a/cuda_bindings/tests/test_cuda.py b/cuda_bindings/tests/test_cuda.py index 5f51f95619..60505e4d74 100644 --- a/cuda_bindings/tests/test_cuda.py +++ b/cuda_bindings/tests/test_cuda.py @@ -6,10 +6,11 @@ import shutil import textwrap -import cuda.bindings.driver as cuda -import cuda.bindings.runtime as cudart import numpy as np import pytest + +import cuda.bindings.driver as cuda +import cuda.bindings.runtime as cudart from cuda.bindings import driver diff --git a/cuda_bindings/tests/test_cudart.py b/cuda_bindings/tests/test_cudart.py index b7e6b4ac06..8ba1517499 100644 --- a/cuda_bindings/tests/test_cudart.py +++ b/cuda_bindings/tests/test_cudart.py @@ -4,10 +4,11 @@ import ctypes import math -import cuda.bindings.driver as cuda -import cuda.bindings.runtime as cudart import numpy as np import pytest + +import cuda.bindings.driver as cuda +import cuda.bindings.runtime as cudart from cuda import pathfinder from cuda.bindings import runtime diff --git a/cuda_bindings/tests/test_cufile.py b/cuda_bindings/tests/test_cufile.py index d12bc946ac..93a876bb41 100644 --- a/cuda_bindings/tests/test_cufile.py +++ b/cuda_bindings/tests/test_cufile.py @@ -12,9 +12,10 @@ from contextlib import suppress from functools import cache -import cuda.bindings.driver as cuda import pytest +import cuda.bindings.driver as cuda + cufile = pytest.importorskip("cuda.bindings.cufile") # Configure logging to show INFO level and above diff --git a/cuda_bindings/tests/test_graphics_apis.py b/cuda_bindings/tests/test_graphics_apis.py index d010796e8c..558a4ac6d8 100644 --- a/cuda_bindings/tests/test_graphics_apis.py +++ b/cuda_bindings/tests/test_graphics_apis.py @@ -8,6 +8,7 @@ import sys import pytest + from cuda.bindings import runtime as cudart diff --git a/cuda_bindings/tests/test_interoperability.py b/cuda_bindings/tests/test_interoperability.py index cef594139a..3da1877128 100644 --- a/cuda_bindings/tests/test_interoperability.py +++ b/cuda_bindings/tests/test_interoperability.py @@ -1,11 +1,12 @@ # SPDX-FileCopyrightText: Copyright (c) 2021-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE -import cuda.bindings.driver as cuda -import cuda.bindings.runtime as cudart import numpy as np import pytest +import cuda.bindings.driver as cuda +import cuda.bindings.runtime as cudart + def supportsMemoryPool(): err, isSupported = cudart.cudaDeviceGetAttribute(cudart.cudaDeviceAttr.cudaDevAttrMemoryPoolsSupported, 0) diff --git a/cuda_bindings/tests/test_kernelParams.py b/cuda_bindings/tests/test_kernelParams.py index e6844607f8..f64444da06 100644 --- a/cuda_bindings/tests/test_kernelParams.py +++ b/cuda_bindings/tests/test_kernelParams.py @@ -3,11 +3,12 @@ import ctypes +import numpy as np +import pytest + import cuda.bindings.driver as cuda import cuda.bindings.nvrtc as nvrtc import cuda.bindings.runtime as cudart -import numpy as np -import pytest def ASSERT_DRV(err): diff --git a/cuda_bindings/tests/test_nvfatbin.py b/cuda_bindings/tests/test_nvfatbin.py index c3b25db2f2..32c6e70f59 100644 --- a/cuda_bindings/tests/test_nvfatbin.py +++ b/cuda_bindings/tests/test_nvfatbin.py @@ -8,6 +8,7 @@ import subprocess import pytest + from cuda.bindings import nvfatbin, nvrtc ARCHITECTURES = ["sm_75", "sm_80", "sm_90", "sm_100"] diff --git a/cuda_bindings/tests/test_nvjitlink.py b/cuda_bindings/tests/test_nvjitlink.py index 3bfeb8d35a..42b93c3dda 100644 --- a/cuda_bindings/tests/test_nvjitlink.py +++ b/cuda_bindings/tests/test_nvjitlink.py @@ -2,6 +2,7 @@ # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE import pytest + from cuda.bindings import nvjitlink, nvrtc # Establish a handful of compatible architectures and PTX versions to test with diff --git a/cuda_bindings/tests/test_nvrtc.py b/cuda_bindings/tests/test_nvrtc.py index b2c192ef11..51202e64d9 100644 --- a/cuda_bindings/tests/test_nvrtc.py +++ b/cuda_bindings/tests/test_nvrtc.py @@ -2,6 +2,7 @@ # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE import pytest + from cuda.bindings import nvrtc diff --git a/cuda_bindings/tests/test_nvvm.py b/cuda_bindings/tests/test_nvvm.py index 05fec9767d..c5d0c70f5d 100644 --- a/cuda_bindings/tests/test_nvvm.py +++ b/cuda_bindings/tests/test_nvvm.py @@ -6,6 +6,7 @@ from contextlib import contextmanager import pytest + from cuda.bindings import nvvm pytest_plugins = ("cuda_python_test_helpers.nvvm_bitcode",) diff --git a/cuda_bindings/tests/test_utils.py b/cuda_bindings/tests/test_utils.py index 4c6b39826e..1f311e9fdc 100644 --- a/cuda_bindings/tests/test_utils.py +++ b/cuda_bindings/tests/test_utils.py @@ -8,6 +8,7 @@ from pathlib import Path import pytest + from cuda.bindings import driver, runtime from cuda.bindings._internal.utils import get_c_compiler from cuda.bindings.utils import get_cuda_native_handle, get_minimal_required_cuda_ver_from_ptx_ver, get_ptx_ver diff --git a/cuda_bindings/tests/test_version_check.py b/cuda_bindings/tests/test_version_check.py index 9862d93cc9..21a7013768 100644 --- a/cuda_bindings/tests/test_version_check.py +++ b/cuda_bindings/tests/test_version_check.py @@ -6,6 +6,7 @@ from unittest import mock import pytest + from cuda.bindings import driver from cuda.bindings.utils import _version_check, warn_if_cuda_major_version_mismatch From c99baa390ae4d6f8c156ffccc53e8cac339ec062 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:46:58 -0500 Subject: [PATCH 17/42] fix(ruff/cuda_bindings): RUF100 remove stale noqa comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - RUF100: unused-noqa — 16 fixed across 9 files Made-with: Cursor --- cuda_bindings/setup.py | 2 +- cuda_bindings/tests/nvml/conftest.py | 2 +- cuda_bindings/tests/nvml/test_init.py | 2 +- cuda_bindings/tests/test_cuda.py | 2 +- cuda_bindings/tests/test_cufile.py | 4 ++-- cuda_bindings/tests/test_graphics_apis.py | 6 +++--- cuda_bindings/tests/test_nvfatbin.py | 4 ++-- cuda_bindings/tests/test_nvvm.py | 6 +++--- cuda_bindings/tests/test_utils.py | 4 ++-- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cuda_bindings/setup.py b/cuda_bindings/setup.py index adbf843fdc..88c991008e 100644 --- a/cuda_bindings/setup.py +++ b/cuda_bindings/setup.py @@ -25,7 +25,7 @@ def _is_clang(compiler): @functools.lru_cache def _check(compiler_cxx): try: - output = subprocess.check_output([*compiler_cxx, "--version"]) # noqa: S603 + output = subprocess.check_output([*compiler_cxx, "--version"]) except subprocess.CalledProcessError: return False lines = output.decode().splitlines() diff --git a/cuda_bindings/tests/nvml/conftest.py b/cuda_bindings/tests/nvml/conftest.py index 06c651900c..6f224acf18 100644 --- a/cuda_bindings/tests/nvml/conftest.py +++ b/cuda_bindings/tests/nvml/conftest.py @@ -6,7 +6,7 @@ import pytest from cuda.bindings import nvml -from cuda.bindings._test_helpers.arch_check import unsupported_before # noqa: F401 +from cuda.bindings._test_helpers.arch_check import unsupported_before class NVMLInitializer: diff --git a/cuda_bindings/tests/nvml/test_init.py b/cuda_bindings/tests/nvml/test_init.py index 4721352c19..6187e1c88c 100644 --- a/cuda_bindings/tests/nvml/test_init.py +++ b/cuda_bindings/tests/nvml/test_init.py @@ -28,7 +28,7 @@ def test_devices_are_the_same_architecture(all_devices): all_arches = set(nvml.DeviceArch(nvml.device_get_architecture(device)) for device in all_devices) if len(all_arches) > 1: - warnings.warn( # noqa: B028 + warnings.warn( f"System has devices of multiple architectures ({', '.join(x.name for x in all_arches)}). " f" Some tests may be skipped unexpectedly", UserWarning, diff --git a/cuda_bindings/tests/test_cuda.py b/cuda_bindings/tests/test_cuda.py index 60505e4d74..c0605285d0 100644 --- a/cuda_bindings/tests/test_cuda.py +++ b/cuda_bindings/tests/test_cuda.py @@ -558,7 +558,7 @@ def test_device_get_name(device): import subprocess p = subprocess.check_output( - ["nvidia-smi", "--query-gpu=name", "--format=csv,noheader"], # noqa: S607 + ["nvidia-smi", "--query-gpu=name", "--format=csv,noheader"], shell=False, stderr=subprocess.PIPE, ) diff --git a/cuda_bindings/tests/test_cufile.py b/cuda_bindings/tests/test_cufile.py index 93a876bb41..591681fc7e 100644 --- a/cuda_bindings/tests/test_cufile.py +++ b/cuda_bindings/tests/test_cufile.py @@ -75,7 +75,7 @@ def isSupportedFilesystem(): This uses `findmnt` so the kernel's mount table logic owns the decoding of the filesystem type. """ - fs_type = subprocess.check_output(["findmnt", "-no", "FSTYPE", "-T", os.getcwd()], text=True).strip() # noqa: S603, S607 + fs_type = subprocess.check_output(["findmnt", "-no", "FSTYPE", "-T", os.getcwd()], text=True).strip() logging.info(f"Current filesystem type (findmnt): {fs_type}") return fs_type in ("ext4", "xfs") @@ -85,7 +85,7 @@ def get_tegra_kind(): """Detect Tegra device kind (Orin/Thor) via nvidia-smi, or None if not Tegra.""" if not pathlib.Path("/etc/nv_tegra_release").exists(): return None - out = subprocess.check_output(["nvidia-smi"], text=True, stderr=subprocess.STDOUT) # noqa: S607 + out = subprocess.check_output(["nvidia-smi"], text=True, stderr=subprocess.STDOUT) tegra_kinds_found = [] for kind in ("Orin", "Thor"): if f" {kind} " in out: diff --git a/cuda_bindings/tests/test_graphics_apis.py b/cuda_bindings/tests/test_graphics_apis.py index 558a4ac6d8..542bf26cff 100644 --- a/cuda_bindings/tests/test_graphics_apis.py +++ b/cuda_bindings/tests/test_graphics_apis.py @@ -42,7 +42,7 @@ def _gl_context(): win.switch_to() else: # Headless EGL path; pyglet will arrange a pbuffer-like headless context - from pyglet.gl import headless # noqa: F401 (import side-effect creates context) + from pyglet.gl import headless # Make a tiny texture so we have a real GL object to register from pyglet.gl import gl as _gl @@ -68,12 +68,12 @@ def _gl_context(): if tex_id.value: _gl.glDeleteTextures(1, ctypes.byref(tex_id)) - except Exception: # noqa: S110 + except Exception: pass try: if win is not None: win.close() - except Exception: # noqa: S110 + except Exception: pass diff --git a/cuda_bindings/tests/test_nvfatbin.py b/cuda_bindings/tests/test_nvfatbin.py index 32c6e70f59..fdef5b003f 100644 --- a/cuda_bindings/tests/test_nvfatbin.py +++ b/cuda_bindings/tests/test_nvfatbin.py @@ -102,7 +102,7 @@ def nvcc_smoke(tmpdir) -> str: with open(src, "w") as f: f.write("") try: - subprocess.run( # noqa: S603 + subprocess.run( [nvcc, "-c", str(src), "-o", str(out)], check=True, capture_output=True, @@ -177,7 +177,7 @@ def OBJECT(arch, tmpdir, nvcc_smoke): # compile a temporary CUDA translation unit. cmd = [nvcc, "-c", "-arch", arch, "-o", str(tmpdir / "object.o"), str(tmpdir / "object.cu")] try: - subprocess.run( # noqa: S603 + subprocess.run( cmd, check=True, capture_output=True, diff --git a/cuda_bindings/tests/test_nvvm.py b/cuda_bindings/tests/test_nvvm.py index c5d0c70f5d..a3e4c81d4a 100644 --- a/cuda_bindings/tests/test_nvvm.py +++ b/cuda_bindings/tests/test_nvvm.py @@ -92,7 +92,7 @@ def test_c_or_v_program_fail_invalid_ir(compile_or_verify): assert get_program_log(prog) == "FileNameHere.ll (1, 0): parse expected top-level entity\x00" -def test_c_or_v_program_fail_bad_option(minimal_nvvmir, compile_or_verify): # noqa: F401, F811 +def test_c_or_v_program_fail_bad_option(minimal_nvvmir, compile_or_verify): with nvvm_program() as prog: nvvm.add_module_to_program(prog, minimal_nvvmir, len(minimal_nvvmir), "FileNameHere.ll") with pytest.raises(nvvm.nvvmError, match=match_exact("ERROR_INVALID_OPTION (7)")): @@ -117,7 +117,7 @@ def test_get_buffer_empty(get_size, get_buffer): @pytest.mark.parametrize("options", [[], ["-opt=0"], ["-opt=3", "-g"]]) -def test_compile_program_with_minimal_nvvm_ir(minimal_nvvmir, options): # noqa: F401, F811 +def test_compile_program_with_minimal_nvvm_ir(minimal_nvvmir, options): with nvvm_program() as prog: nvvm.add_module_to_program(prog, minimal_nvvmir, len(minimal_nvvmir), "FileNameHere.ll") try: @@ -137,7 +137,7 @@ def test_compile_program_with_minimal_nvvm_ir(minimal_nvvmir, options): # noqa: @pytest.mark.parametrize("options", [[], ["-opt=0"], ["-opt=3", "-g"]]) -def test_verify_program_with_minimal_nvvm_ir(minimal_nvvmir, options): # noqa: F401, F811 +def test_verify_program_with_minimal_nvvm_ir(minimal_nvvmir, options): with nvvm_program() as prog: nvvm.add_module_to_program(prog, minimal_nvvmir, len(minimal_nvvmir), "FileNameHere.ll") nvvm.verify_program(prog, len(options), options) diff --git a/cuda_bindings/tests/test_utils.py b/cuda_bindings/tests/test_utils.py index 1f311e9fdc..a03c5a4449 100644 --- a/cuda_bindings/tests/test_utils.py +++ b/cuda_bindings/tests/test_utils.py @@ -76,7 +76,7 @@ def test_ptx_utils(kernel, actual_ptx_ver, min_cuda_ver): ), ) def test_get_handle(target): - ptr = random.randint(1, 1024) # noqa: S311 + ptr = random.randint(1, 1024) obj = target(ptr) handle = get_cuda_native_handle(obj) assert handle == ptr @@ -109,7 +109,7 @@ def test_get_handle_error(target): ], ) def test_cyclical_imports(module): - subprocess.check_call( # noqa: S603 + subprocess.check_call( [sys.executable, Path(__file__).parent / "utils" / "check_cyclical_import.py", f"cuda.bindings.{module}"], ) From b3abd2274eeaa5ef946cfb8d742f0867d4046eec Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:47:11 -0500 Subject: [PATCH 18/42] fix(ruff/cuda_bindings): C4 simplify comprehensions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - C416: unnecessary-comprehension — use set()/list() directly - C401: unnecessary-generator-set — use set comprehension - C419: unnecessary-comprehension-in-call — use generator in all()/any() - C400: unnecessary-generator-list — use list comprehension - C414: unnecessary-double-cast-or-process — remove redundant list() - C420: unnecessary-dict-comprehension — use dict.fromkeys() 9 fixed across 3 files Made-with: Cursor --- cuda_bindings/build_hooks.py | 14 +++++++------- cuda_bindings/tests/nvml/conftest.py | 2 +- cuda_bindings/tests/nvml/test_init.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cuda_bindings/build_hooks.py b/cuda_bindings/build_hooks.py index e83485fc41..8f9899fc1c 100644 --- a/cuda_bindings/build_hooks.py +++ b/cuda_bindings/build_hooks.py @@ -176,12 +176,12 @@ def _parse_headers(header_dict, include_path_list, parser_caching): CUDA_VERSION = parser.defs["macros"].get("CUDA_VERSION", "Unknown") print(f"Found CUDA_VERSION: {CUDA_VERSION}", flush=True) - found_types += {key for key in parser.defs["types"]} - found_types += {key for key in parser.defs["structs"]} - found_types += {key for key in parser.defs["unions"]} - found_types += {key for key in parser.defs["enums"]} - found_functions += {key for key in parser.defs["functions"]} - found_values += {key for key in parser.defs["values"]} + found_types += set(parser.defs["types"]) + found_types += set(parser.defs["structs"]) + found_types += set(parser.defs["unions"]) + found_types += set(parser.defs["enums"]) + found_functions += set(parser.defs["functions"]) + found_values += set(parser.defs["values"]) for key, value in parser.defs["structs"].items(): struct_list[key] = _Struct(key, value["members"]) @@ -408,7 +408,7 @@ def _cleanup_dst_files(): ) # Cythonize - cython_directives = dict(language_level=3, embedsignature=True, binding=True, freethreading_compatible=True) + cython_directives = {"language_level": 3, "embedsignature": True, "binding": True, "freethreading_compatible": True} if compile_for_coverage: cython_directives["linetrace"] = True diff --git a/cuda_bindings/tests/nvml/conftest.py b/cuda_bindings/tests/nvml/conftest.py index 6f224acf18..6adc14ece5 100644 --- a/cuda_bindings/tests/nvml/conftest.py +++ b/cuda_bindings/tests/nvml/conftest.py @@ -75,7 +75,7 @@ def get_devices(device_info): @pytest.fixture def all_devices(device_info): with NVMLInitializer(): - yield sorted(list(set(get_devices(device_info)))) + yield sorted(set(get_devices(device_info))) @pytest.fixture diff --git a/cuda_bindings/tests/nvml/test_init.py b/cuda_bindings/tests/nvml/test_init.py index 6187e1c88c..2a04799708 100644 --- a/cuda_bindings/tests/nvml/test_init.py +++ b/cuda_bindings/tests/nvml/test_init.py @@ -25,7 +25,7 @@ def test_devices_are_the_same_architecture(all_devices): # they won't be tested properly. This tests for the (hopefully rare) case # where a system has devices of different architectures and produces a warning. - all_arches = set(nvml.DeviceArch(nvml.device_get_architecture(device)) for device in all_devices) + all_arches = {nvml.DeviceArch(nvml.device_get_architecture(device)) for device in all_devices} if len(all_arches) > 1: warnings.warn( From 701c4ce2942a9c07c757f33ca6a26f183af37cf2 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:47:22 -0500 Subject: [PATCH 19/42] fix(ruff/cuda_bindings): PIE misc cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PIE808: unnecessary-range-start — remove redundant range(0, n) - PIE790: unnecessary-placeholder — remove pass after docstring - PIE810: multiple-starts-ends-with — consolidate into tuple arg 5 fixed across 4 files Made-with: Cursor --- cuda_bindings/build_hooks.py | 2 +- cuda_bindings/examples/0_Introduction/clock_nvrtc_test.py | 4 ++-- .../examples/3_CUDA_Features/simpleCudaGraphs_test.py | 2 +- cuda_bindings/tests/test_cuda.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cuda_bindings/build_hooks.py b/cuda_bindings/build_hooks.py index 8f9899fc1c..84f7c131e9 100644 --- a/cuda_bindings/build_hooks.py +++ b/cuda_bindings/build_hooks.py @@ -189,7 +189,7 @@ def _parse_headers(header_dict, include_path_list, parser_caching): struct_list[key] = _Struct(key, value["members"]) for key, value in struct_list.items(): - if key.startswith("anon_union") or key.startswith("anon_struct"): + if key.startswith(("anon_union", "anon_struct")): continue found_struct += [key] diff --git a/cuda_bindings/examples/0_Introduction/clock_nvrtc_test.py b/cuda_bindings/examples/0_Introduction/clock_nvrtc_test.py index 4d3e557a39..e9621a15a7 100644 --- a/cuda_bindings/examples/0_Introduction/clock_nvrtc_test.py +++ b/cuda_bindings/examples/0_Introduction/clock_nvrtc_test.py @@ -68,7 +68,7 @@ def main(): timer = np.empty(NUM_BLOCKS * 2, dtype="int64") hinput = np.empty(NUM_THREADS * 2, dtype="float32") - for i in range(0, NUM_THREADS * 2): + for i in range(NUM_THREADS * 2): hinput[i] = i devID = findCudaDevice() @@ -106,7 +106,7 @@ def main(): avgElapsedClocks = 0.0 - for i in range(0, NUM_BLOCKS): + for i in range(NUM_BLOCKS): avgElapsedClocks += timer[i + NUM_BLOCKS] - timer[i] avgElapsedClocks = avgElapsedClocks / NUM_BLOCKS diff --git a/cuda_bindings/examples/3_CUDA_Features/simpleCudaGraphs_test.py b/cuda_bindings/examples/3_CUDA_Features/simpleCudaGraphs_test.py index 37afee4015..37feb26452 100644 --- a/cuda_bindings/examples/3_CUDA_Features/simpleCudaGraphs_test.py +++ b/cuda_bindings/examples/3_CUDA_Features/simpleCudaGraphs_test.py @@ -117,7 +117,7 @@ def init_input(a, size): ctypes.c_float.from_address(a) a_list = ctypes.pointer(ctypes.c_float.from_address(a)) - for i in range(0, size): + for i in range(size): a_list[i] = rnd.random() diff --git a/cuda_bindings/tests/test_cuda.py b/cuda_bindings/tests/test_cuda.py index c0605285d0..2ad3ef9fc9 100644 --- a/cuda_bindings/tests/test_cuda.py +++ b/cuda_bindings/tests/test_cuda.py @@ -620,7 +620,7 @@ def test_char_range(): for x in range(-128, 0): val.reserved = [x] * 64 assert val.reserved[0] == 256 + x - for x in range(0, 256): + for x in range(256): val.reserved = [x] * 64 assert val.reserved[0] == x From b38faf4288345ba44d43882326876269e290858d Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:47:55 -0500 Subject: [PATCH 20/42] fix(ruff/cuda_bindings): PT pytest-style fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PT003: extraneous-scope-function — remove default scope="function" (4 fixes) - PT001: pytest-fixture-incorrect-parentheses — remove empty parentheses 4 fixed across 1 files Made-with: Cursor --- cuda_bindings/benchmarks/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cuda_bindings/benchmarks/conftest.py b/cuda_bindings/benchmarks/conftest.py index 2787f41d11..0ea7b1d772 100644 --- a/cuda_bindings/benchmarks/conftest.py +++ b/cuda_bindings/benchmarks/conftest.py @@ -23,7 +23,7 @@ def ASSERT_DRV(err): raise RuntimeError(f"Unknown error type: {err}") -@pytest.fixture(scope="function") +@pytest.fixture def init_cuda(): # Initialize (err,) = cuda.cuInit(0) @@ -45,7 +45,7 @@ def init_cuda(): ASSERT_DRV(err) -@pytest.fixture(scope="function") +@pytest.fixture def load_module(): module = None From 67a18030bfc7400c54584d844df7dbf2b3ddef7a Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:52:21 -0500 Subject: [PATCH 21/42] fix(ruff/cuda_bindings): F pyflakes fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - F401: unused-import — suppress for intentional re-exports and side-effect imports (2 noqa in 2 files) Made-with: Cursor --- cuda_bindings/tests/nvml/conftest.py | 2 +- cuda_bindings/tests/test_graphics_apis.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cuda_bindings/tests/nvml/conftest.py b/cuda_bindings/tests/nvml/conftest.py index 6adc14ece5..f350610c7c 100644 --- a/cuda_bindings/tests/nvml/conftest.py +++ b/cuda_bindings/tests/nvml/conftest.py @@ -6,7 +6,7 @@ import pytest from cuda.bindings import nvml -from cuda.bindings._test_helpers.arch_check import unsupported_before +from cuda.bindings._test_helpers.arch_check import unsupported_before # noqa: F401 class NVMLInitializer: diff --git a/cuda_bindings/tests/test_graphics_apis.py b/cuda_bindings/tests/test_graphics_apis.py index 542bf26cff..0cde1196f7 100644 --- a/cuda_bindings/tests/test_graphics_apis.py +++ b/cuda_bindings/tests/test_graphics_apis.py @@ -42,7 +42,7 @@ def _gl_context(): win.switch_to() else: # Headless EGL path; pyglet will arrange a pbuffer-like headless context - from pyglet.gl import headless + from pyglet.gl import headless # noqa: F401 # Make a tiny texture so we have a real GL object to register from pyglet.gl import gl as _gl From b527939f903c9f57bb26922ef05fb3fd6b149d69 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 12:02:17 -0500 Subject: [PATCH 22/42] fix(ruff/cuda_bindings): S bandit security suppressions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - S110: try-except-pass — suppress for best-effort cleanup (2 noqa in 1 file) - S603: subprocess-without-shell-equals-true — suppress at call site (5 noqa in 4 files) - S607: start-process-with-partial-path — suppress at call site (3 noqa in 2 files) Made-with: Cursor --- cuda_bindings/setup.py | 2 +- cuda_bindings/tests/test_cuda.py | 2 +- cuda_bindings/tests/test_cufile.py | 4 ++-- cuda_bindings/tests/test_graphics_apis.py | 4 ++-- cuda_bindings/tests/test_nvfatbin.py | 4 ++-- cuda_bindings/tests/test_utils.py | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cuda_bindings/setup.py b/cuda_bindings/setup.py index 88c991008e..adbf843fdc 100644 --- a/cuda_bindings/setup.py +++ b/cuda_bindings/setup.py @@ -25,7 +25,7 @@ def _is_clang(compiler): @functools.lru_cache def _check(compiler_cxx): try: - output = subprocess.check_output([*compiler_cxx, "--version"]) + output = subprocess.check_output([*compiler_cxx, "--version"]) # noqa: S603 except subprocess.CalledProcessError: return False lines = output.decode().splitlines() diff --git a/cuda_bindings/tests/test_cuda.py b/cuda_bindings/tests/test_cuda.py index 2ad3ef9fc9..3527ae49d2 100644 --- a/cuda_bindings/tests/test_cuda.py +++ b/cuda_bindings/tests/test_cuda.py @@ -557,7 +557,7 @@ def test_device_get_name(device): # TODO: Refactor this test once we have nvml bindings to avoid the use of subprocess import subprocess - p = subprocess.check_output( + p = subprocess.check_output( # noqa: S603, S607 ["nvidia-smi", "--query-gpu=name", "--format=csv,noheader"], shell=False, stderr=subprocess.PIPE, diff --git a/cuda_bindings/tests/test_cufile.py b/cuda_bindings/tests/test_cufile.py index 591681fc7e..ca9e6e64d6 100644 --- a/cuda_bindings/tests/test_cufile.py +++ b/cuda_bindings/tests/test_cufile.py @@ -75,7 +75,7 @@ def isSupportedFilesystem(): This uses `findmnt` so the kernel's mount table logic owns the decoding of the filesystem type. """ - fs_type = subprocess.check_output(["findmnt", "-no", "FSTYPE", "-T", os.getcwd()], text=True).strip() + fs_type = subprocess.check_output(["findmnt", "-no", "FSTYPE", "-T", os.getcwd()], text=True).strip() # noqa: S603, S607 logging.info(f"Current filesystem type (findmnt): {fs_type}") return fs_type in ("ext4", "xfs") @@ -85,7 +85,7 @@ def get_tegra_kind(): """Detect Tegra device kind (Orin/Thor) via nvidia-smi, or None if not Tegra.""" if not pathlib.Path("/etc/nv_tegra_release").exists(): return None - out = subprocess.check_output(["nvidia-smi"], text=True, stderr=subprocess.STDOUT) + out = subprocess.check_output(["nvidia-smi"], text=True, stderr=subprocess.STDOUT) # noqa: S603, S607 tegra_kinds_found = [] for kind in ("Orin", "Thor"): if f" {kind} " in out: diff --git a/cuda_bindings/tests/test_graphics_apis.py b/cuda_bindings/tests/test_graphics_apis.py index 0cde1196f7..ecfeba96fd 100644 --- a/cuda_bindings/tests/test_graphics_apis.py +++ b/cuda_bindings/tests/test_graphics_apis.py @@ -68,12 +68,12 @@ def _gl_context(): if tex_id.value: _gl.glDeleteTextures(1, ctypes.byref(tex_id)) - except Exception: + except Exception: # noqa: S110 pass try: if win is not None: win.close() - except Exception: + except Exception: # noqa: S110 pass diff --git a/cuda_bindings/tests/test_nvfatbin.py b/cuda_bindings/tests/test_nvfatbin.py index fdef5b003f..32c6e70f59 100644 --- a/cuda_bindings/tests/test_nvfatbin.py +++ b/cuda_bindings/tests/test_nvfatbin.py @@ -102,7 +102,7 @@ def nvcc_smoke(tmpdir) -> str: with open(src, "w") as f: f.write("") try: - subprocess.run( + subprocess.run( # noqa: S603 [nvcc, "-c", str(src), "-o", str(out)], check=True, capture_output=True, @@ -177,7 +177,7 @@ def OBJECT(arch, tmpdir, nvcc_smoke): # compile a temporary CUDA translation unit. cmd = [nvcc, "-c", "-arch", arch, "-o", str(tmpdir / "object.o"), str(tmpdir / "object.cu")] try: - subprocess.run( + subprocess.run( # noqa: S603 cmd, check=True, capture_output=True, diff --git a/cuda_bindings/tests/test_utils.py b/cuda_bindings/tests/test_utils.py index a03c5a4449..fd89cd00bd 100644 --- a/cuda_bindings/tests/test_utils.py +++ b/cuda_bindings/tests/test_utils.py @@ -109,7 +109,7 @@ def test_get_handle_error(target): ], ) def test_cyclical_imports(module): - subprocess.check_call( + subprocess.check_call( # noqa: S603 [sys.executable, Path(__file__).parent / "utils" / "check_cyclical_import.py", f"cuda.bindings.{module}"], ) From 578d4395d4ba0f35ae53149c0c752e14dcf00afc Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:46:59 -0500 Subject: [PATCH 23/42] fix(ruff/cuda_pathfinder): RUF100 remove stale noqa comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - RUF100: unused-noqa — 12 fixed across 7 files Made-with: Cursor --- cuda_pathfinder/cuda/pathfinder/__init__.py | 4 ++-- .../pathfinder/_dynamic_libs/canary_probe_subprocess.py | 2 +- .../pathfinder/_dynamic_libs/find_nvidia_dynamic_lib.py | 4 ++-- .../cuda/pathfinder/_headers/find_nvidia_headers.py | 2 +- .../cuda/pathfinder/_utils/spawned_process_runner.py | 6 +++--- .../tests/child_load_nvidia_dynamic_lib_helper.py | 4 ++-- cuda_pathfinder/tests/conftest.py | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cuda_pathfinder/cuda/pathfinder/__init__.py b/cuda_pathfinder/cuda/pathfinder/__init__.py index 96831d87ef..57702de425 100644 --- a/cuda_pathfinder/cuda/pathfinder/__init__.py +++ b/cuda_pathfinder/cuda/pathfinder/__init__.py @@ -17,7 +17,7 @@ from cuda.pathfinder._dynamic_libs.load_dl_common import LoadedDL as LoadedDL from cuda.pathfinder._dynamic_libs.load_nvidia_dynamic_lib import load_nvidia_dynamic_lib as load_nvidia_dynamic_lib from cuda.pathfinder._dynamic_libs.supported_nvidia_libs import ( - SUPPORTED_LIBNAMES as SUPPORTED_NVIDIA_LIBNAMES, # noqa: F401 + SUPPORTED_LIBNAMES as SUPPORTED_NVIDIA_LIBNAMES, ) from cuda.pathfinder._headers.find_nvidia_headers import LocatedHeaderDir as LocatedHeaderDir from cuda.pathfinder._headers.find_nvidia_headers import find_nvidia_header_directory as find_nvidia_header_directory @@ -56,7 +56,7 @@ locate_static_lib as locate_static_lib, ) -from cuda.pathfinder._version import __version__ # isort: skip # noqa: F401 +from cuda.pathfinder._version import __version__ # isort: skip # Indirections to help Sphinx find the docstrings. #: Mapping from short CUDA Toolkit (CTK) library names to their canonical diff --git a/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/canary_probe_subprocess.py b/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/canary_probe_subprocess.py index 3f1525dd48..f789d14363 100644 --- a/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/canary_probe_subprocess.py +++ b/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/canary_probe_subprocess.py @@ -27,4 +27,4 @@ def _probe_canary_abs_path(libname: str) -> str | None: def probe_canary_abs_path_and_print_json(libname: str) -> None: - print(json.dumps(_probe_canary_abs_path(libname))) # noqa: T201 + print(json.dumps(_probe_canary_abs_path(libname))) diff --git a/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/find_nvidia_dynamic_lib.py b/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/find_nvidia_dynamic_lib.py index b93523f36a..9a1bb67157 100644 --- a/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/find_nvidia_dynamic_lib.py +++ b/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/find_nvidia_dynamic_lib.py @@ -82,7 +82,7 @@ def _find_lib_dir_using_anchor_point(libname: str, anchor_point: str, linux_lib_ # Resolve paths for the four cases: # Windows/Linux x nvvm yes/no if IS_WINDOWS: - if libname == "nvvm": # noqa: SIM108 + if libname == "nvvm": rel_paths = [ "nvvm/bin/*", # CTK 13 "nvvm/bin", # CTK 12 @@ -93,7 +93,7 @@ def _find_lib_dir_using_anchor_point(libname: str, anchor_point: str, linux_lib_ "bin", # CTK 12 ] else: - if libname == "nvvm": # noqa: SIM108 + if libname == "nvvm": rel_paths = ["nvvm/lib64"] else: rel_paths = [linux_lib_dir] diff --git a/cuda_pathfinder/cuda/pathfinder/_headers/find_nvidia_headers.py b/cuda_pathfinder/cuda/pathfinder/_headers/find_nvidia_headers.py index 637ecabfcb..7a3720398a 100644 --- a/cuda_pathfinder/cuda/pathfinder/_headers/find_nvidia_headers.py +++ b/cuda_pathfinder/cuda/pathfinder/_headers/find_nvidia_headers.py @@ -103,7 +103,7 @@ def _find_ctk_header_directory(libname: str) -> LocatedHeaderDir | None: return hdr_dir cuda_home = get_cuda_home_or_path() - if cuda_home: # noqa: SIM102 + if cuda_home: if result := _locate_based_on_ctk_layout(libname, h_basename, cuda_home): return LocatedHeaderDir(abs_path=result, found_via="CUDA_HOME") diff --git a/cuda_pathfinder/cuda/pathfinder/_utils/spawned_process_runner.py b/cuda_pathfinder/cuda/pathfinder/_utils/spawned_process_runner.py index a5358d3d8d..56fa16d19f 100644 --- a/cuda_pathfinder/cuda/pathfinder/_utils/spawned_process_runner.py +++ b/cuda_pathfinder/cuda/pathfinder/_utils/spawned_process_runner.py @@ -57,9 +57,9 @@ def __call__(self) -> None: stderr = sys.stderr.getvalue() sys.stdout = old_stdout sys.stderr = old_stderr - try: # noqa: SIM105 + try: self.result_queue.put((returncode, stdout, stderr)) - except Exception: # noqa: S110 + except Exception: # If the queue is broken (e.g., parent gone), best effort logging pass @@ -126,7 +126,7 @@ def run_in_spawned_child_process( try: result_queue.close() result_queue.join_thread() - except Exception: # noqa: S110 + except Exception: pass if process.is_alive(): process.kill() diff --git a/cuda_pathfinder/tests/child_load_nvidia_dynamic_lib_helper.py b/cuda_pathfinder/tests/child_load_nvidia_dynamic_lib_helper.py index 685d2eda20..245552e874 100644 --- a/cuda_pathfinder/tests/child_load_nvidia_dynamic_lib_helper.py +++ b/cuda_pathfinder/tests/child_load_nvidia_dynamic_lib_helper.py @@ -37,7 +37,7 @@ def child_process_func(libname): try: loaded_dl_fresh = load_nvidia_dynamic_lib(libname) except DynamicLibNotFoundError: - print("CHILD_LOAD_NVIDIA_DYNAMIC_LIB_HELPER_DYNAMIC_LIB_NOT_FOUND_ERROR:") # noqa: T201 + print("CHILD_LOAD_NVIDIA_DYNAMIC_LIB_HELPER_DYNAMIC_LIB_NOT_FOUND_ERROR:") traceback.print_exc(file=sys.stdout) return if loaded_dl_fresh.was_already_loaded_from_elsewhere: @@ -58,4 +58,4 @@ def child_process_func(libname): raise RuntimeError(f"not os.path.samefile({loaded_dl_no_cache.abs_path=!r}, {loaded_dl_fresh.abs_path=!r})") validate_abs_path(loaded_dl_no_cache.abs_path) - print(json.dumps(loaded_dl_fresh.abs_path)) # noqa: T201 + print(json.dumps(loaded_dl_fresh.abs_path)) diff --git a/cuda_pathfinder/tests/conftest.py b/cuda_pathfinder/tests/conftest.py index 42cff8ac52..47f8ff1612 100644 --- a/cuda_pathfinder/tests/conftest.py +++ b/cuda_pathfinder/tests/conftest.py @@ -9,7 +9,7 @@ def pytest_configure(config): config.custom_info = [] -def pytest_terminal_summary(terminalreporter, exitstatus, config): # noqa: ARG001 +def pytest_terminal_summary(terminalreporter, exitstatus, config): if not config.getoption("verbose"): return if hasattr(config.option, "iterations"): # pytest-freethreaded runs all tests at least twice From cf8fe120a2246a4b047c6047f840269b7c7a3bac Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:50:50 -0500 Subject: [PATCH 24/42] fix(ruff/cuda_pathfinder): SIM simplify code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SIM102: collapsible-if — merge nested if statements (1 fix in 1 file) - SIM105: suppressible-exception — use contextlib.suppress instead of try/except/pass (1 fix in 1 file) Made-with: Cursor --- .../cuda/pathfinder/_headers/find_nvidia_headers.py | 5 ++--- .../cuda/pathfinder/_utils/spawned_process_runner.py | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cuda_pathfinder/cuda/pathfinder/_headers/find_nvidia_headers.py b/cuda_pathfinder/cuda/pathfinder/_headers/find_nvidia_headers.py index 7a3720398a..1727cca607 100644 --- a/cuda_pathfinder/cuda/pathfinder/_headers/find_nvidia_headers.py +++ b/cuda_pathfinder/cuda/pathfinder/_headers/find_nvidia_headers.py @@ -103,9 +103,8 @@ def _find_ctk_header_directory(libname: str) -> LocatedHeaderDir | None: return hdr_dir cuda_home = get_cuda_home_or_path() - if cuda_home: - if result := _locate_based_on_ctk_layout(libname, h_basename, cuda_home): - return LocatedHeaderDir(abs_path=result, found_via="CUDA_HOME") + if cuda_home and (result := _locate_based_on_ctk_layout(libname, h_basename, cuda_home)): + return LocatedHeaderDir(abs_path=result, found_via="CUDA_HOME") return None diff --git a/cuda_pathfinder/cuda/pathfinder/_utils/spawned_process_runner.py b/cuda_pathfinder/cuda/pathfinder/_utils/spawned_process_runner.py index 56fa16d19f..f0fdba5331 100644 --- a/cuda_pathfinder/cuda/pathfinder/_utils/spawned_process_runner.py +++ b/cuda_pathfinder/cuda/pathfinder/_utils/spawned_process_runner.py @@ -1,6 +1,7 @@ # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +import contextlib import multiprocessing import queue # for Empty import sys @@ -57,11 +58,8 @@ def __call__(self) -> None: stderr = sys.stderr.getvalue() sys.stdout = old_stdout sys.stderr = old_stderr - try: + with contextlib.suppress(Exception): self.result_queue.put((returncode, stdout, stderr)) - except Exception: - # If the queue is broken (e.g., parent gone), best effort logging - pass def run_in_spawned_child_process( From 68cdef8b37a6f182af6a058cfca17d34267aa878 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 12:03:23 -0500 Subject: [PATCH 25/42] fix(ruff/cuda_pathfinder): S bandit security suppressions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - S110: try-except-pass — suppress for best-effort cleanup (1 noqa in 1 file) Made-with: Cursor --- .../cuda/pathfinder/_utils/spawned_process_runner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cuda_pathfinder/cuda/pathfinder/_utils/spawned_process_runner.py b/cuda_pathfinder/cuda/pathfinder/_utils/spawned_process_runner.py index f0fdba5331..5ddfa10a59 100644 --- a/cuda_pathfinder/cuda/pathfinder/_utils/spawned_process_runner.py +++ b/cuda_pathfinder/cuda/pathfinder/_utils/spawned_process_runner.py @@ -124,7 +124,7 @@ def run_in_spawned_child_process( try: result_queue.close() result_queue.join_thread() - except Exception: + except Exception: # noqa: S110 pass if process.is_alive(): process.kill() From 592f729c742973d75b856a1b23daee142cd7db31 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:46:49 -0500 Subject: [PATCH 26/42] fix(ruff/cuda_python_test_helpers): I001 sort imports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - I001: unsorted imports — across 1 files Made-with: Cursor --- .../cuda_python_test_helpers/nvvm_bitcode.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cuda_python_test_helpers/cuda_python_test_helpers/nvvm_bitcode.py b/cuda_python_test_helpers/cuda_python_test_helpers/nvvm_bitcode.py index 5264b947d0..6eb92ca89b 100644 --- a/cuda_python_test_helpers/cuda_python_test_helpers/nvvm_bitcode.py +++ b/cuda_python_test_helpers/cuda_python_test_helpers/nvvm_bitcode.py @@ -5,6 +5,7 @@ import binascii import pytest + from cuda.bindings import nvvm MINIMAL_NVVMIR_TXT_TEMPLATE = b"""\ From 68c8ee8bb00f3ae874f4e6d87e3b1f4e84f152f7 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:46:59 -0500 Subject: [PATCH 27/42] fix(ruff/cuda_python_test_helpers): RUF100 remove stale noqa comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - RUF100: unused-noqa — 1 fixed across 1 files Made-with: Cursor --- .../cuda_python_test_helpers/nvvm_bitcode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cuda_python_test_helpers/cuda_python_test_helpers/nvvm_bitcode.py b/cuda_python_test_helpers/cuda_python_test_helpers/nvvm_bitcode.py index 6eb92ca89b..7056c3befd 100644 --- a/cuda_python_test_helpers/cuda_python_test_helpers/nvvm_bitcode.py +++ b/cuda_python_test_helpers/cuda_python_test_helpers/nvvm_bitcode.py @@ -23,7 +23,7 @@ !nvvmir.version = !{!1} !1 = !{i32 %d, i32 0, i32 %d, i32 0} -""" # noqa: E501 +""" MINIMAL_NVVMIR_BITCODE_STATIC = { (1, 3): # (major, debug_major) From 2e59977f3dc6f9d1b5c4acf2c9cefa7ed720ec57 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:49:52 -0500 Subject: [PATCH 28/42] fix(ruff/cuda_python_test_helpers): RUF ruff-specific fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - RUF059: unused-unpacked-variable — prefix unused vars with underscore (2 fixes in 1 file) Made-with: Cursor --- .../cuda_python_test_helpers/nvvm_bitcode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cuda_python_test_helpers/cuda_python_test_helpers/nvvm_bitcode.py b/cuda_python_test_helpers/cuda_python_test_helpers/nvvm_bitcode.py index 7056c3befd..ddb6eae107 100644 --- a/cuda_python_test_helpers/cuda_python_test_helpers/nvvm_bitcode.py +++ b/cuda_python_test_helpers/cuda_python_test_helpers/nvvm_bitcode.py @@ -123,7 +123,7 @@ @pytest.fixture(params=("txt", "bitcode_static")) def minimal_nvvmir(request): - major, minor, debug_major, debug_minor = nvvm.ir_version() + major, _minor, debug_major, _debug_minor = nvvm.ir_version() if request.param == "txt": return MINIMAL_NVVMIR_TXT_TEMPLATE % (major, debug_major) From 751d2525da59620c1deaf1df2141df6abb485a0a Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:46:49 -0500 Subject: [PATCH 29/42] fix(ruff/toolshed): I001 sort imports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - I001: unsorted imports — across 2 files Made-with: Cursor --- toolshed/build_static_bitcode_input.py | 1 + toolshed/dump_cutile_b64.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/toolshed/build_static_bitcode_input.py b/toolshed/build_static_bitcode_input.py index 95c3a610f6..273ce33244 100755 --- a/toolshed/build_static_bitcode_input.py +++ b/toolshed/build_static_bitcode_input.py @@ -19,6 +19,7 @@ import textwrap import llvmlite.binding # HINT: pip install llvmlite + from cuda.bindings import nvvm diff --git a/toolshed/dump_cutile_b64.py b/toolshed/dump_cutile_b64.py index 4ce5a82a9f..162d2fc20a 100644 --- a/toolshed/dump_cutile_b64.py +++ b/toolshed/dump_cutile_b64.py @@ -13,9 +13,10 @@ import os import sys -import cuda.tile as ct import cupy +import cuda.tile as ct + def _run_sample_cutile_kernel() -> None: # Import after env var setup so CUDA_TILE_DUMP_BYTECODE is honored. From 5e862882e8dcde26d508853e75260918b43f66cc Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:46:59 -0500 Subject: [PATCH 30/42] fix(ruff/toolshed): RUF100 remove stale noqa comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - RUF100: unused-noqa — 2 fixed across 1 files Made-with: Cursor --- toolshed/check_spdx.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolshed/check_spdx.py b/toolshed/check_spdx.py index 2359a89708..abb706a0a1 100644 --- a/toolshed/check_spdx.py +++ b/toolshed/check_spdx.py @@ -39,8 +39,8 @@ def load_spdx_ignore(): def is_staged(filepath): # If the file is staged, we need to update it to the current year - process = subprocess.run( # noqa: S603 - ["git", "diff", "--staged", "--", filepath], # noqa: S607 + process = subprocess.run( + ["git", "diff", "--staged", "--", filepath], capture_output=True, text=True, ) From 5f2cc882da9ae964ab8aba374b2c6635f5451545 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:51:00 -0500 Subject: [PATCH 31/42] fix(ruff/toolshed): DTZ datetime timezone fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - DTZ011: call-date-today — use timezone-aware datetime.now(tz=utc) (1 fix in 1 file) Made-with: Cursor --- toolshed/check_spdx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolshed/check_spdx.py b/toolshed/check_spdx.py index abb706a0a1..1ccc6f73a1 100644 --- a/toolshed/check_spdx.py +++ b/toolshed/check_spdx.py @@ -34,7 +34,7 @@ def load_spdx_ignore(): rb"(?PNVIDIA CORPORATION( & AFFILIATES\. All rights reserved\.)?)" ) COPYRIGHT_SUB = r"Copyright (c) {} \g" -CURRENT_YEAR = str(datetime.date.today().year) +CURRENT_YEAR = str(datetime.datetime.now(tz=datetime.timezone.utc).year) def is_staged(filepath): From d39cab5eceedd42846b8ae712f0e7251c5bf9f53 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:51:45 -0500 Subject: [PATCH 32/42] fix(ruff/toolshed): N naming convention fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - N806: non-lowercase-variable-in-function — rename TILE_SIZE to tile_size (1 fix in 1 file) Made-with: Cursor --- toolshed/dump_cutile_b64.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/toolshed/dump_cutile_b64.py b/toolshed/dump_cutile_b64.py index 162d2fc20a..84013ea94b 100644 --- a/toolshed/dump_cutile_b64.py +++ b/toolshed/dump_cutile_b64.py @@ -20,13 +20,13 @@ def _run_sample_cutile_kernel() -> None: # Import after env var setup so CUDA_TILE_DUMP_BYTECODE is honored. - TILE_SIZE = 16 + tile_size = 16 @ct.kernel def vector_add_kernel(a, b, result): block_id = ct.bid(0) - a_tile = ct.load(a, index=(block_id,), shape=(TILE_SIZE,)) - b_tile = ct.load(b, index=(block_id,), shape=(TILE_SIZE,)) + a_tile = ct.load(a, index=(block_id,), shape=(tile_size,)) + b_tile = ct.load(b, index=(block_id,), shape=(tile_size,)) result_tile = a_tile + b_tile ct.store(result, index=(block_id,), tile=result_tile) @@ -35,7 +35,7 @@ def vector_add_kernel(a, b, result): b = cupy.arange(128, dtype="float32") result = cupy.zeros_like(a) - grid = (ct.cdiv(a.shape[0], TILE_SIZE), 1, 1) + grid = (ct.cdiv(a.shape[0], tile_size), 1, 1) ct.launch(cupy.cuda.get_current_stream(), grid, vector_add_kernel, (a, b, result)) cupy.cuda.get_current_stream().synchronize() From 99e0a813649caff80091092fceb29c8ebc604690 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 12:03:23 -0500 Subject: [PATCH 33/42] fix(ruff/toolshed): S bandit security suppressions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - S603: subprocess-without-shell-equals-true — suppress at call site (1 noqa in 1 file) - S607: start-process-with-partial-path — suppress at call site (1 noqa in 1 file) Made-with: Cursor --- toolshed/check_spdx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolshed/check_spdx.py b/toolshed/check_spdx.py index 1ccc6f73a1..e5824faaf7 100644 --- a/toolshed/check_spdx.py +++ b/toolshed/check_spdx.py @@ -39,7 +39,7 @@ def load_spdx_ignore(): def is_staged(filepath): # If the file is staged, we need to update it to the current year - process = subprocess.run( + process = subprocess.run( # noqa: S603, S607 ["git", "diff", "--staged", "--", filepath], capture_output=True, text=True, From 4c97999ceb66686b8272eaa559155bfaa5f53dff Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:46:59 -0500 Subject: [PATCH 34/42] fix(ruff/ci): RUF100 remove stale noqa comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - RUF100: unused-noqa — 1 fixed across 1 files Made-with: Cursor --- ci/tools/merge_cuda_core_wheels.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/tools/merge_cuda_core_wheels.py b/ci/tools/merge_cuda_core_wheels.py index e5320e9142..1f1e69c41a 100644 --- a/ci/tools/merge_cuda_core_wheels.py +++ b/ci/tools/merge_cuda_core_wheels.py @@ -36,7 +36,7 @@ def run_command(cmd: List[str], cwd: Path = None, env: dict = os.environ) -> sub if cwd: print(f" Working directory: {cwd}") - result = subprocess.run(cmd, cwd=cwd, env=env, capture_output=True, text=True) # noqa: S603 + result = subprocess.run(cmd, cwd=cwd, env=env, capture_output=True, text=True) if result.returncode != 0: print(f"Command failed with return code {result.returncode}") From 11e89ad969a583c6d9e47da16cf41e1ae736a00f Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:49:52 -0500 Subject: [PATCH 35/42] fix(ruff/ci): RUF ruff-specific fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - RUF013: implicit-optional — annotate as T | None explicitly (2 fixes in 1 file) Made-with: Cursor --- ci/tools/merge_cuda_core_wheels.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/tools/merge_cuda_core_wheels.py b/ci/tools/merge_cuda_core_wheels.py index 1f1e69c41a..8538c806ed 100644 --- a/ci/tools/merge_cuda_core_wheels.py +++ b/ci/tools/merge_cuda_core_wheels.py @@ -30,7 +30,7 @@ from typing import List -def run_command(cmd: List[str], cwd: Path = None, env: dict = os.environ) -> subprocess.CompletedProcess: +def run_command(cmd: List[str], cwd: Path | None = None, env: dict = os.environ) -> subprocess.CompletedProcess: """Run a command with error handling.""" print(f"Running: {' '.join(cmd)}") if cwd: @@ -47,7 +47,7 @@ def run_command(cmd: List[str], cwd: Path = None, env: dict = os.environ) -> sub return result -def print_wheel_directory_structure(wheel_path: Path, filter_prefix: str = "cuda/core/", label: str = None): +def print_wheel_directory_structure(wheel_path: Path, filter_prefix: str = "cuda/core/", label: str | None = None): """Print the directory structure of a wheel file, similar to unzip -l output. Args: From 15f39a512ce532817d38a4c9f459cf82248bb482 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 12:01:22 -0500 Subject: [PATCH 36/42] fix(ruff/ci): S bandit security suppressions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - S603: subprocess-without-shell-equals-true — suppress at call site (1 noqa in 1 file) Made-with: Cursor --- ci/tools/merge_cuda_core_wheels.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/tools/merge_cuda_core_wheels.py b/ci/tools/merge_cuda_core_wheels.py index 8538c806ed..c66a1bfa2a 100644 --- a/ci/tools/merge_cuda_core_wheels.py +++ b/ci/tools/merge_cuda_core_wheels.py @@ -36,7 +36,7 @@ def run_command(cmd: List[str], cwd: Path | None = None, env: dict = os.environ) if cwd: print(f" Working directory: {cwd}") - result = subprocess.run(cmd, cwd=cwd, env=env, capture_output=True, text=True) + result = subprocess.run(cmd, cwd=cwd, env=env, capture_output=True, text=True) # noqa: S603 if result.returncode != 0: print(f"Command failed with return code {result.returncode}") From 8332d62c9ed8a5f7e8355c787a0ed3db7a57cd37 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:52:03 -0500 Subject: [PATCH 37/42] fix(ruff/root): ARG unused argument suppression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ARG001: unused-function-argument — suppress for pytest hook signature (1 noqa in 1 file) Made-with: Cursor --- conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conftest.py b/conftest.py index 7c4cf3a761..7cea6e6612 100644 --- a/conftest.py +++ b/conftest.py @@ -6,7 +6,7 @@ import pytest -def pytest_collection_modifyitems(config, items): +def pytest_collection_modifyitems(config, items): # noqa: ARG001 cuda_home = os.environ.get("CUDA_HOME") for item in items: nodeid = item.nodeid.replace("\\", "/") From f843dd409893143f11f5a93d045f8dd92697e3a3 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 12:04:16 -0500 Subject: [PATCH 38/42] fixup: correct S noqa placement for multiline calls Made-with: Cursor --- cuda_bindings/tests/test_cuda.py | 4 ++-- cuda_bindings/tests/test_cufile.py | 2 +- toolshed/check_spdx.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cuda_bindings/tests/test_cuda.py b/cuda_bindings/tests/test_cuda.py index 3527ae49d2..e056e999f3 100644 --- a/cuda_bindings/tests/test_cuda.py +++ b/cuda_bindings/tests/test_cuda.py @@ -557,8 +557,8 @@ def test_device_get_name(device): # TODO: Refactor this test once we have nvml bindings to avoid the use of subprocess import subprocess - p = subprocess.check_output( # noqa: S603, S607 - ["nvidia-smi", "--query-gpu=name", "--format=csv,noheader"], + p = subprocess.check_output( + ["nvidia-smi", "--query-gpu=name", "--format=csv,noheader"], # noqa: S607 shell=False, stderr=subprocess.PIPE, ) diff --git a/cuda_bindings/tests/test_cufile.py b/cuda_bindings/tests/test_cufile.py index ca9e6e64d6..93a876bb41 100644 --- a/cuda_bindings/tests/test_cufile.py +++ b/cuda_bindings/tests/test_cufile.py @@ -85,7 +85,7 @@ def get_tegra_kind(): """Detect Tegra device kind (Orin/Thor) via nvidia-smi, or None if not Tegra.""" if not pathlib.Path("/etc/nv_tegra_release").exists(): return None - out = subprocess.check_output(["nvidia-smi"], text=True, stderr=subprocess.STDOUT) # noqa: S603, S607 + out = subprocess.check_output(["nvidia-smi"], text=True, stderr=subprocess.STDOUT) # noqa: S607 tegra_kinds_found = [] for kind in ("Orin", "Thor"): if f" {kind} " in out: diff --git a/toolshed/check_spdx.py b/toolshed/check_spdx.py index e5824faaf7..b404b78e30 100644 --- a/toolshed/check_spdx.py +++ b/toolshed/check_spdx.py @@ -39,8 +39,8 @@ def load_spdx_ignore(): def is_staged(filepath): # If the file is staged, we need to update it to the current year - process = subprocess.run( # noqa: S603, S607 - ["git", "diff", "--staged", "--", filepath], + process = subprocess.run( # noqa: S603 + ["git", "diff", "--staged", "--", filepath], # noqa: S607 capture_output=True, text=True, ) From e3a033f4f4d75e1acf52c7dcdfbcc6ec963f9ab4 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 12:04:28 -0500 Subject: [PATCH 39/42] fix(ruff): apply ruff formatting - 2 files reformatted (cuda_core/cuda/core/system/__init__.py, cuda_core/tests/test_utils.py) Made-with: Cursor --- cuda_core/cuda/core/system/__init__.py | 1 - cuda_core/tests/test_utils.py | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cuda_core/cuda/core/system/__init__.py b/cuda_core/cuda/core/system/__init__.py index 4e85c8d5fc..918d135901 100644 --- a/cuda_core/cuda/core/system/__init__.py +++ b/cuda_core/cuda/core/system/__init__.py @@ -3,7 +3,6 @@ # SPDX-License-Identifier: Apache-2.0 - # NOTE: We must maintain that it is always possible to import this module # without CUDA being installed, and without CUDA being initialized or any # contexts created, so that a user can use NVML to explore things about their diff --git a/cuda_core/tests/test_utils.py b/cuda_core/tests/test_utils.py index 79982427f6..13835b5507 100644 --- a/cuda_core/tests/test_utils.py +++ b/cuda_core/tests/test_utils.py @@ -547,7 +547,9 @@ def test_struct_array(init_cuda): pytest.param(np.ones((2, 3, 4), dtype=np.float64), "float64", id="3d-float64"), # Sliced/strided arrays pytest.param(np.array([1, 2, 3, 4, 5, 6], dtype=np.int32)[::2], "int32", id="1d-strided-int32"), - pytest.param(np.array([[1, 2, 3, 4], [5, 6, 7, 8]], dtype=np.float64)[:, ::2], "float64", id="2d-strided-float64"), + pytest.param( + np.array([[1, 2, 3, 4], [5, 6, 7, 8]], dtype=np.float64)[:, ::2], "float64", id="2d-strided-float64" + ), pytest.param(np.arange(20, dtype=np.int32).reshape(4, 5)[::2, ::2], "int32", id="2d-strided-2x2-int32"), # Scalar (0-D array) pytest.param(np.array(42, dtype=np.int32), "int32", id="scalar-int32"), From 1e931db46dd933ce5bd3b01b7c54f87ac9f176a6 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 27 Feb 2026 14:10:25 -0500 Subject: [PATCH 40/42] fix(ruff): add RUF012 to test/benchmark per-file-ignores ctypes Structure._fields_ is a standard pattern, not a mutable default concern Made-with: Cursor --- ruff.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ruff.toml b/ruff.toml index 91446cda97..7f3853529e 100644 --- a/ruff.toml +++ b/ruff.toml @@ -86,6 +86,7 @@ inline-quotes = "double" "T201", # print "ARG001", # unused function argument (fixtures) "ARG002", # unused method argument + "RUF012", # mutable class default (ctypes _fields_ is standard) "RUF059", # unused unpacked variable (side-effect assignments) "F841", # unused local variable (side-effect assignments) "E402", # module-level import not at top of file @@ -115,6 +116,7 @@ inline-quotes = "double" "**/benchmarks/**" = [ "T201", # print + "RUF012", # mutable class default (ctypes _fields_ is standard) "RUF059", # unused unpacked variable "F841", # unused local variable "E402", # module-level import not at top of file From b303f85fa6312540f14f8f48f772030763c0ede2 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Mon, 2 Mar 2026 16:39:27 -0500 Subject: [PATCH 41/42] fix(core): use CUmemAllocationType for VMM allocation enums Read CU_MEM_ALLOCATION_TYPE_* from CUmemAllocationType instead of CUmemAccess_flags so cuda.core imports correctly in test/docs CI jobs. Made-with: Cursor --- cuda_core/cuda/core/_memory/_virtual_memory_resource.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cuda_core/cuda/core/_memory/_virtual_memory_resource.py b/cuda_core/cuda/core/_memory/_virtual_memory_resource.py index 2b12edb776..7aff5709b7 100644 --- a/cuda_core/cuda/core/_memory/_virtual_memory_resource.py +++ b/cuda_core/cuda/core/_memory/_virtual_memory_resource.py @@ -96,11 +96,12 @@ class VirtualMemoryResourceOptions: "host_numa": _l.CU_MEM_LOCATION_TYPE_HOST_NUMA, "host_numa_current": _l.CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT, } + _t = driver.CUmemAllocationType # CUDA 13+ exposes MANAGED in CUmemAllocationType; older 12.x does not - _allocation_type = {"pinned": _a.CU_MEM_ALLOCATION_TYPE_PINNED} # noqa: RUF012 + _allocation_type = {"pinned": _t.CU_MEM_ALLOCATION_TYPE_PINNED} # noqa: RUF012 ver_major, ver_minor = get_binding_version() if ver_major >= 13: - _allocation_type["managed"] = _a.CU_MEM_ALLOCATION_TYPE_MANAGED + _allocation_type["managed"] = _t.CU_MEM_ALLOCATION_TYPE_MANAGED @staticmethod def _access_to_flags(spec: str): From 9e39ad058354bc0b198135c7622f26e6d0dfb8f3 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Mon, 2 Mar 2026 17:08:30 -0500 Subject: [PATCH 42/42] fix(tests): use pytest.param in test_utils Switch test parametrization calls to pytest.param so collection succeeds under current pytest and the pixi cuda_core suite runs end-to-end. Made-with: Cursor --- cuda_core/tests/test_utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cuda_core/tests/test_utils.py b/cuda_core/tests/test_utils.py index 13835b5507..9e79f48313 100644 --- a/cuda_core/tests/test_utils.py +++ b/cuda_core/tests/test_utils.py @@ -83,7 +83,7 @@ def convert_strides_to_counts(strides, itemsize): np.empty((3, 4), order="F"), np.empty((), dtype=np.float16), # readonly is fixed recently (numpy/numpy#26501) - pytest.pytest.param( + pytest.param( np.frombuffer(b""), marks=pytest.mark.skipif( tuple(int(i) for i in np.__version__.split(".")[:2]) < (2, 1), reason="need numpy 2.1.0+" @@ -131,16 +131,16 @@ def gpu_array_samples(): samples = [] if cp is not None: samples += [ - pytest.pytest.param(cp.empty(3, dtype=cp.complex64), False, id="cupy-complex64"), - pytest.pytest.param(cp.empty((6, 6), dtype=cp.float64)[::2, ::2], True, id="cupy-float64"), - pytest.pytest.param(cp.empty((3, 4), order="F"), True, id="cupy-fortran"), + pytest.param(cp.empty(3, dtype=cp.complex64), False, id="cupy-complex64"), + pytest.param(cp.empty((6, 6), dtype=cp.float64)[::2, ::2], True, id="cupy-float64"), + pytest.param(cp.empty((3, 4), order="F"), True, id="cupy-fortran"), ] # Numba's device_array is the only known array container that does not # support DLPack (so that we get to test the CAI coverage). if numba_cuda is not None: samples += [ - pytest.pytest.param(numba_cuda.device_array((2,), dtype=np.int8), False, id="numba-cuda-int8"), - pytest.pytest.param(numba_cuda.device_array((4, 2), dtype=np.float32), True, id="numba-cuda-float32"), + pytest.param(numba_cuda.device_array((2,), dtype=np.int8), False, id="numba-cuda-int8"), + pytest.param(numba_cuda.device_array((4, 2), dtype=np.float32), True, id="numba-cuda-float32"), ] return samples