scikit-sparse 0.4.16__tar.gz → 0.5.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. {scikit_sparse-0.4.16 → scikit_sparse-0.5.1}/LICENSE.txt +2 -1
  2. scikit_sparse-0.5.1/MANIFEST.in +8 -0
  3. scikit_sparse-0.5.1/PKG-INFO +159 -0
  4. scikit_sparse-0.5.1/README.rst +121 -0
  5. scikit_sparse-0.5.1/pyproject.toml +125 -0
  6. scikit_sparse-0.5.1/setup.py +116 -0
  7. scikit_sparse-0.5.1/src/scikit_sparse.egg-info/PKG-INFO +159 -0
  8. scikit_sparse-0.5.1/src/scikit_sparse.egg-info/SOURCES.txt +30 -0
  9. scikit_sparse-0.5.1/src/scikit_sparse.egg-info/requires.txt +12 -0
  10. scikit_sparse-0.5.1/src/sksparse/__init__.py +101 -0
  11. scikit_sparse-0.5.1/src/sksparse/amd.pxd +66 -0
  12. scikit_sparse-0.5.1/src/sksparse/amd.pyx +442 -0
  13. scikit_sparse-0.5.1/src/sksparse/btf.pxd +83 -0
  14. scikit_sparse-0.5.1/src/sksparse/btf.pyx +502 -0
  15. scikit_sparse-0.5.1/src/sksparse/camd.pxd +68 -0
  16. scikit_sparse-0.5.1/src/sksparse/camd.pyx +481 -0
  17. scikit_sparse-0.5.1/src/sksparse/ccolamd.pxd +110 -0
  18. scikit_sparse-0.5.1/src/sksparse/ccolamd.pyx +689 -0
  19. scikit_sparse-0.5.1/src/sksparse/cholmod.pxd +618 -0
  20. scikit_sparse-0.5.1/src/sksparse/cholmod.pyx +4391 -0
  21. scikit_sparse-0.5.1/src/sksparse/colamd.pxd +103 -0
  22. scikit_sparse-0.5.1/src/sksparse/colamd.pyx +604 -0
  23. scikit_sparse-0.5.1/src/sksparse/klu.pxd +533 -0
  24. scikit_sparse-0.5.1/src/sksparse/klu.pyx +2230 -0
  25. scikit_sparse-0.5.1/src/sksparse/spqr.pxd +252 -0
  26. scikit_sparse-0.5.1/src/sksparse/spqr.pyx +2222 -0
  27. scikit_sparse-0.5.1/src/sksparse/umfpack.pxd +609 -0
  28. scikit_sparse-0.5.1/src/sksparse/umfpack.pyx +2405 -0
  29. scikit_sparse-0.5.1/src/sksparse/utils.py +129 -0
  30. scikit_sparse-0.4.16/MANIFEST.in +0 -6
  31. scikit_sparse-0.4.16/PKG-INFO +0 -37
  32. scikit_sparse-0.4.16/README.md +0 -119
  33. scikit_sparse-0.4.16/pyproject.toml +0 -37
  34. scikit_sparse-0.4.16/scikit_sparse.egg-info/PKG-INFO +0 -37
  35. scikit_sparse-0.4.16/scikit_sparse.egg-info/SOURCES.txt +0 -23
  36. scikit_sparse-0.4.16/scikit_sparse.egg-info/requires.txt +0 -2
  37. scikit_sparse-0.4.16/setup.py +0 -122
  38. scikit_sparse-0.4.16/sksparse/__init__.py +0 -1
  39. scikit_sparse-0.4.16/sksparse/cholmod.pyx +0 -1220
  40. scikit_sparse-0.4.16/sksparse/cholmod_backward_compatible.h +0 -22
  41. scikit_sparse-0.4.16/sksparse/test_cholmod.py +0 -290
  42. scikit_sparse-0.4.16/sksparse/test_data/illc1033.mtx.gz +0 -0
  43. scikit_sparse-0.4.16/sksparse/test_data/illc1033_rhs1.mtx.gz +0 -0
  44. scikit_sparse-0.4.16/sksparse/test_data/illc1850.mtx.gz +0 -0
  45. scikit_sparse-0.4.16/sksparse/test_data/illc1850_rhs1.mtx.gz +0 -0
  46. scikit_sparse-0.4.16/sksparse/test_data/well1033.mtx.gz +0 -0
  47. scikit_sparse-0.4.16/sksparse/test_data/well1033_rhs1.mtx.gz +0 -0
  48. scikit_sparse-0.4.16/sksparse/test_data/well1850.mtx.gz +0 -0
  49. scikit_sparse-0.4.16/sksparse/test_data/well1850_rhs1.mtx.gz +0 -0
  50. scikit_sparse-0.4.16/tests/test_cholmod.py +0 -290
  51. {scikit_sparse-0.4.16 → scikit_sparse-0.5.1}/setup.cfg +0 -0
  52. {scikit_sparse-0.4.16 → scikit_sparse-0.5.1/src}/scikit_sparse.egg-info/dependency_links.txt +0 -0
  53. {scikit_sparse-0.4.16 → scikit_sparse-0.5.1/src}/scikit_sparse.egg-info/top_level.txt +0 -0
@@ -1,4 +1,5 @@
1
- Copyright (c) 2009-2018, Joscha Reimer, Alex Grigorievskiy, Antony Lee, Yuri, Leon Barrett, Dag Sverre Seljebotn, Nathaniel Smith, David Cournapeau
1
+ Copyright (C) 2009-2025, The scikit-sparse developers. All rights reserved.
2
+ See pyproject.toml for complete list of contributors.
2
3
 
3
4
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
5
 
@@ -0,0 +1,8 @@
1
+ # MANIFEST.in
2
+ # Files to be included in the source distribution (not in the wheel)
3
+ include LICENSE.txt
4
+ include README.rst
5
+ recursive-include src/sksparse *.pyx *.pxd *.c *.cpp
6
+ prune tests
7
+ prune scripts *
8
+ prune *.egg-info
@@ -0,0 +1,159 @@
1
+ Metadata-Version: 2.4
2
+ Name: scikit-sparse
3
+ Version: 0.5.1
4
+ Summary: Scikit-sparse is a Python wrapper for the SuiteSparse sparse matrix library.
5
+ Author-email: David Cournapeau <cournape@gmail.com>, Nathaniel Smith <njs@pobox.com>, Dag Sverre Seljebotn <dagss@student.matnat.uio.no>, Leon Barrett <lbarrett@climate.com>, Yuri <yuri@tsoft.com>, Antony Lee <anntzer.lee@gmail.com>, Alex Grigorievskiy <alex.grigorievskiy@gmail.com>, Joscha Reimer <jor@informatik.uni-kiel.de>, Justin Ellis <justin.ellis18@gmail.com>, Aaron Johnson <aaron9035@gmail.com>, Bernard Roesler <bernard.roesler@gmail.com>
6
+ Maintainer-email: Bernard Roesler <bernard.roesler@gmail.com>
7
+ License-Expression: BSD-2-Clause
8
+ Project-URL: Homepage, https://github.com/scikit-sparse/scikit-sparse
9
+ Project-URL: Bug Tracker, https://github.com/scikit-sparse/scikit-sparse/issues
10
+ Keywords: sparse,matrix,linear algebra,scipy,numpy
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Topic :: Scientific/Engineering
16
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
17
+ Classifier: Programming Language :: Cython
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/x-rst
25
+ License-File: LICENSE.txt
26
+ Requires-Dist: numpy>2.0
27
+ Requires-Dist: scipy>=1.14
28
+ Requires-Dist: packaging
29
+ Provides-Extra: dev
30
+ Requires-Dist: build; extra == "dev"
31
+ Requires-Dist: pre-commit; extra == "dev"
32
+ Requires-Dist: pytest; extra == "dev"
33
+ Requires-Dist: ruff==0.14.3; extra == "dev"
34
+ Requires-Dist: sphinx; extra == "dev"
35
+ Requires-Dist: furo; extra == "dev"
36
+ Requires-Dist: sphinx-copybutton; extra == "dev"
37
+ Dynamic: license-file
38
+
39
+ .. start-badges
40
+
41
+ .. image:: https://img.shields.io/github/v/release/scikit-sparse/scikit-sparse
42
+ :target: https://github.com/scikit-sparse/scikit-sparse/releases/latest
43
+ :alt: Latest GitHub release
44
+
45
+ .. image:: https://img.shields.io/pypi/v/scikit-sparse
46
+ :target: https://pypi.org/project/scikit-sparse/
47
+ :alt: Latest PyPI release
48
+
49
+ .. image:: https://img.shields.io/conda/vn/conda-forge/scikit-sparse
50
+ :target: https://anaconda.org/conda-forge/scikit-sparse
51
+ :alt: Latest conda-forge release
52
+
53
+ .. image:: https://github.com/scikit-sparse/scikit-sparse/actions/workflows/ci-dev.yml/badge.svg?branch=dev
54
+ :target: https://github.com/scikit-sparse/scikit-sparse/actions/workflows/ci-dev.yml
55
+ :alt: CI Status
56
+
57
+ .. image:: https://readthedocs.org/projects/scikit-sparse/badge/?version=latest
58
+ :target: https://scikit-sparse.readthedocs.io/en/latest/
59
+
60
+ .. end-badges
61
+
62
+ ========================
63
+ Scikit-Sparse (sksparse)
64
+ ========================
65
+
66
+ The ``scikit-sparse`` package is a companion to the `scipy.sparse
67
+ <scipy_sparse_>`_ package for sparse matrix manipulation in Python. It provides
68
+ routines that are not suitable for inclusion in `scipy.sparse <scipy_sparse_>`_
69
+ proper, typically because they depend on external libraries with
70
+ GPL licenses, such as `SuiteSparse <suitesparse_website_>`_.
71
+
72
+ For more details on usage see `the docs <sksparse_docs_>`_.
73
+ To upgrade from scikit-sparse v0.4.16 to v0.5.0, see `Upgrading to v0.5.0
74
+ <sksparse_upgrading_>`_.
75
+
76
+ .. _upstream_repo: https://github.com/scikit-sparse/scikit-sparse
77
+ .. _upstream_docs: https://scikit-sparse.readthedocs.io
78
+ .. _scipy_sparse: https://docs.scipy.org/doc/scipy/reference/sparse.html
79
+ .. _suitesparse_website: https://people.engr.tamu.edu/davis/suitesparse.html
80
+ .. _sksparse_docs: https://scikit-sparse.readthedocs.org
81
+ .. _sksparse_upgrading: https://scikit-sparse.readthedocs.org/en/latest/changes.html#upgrading-from-v0-4-x
82
+
83
+ .. start-installation
84
+
85
+ Requirements
86
+ ------------
87
+
88
+ Installing ``scikit-sparse`` requires:
89
+
90
+ * `Python <http://python.org/>`_ >= 3.10
91
+ * `NumPy <http://numpy.org/>`_ >= 2.0
92
+ * `SciPy <http://scipy.org/>`_ >= 1.14
93
+ * `Cython <http://www.cython.org/>`_ >= 3.0
94
+ * `SuiteSparse <suitesparse_website_>`_ >= 7.4.0
95
+
96
+ Older versions may work but are untested.
97
+
98
+
99
+ Installation
100
+ ------------
101
+
102
+ Installing SuiteSparse
103
+ ++++++++++++++++++++++
104
+
105
+ To install ``scikit-sparse``, you need to have the `SuiteSparse
106
+ <suitesparse_website_>`_ library installed on your system.
107
+
108
+ It is recommended that you install SuiteSparse and the scikit-sparse
109
+ dependencies in a virtual environment, to avoid conflicts with other packages.
110
+ We recommend using Anaconda::
111
+
112
+ $ conda create -n scikit-sparse python>=3.10 suitesparse
113
+ $ conda activate scikit-sparse
114
+
115
+ If you are not using Anaconda, you can install SuiteSparse using your preferred
116
+ package manager.
117
+
118
+ On MacOS, you can use `Homebrew <http://brew.sh>`_::
119
+
120
+ $ brew install suite-sparse
121
+
122
+ On Debian/Ubuntu systems, use the following command::
123
+
124
+ $ sudo apt-get install python-scipy libsuitesparse-dev
125
+
126
+ On Arch Linux, run::
127
+
128
+ $ sudo pacman -S suitesparse
129
+
130
+
131
+ Installing Scikit-Sparse
132
+ ++++++++++++++++++++++++
133
+
134
+ Once you have SuiteSparse installed, you can install ``scikit-sparse`` with::
135
+
136
+ $ conda install -c conda-forge scikit-sparse
137
+
138
+ or if you prefer to use pip, you can install it with::
139
+
140
+ $ pip install scikit-sparse
141
+
142
+ Check if the installation was successful by running the following command::
143
+
144
+ $ python -c "import sksparse; print(sksparse.__version__)"
145
+
146
+
147
+ .. end-installation
148
+
149
+ See `Troubleshooting <docs_trouble_>`_ for more information on determining
150
+ which SuiteSparse library is being used.
151
+
152
+ .. _docs_trouble: https://scikit-sparse.readthedocs.io/en/latest/overview.html#troubleshooting
153
+
154
+
155
+ ----
156
+
157
+ Copyright © 2009–2025, the `scikit-sparse developers <docs_dev_>`_.
158
+
159
+ .. _docs_dev: https://scikit-sparse.readthedocs.io/en/latest/overview.html#developers
@@ -0,0 +1,121 @@
1
+ .. start-badges
2
+
3
+ .. image:: https://img.shields.io/github/v/release/scikit-sparse/scikit-sparse
4
+ :target: https://github.com/scikit-sparse/scikit-sparse/releases/latest
5
+ :alt: Latest GitHub release
6
+
7
+ .. image:: https://img.shields.io/pypi/v/scikit-sparse
8
+ :target: https://pypi.org/project/scikit-sparse/
9
+ :alt: Latest PyPI release
10
+
11
+ .. image:: https://img.shields.io/conda/vn/conda-forge/scikit-sparse
12
+ :target: https://anaconda.org/conda-forge/scikit-sparse
13
+ :alt: Latest conda-forge release
14
+
15
+ .. image:: https://github.com/scikit-sparse/scikit-sparse/actions/workflows/ci-dev.yml/badge.svg?branch=dev
16
+ :target: https://github.com/scikit-sparse/scikit-sparse/actions/workflows/ci-dev.yml
17
+ :alt: CI Status
18
+
19
+ .. image:: https://readthedocs.org/projects/scikit-sparse/badge/?version=latest
20
+ :target: https://scikit-sparse.readthedocs.io/en/latest/
21
+
22
+ .. end-badges
23
+
24
+ ========================
25
+ Scikit-Sparse (sksparse)
26
+ ========================
27
+
28
+ The ``scikit-sparse`` package is a companion to the `scipy.sparse
29
+ <scipy_sparse_>`_ package for sparse matrix manipulation in Python. It provides
30
+ routines that are not suitable for inclusion in `scipy.sparse <scipy_sparse_>`_
31
+ proper, typically because they depend on external libraries with
32
+ GPL licenses, such as `SuiteSparse <suitesparse_website_>`_.
33
+
34
+ For more details on usage see `the docs <sksparse_docs_>`_.
35
+ To upgrade from scikit-sparse v0.4.16 to v0.5.0, see `Upgrading to v0.5.0
36
+ <sksparse_upgrading_>`_.
37
+
38
+ .. _upstream_repo: https://github.com/scikit-sparse/scikit-sparse
39
+ .. _upstream_docs: https://scikit-sparse.readthedocs.io
40
+ .. _scipy_sparse: https://docs.scipy.org/doc/scipy/reference/sparse.html
41
+ .. _suitesparse_website: https://people.engr.tamu.edu/davis/suitesparse.html
42
+ .. _sksparse_docs: https://scikit-sparse.readthedocs.org
43
+ .. _sksparse_upgrading: https://scikit-sparse.readthedocs.org/en/latest/changes.html#upgrading-from-v0-4-x
44
+
45
+ .. start-installation
46
+
47
+ Requirements
48
+ ------------
49
+
50
+ Installing ``scikit-sparse`` requires:
51
+
52
+ * `Python <http://python.org/>`_ >= 3.10
53
+ * `NumPy <http://numpy.org/>`_ >= 2.0
54
+ * `SciPy <http://scipy.org/>`_ >= 1.14
55
+ * `Cython <http://www.cython.org/>`_ >= 3.0
56
+ * `SuiteSparse <suitesparse_website_>`_ >= 7.4.0
57
+
58
+ Older versions may work but are untested.
59
+
60
+
61
+ Installation
62
+ ------------
63
+
64
+ Installing SuiteSparse
65
+ ++++++++++++++++++++++
66
+
67
+ To install ``scikit-sparse``, you need to have the `SuiteSparse
68
+ <suitesparse_website_>`_ library installed on your system.
69
+
70
+ It is recommended that you install SuiteSparse and the scikit-sparse
71
+ dependencies in a virtual environment, to avoid conflicts with other packages.
72
+ We recommend using Anaconda::
73
+
74
+ $ conda create -n scikit-sparse python>=3.10 suitesparse
75
+ $ conda activate scikit-sparse
76
+
77
+ If you are not using Anaconda, you can install SuiteSparse using your preferred
78
+ package manager.
79
+
80
+ On MacOS, you can use `Homebrew <http://brew.sh>`_::
81
+
82
+ $ brew install suite-sparse
83
+
84
+ On Debian/Ubuntu systems, use the following command::
85
+
86
+ $ sudo apt-get install python-scipy libsuitesparse-dev
87
+
88
+ On Arch Linux, run::
89
+
90
+ $ sudo pacman -S suitesparse
91
+
92
+
93
+ Installing Scikit-Sparse
94
+ ++++++++++++++++++++++++
95
+
96
+ Once you have SuiteSparse installed, you can install ``scikit-sparse`` with::
97
+
98
+ $ conda install -c conda-forge scikit-sparse
99
+
100
+ or if you prefer to use pip, you can install it with::
101
+
102
+ $ pip install scikit-sparse
103
+
104
+ Check if the installation was successful by running the following command::
105
+
106
+ $ python -c "import sksparse; print(sksparse.__version__)"
107
+
108
+
109
+ .. end-installation
110
+
111
+ See `Troubleshooting <docs_trouble_>`_ for more information on determining
112
+ which SuiteSparse library is being used.
113
+
114
+ .. _docs_trouble: https://scikit-sparse.readthedocs.io/en/latest/overview.html#troubleshooting
115
+
116
+
117
+ ----
118
+
119
+ Copyright © 2009–2025, the `scikit-sparse developers <docs_dev_>`_.
120
+
121
+ .. _docs_dev: https://scikit-sparse.readthedocs.io/en/latest/overview.html#developers
@@ -0,0 +1,125 @@
1
+ [build-system]
2
+ # setuptools>=61 for PEP 621 support
3
+ requires = ["setuptools>=61.0", "wheel", "Cython>=3.0", "numpy>=2.0"]
4
+ build-backend = "setuptools.build_meta"
5
+
6
+ [project]
7
+ name = "scikit-sparse"
8
+ version = "0.5.1"
9
+ description = "Scikit-sparse is a Python wrapper for the SuiteSparse sparse matrix library."
10
+ readme = "README.rst"
11
+ requires-python = ">=3.10"
12
+ license = "BSD-2-Clause"
13
+ license-files = ["LICENSE.txt"]
14
+
15
+ authors = [
16
+ { name = "David Cournapeau", email = "cournape@gmail.com" },
17
+ { name = "Nathaniel Smith", email = "njs@pobox.com" },
18
+ { name = "Dag Sverre Seljebotn", email = "dagss@student.matnat.uio.no" },
19
+ { name = "Leon Barrett", email = "lbarrett@climate.com" },
20
+ { name = "Yuri", email = "yuri@tsoft.com" },
21
+ { name = "Antony Lee", email = "anntzer.lee@gmail.com" },
22
+ { name = "Alex Grigorievskiy", email = "alex.grigorievskiy@gmail.com" },
23
+ { name = "Joscha Reimer", email = "jor@informatik.uni-kiel.de" },
24
+ { name = "Justin Ellis", email = "justin.ellis18@gmail.com" },
25
+ { name = "Aaron Johnson", email = "aaron9035@gmail.com" },
26
+ { name = "Bernard Roesler", email = "bernard.roesler@gmail.com" },
27
+ ]
28
+ maintainers = [
29
+ { name = "Bernard Roesler", email = "bernard.roesler@gmail.com" },
30
+ ]
31
+
32
+ keywords = ["sparse", "matrix", "linear algebra", "scipy", "numpy"]
33
+ classifiers = [
34
+ "Development Status :: 3 - Alpha",
35
+ "Environment :: Console",
36
+ "Intended Audience :: Developers",
37
+ "Intended Audience :: Science/Research",
38
+ "Topic :: Scientific/Engineering",
39
+ "Topic :: Scientific/Engineering :: Mathematics",
40
+ "Programming Language :: Cython",
41
+ "Programming Language :: Python :: 3",
42
+ "Programming Language :: Python :: 3.10",
43
+ "Programming Language :: Python :: 3.11",
44
+ "Programming Language :: Python :: 3.12",
45
+ "Programming Language :: Python :: 3.13",
46
+ ]
47
+
48
+ dependencies = [
49
+ "numpy>2.0",
50
+ "scipy>=1.14",
51
+ "packaging", # for version parsing
52
+ ]
53
+
54
+ [project.optional-dependencies]
55
+ dev = [
56
+ "build",
57
+ "pre-commit",
58
+ "pytest",
59
+ "ruff==0.14.3",
60
+ "sphinx",
61
+ "furo",
62
+ "sphinx-copybutton",
63
+ ]
64
+
65
+ [project.urls]
66
+ "Homepage" = "https://github.com/scikit-sparse/scikit-sparse"
67
+ "Bug Tracker" = "https://github.com/scikit-sparse/scikit-sparse/issues"
68
+
69
+ # This data is excluded from the wheel package, but not necessarily from the
70
+ # sdist (for sdist, see: MANIFEST.in)
71
+ [tool.setuptools.exclude-package-data]
72
+ sksparse = ["*.c", "*.pyx"]
73
+
74
+ [tool.cython]
75
+ language_level = "3"
76
+
77
+ [tool.ruff]
78
+ line-length = 88
79
+ target-version = "py310"
80
+
81
+ [tool.ruff.lint]
82
+ extend-select = [
83
+ 'B', # flake8-bugbear
84
+ 'C4', # flake8-comprehensions
85
+ 'D', # docstring errors
86
+ 'E', # pycodestyle errors
87
+ 'F', # pyflakes errors
88
+ 'I', # isort errors (import sorting)
89
+ 'ISC', # flake8-implicit-str-concat
90
+ 'NPY', # numpy-specific checks
91
+ 'PD', # pandas-vet
92
+ 'PIE', # flake8-pie
93
+ 'PL', # pylint errors
94
+ 'PTH', # use Path vs os
95
+ 'UP', # pyupgrade
96
+ 'W', # pycodestyle warnings (whitespace)
97
+ ]
98
+
99
+ ignore = [
100
+ 'B028', # No explicit `stacklevel` keyword argument found
101
+ 'B904', # Within an `except` clause distinguish raised exceptions from errors in exception handling
102
+ 'B905', # `zip()` without an explicit `strict=` parameter
103
+ 'D104', # Missing docstring in __init__
104
+ 'D105', # Missing docstring in magic method
105
+ 'D205', # 1 blank line required between summary line and description
106
+ 'E741', # ambiguous variable name (l, O, I)
107
+ 'PIE790', # Unnecessary `pass` statement
108
+ 'PLC2401', # non-ASCII characters
109
+ 'PLR0912', # too many branches (max-branches)
110
+ 'PLR0913', # too many arguments (max-args)
111
+ 'PLR0915', # too many statements (max-statements)
112
+ 'PLR2004', # magic value used in comparison
113
+ ]
114
+
115
+ [tool.ruff.lint.isort]
116
+ known-first-party = ["sksparse"]
117
+
118
+ [tool.ruff.lint.per-file-ignores]
119
+ "__init__.py" = ['D', 'I001', 'F403', 'F405'] # ignore import sorting, wildcard imports, and undefined names
120
+ "test_*.py" = ['D101', 'D102', 'D103', 'E501'] # ignore docstring checks in test files
121
+ "setup.py" = ['D100', 'D101', 'D102', 'D103', 'D104'] # ignore docstrings
122
+ "benchmarks/*" = ['D100', 'D101', 'D102', 'D103', 'D104'] # ignore docstrings
123
+
124
+ [tool.ruff.lint.pydocstyle]
125
+ convention = "numpy"
@@ -0,0 +1,116 @@
1
+ # Copyright (C) 2008-2025 The scikit-sparse developers:
2
+ #
3
+ # 2008 David Cournapeau <cournape@gmail.com>
4
+ # 2009-2015 Nathaniel Smith <njs@pobox.com>
5
+ # 2010 Dag Sverre Seljebotn <dagss@student.matnat.uio.no>
6
+ # 2014 Leon Barrett <lbarrett@climate.com>
7
+ # 2015 Yuri <yuri@tsoft.com>
8
+ # 2016-2017 Antony Lee <anntzer.lee@gmail.com>
9
+ # 2016 Alex Grigorievskiy <alex.grigorievskiy@gmail.com>
10
+ # 2016-2017 Joscha Reimer <jor@informatik.uni-kiel.de>
11
+ # 2021- Justin Ellis <justin.ellis18@gmail.com>
12
+ # 2022- Aaron Johnson <aaron9035@gmail.com>
13
+ # 2025- Bernard Roesler <bernard.roesler@gmail.com>
14
+
15
+ import os
16
+ import subprocess
17
+ import sys
18
+ from pathlib import Path
19
+
20
+ from setuptools import Extension, setup
21
+
22
+
23
+ def get_numpy_include():
24
+ """Get the include directory for NumPy."""
25
+ try:
26
+ import numpy as np # noqa: PLC0415
27
+
28
+ return np.get_include()
29
+ except ImportError:
30
+ return []
31
+
32
+
33
+ INCLUDE_DIRS = []
34
+ LIBRARY_DIRS = []
35
+
36
+ numpy_include = get_numpy_include()
37
+ if numpy_include:
38
+ INCLUDE_DIRS.append(numpy_include)
39
+
40
+ # Check user SuiteSparse directories first
41
+ user_include_dir = os.getenv("SUITESPARSE_INCLUDE_DIR")
42
+ user_library_dir = os.getenv("SUITESPARSE_LIBRARY_DIR")
43
+
44
+ if user_include_dir:
45
+ INCLUDE_DIRS.append(user_include_dir)
46
+
47
+ if user_library_dir:
48
+ LIBRARY_DIRS.append(user_library_dir)
49
+
50
+ # Check if suitesparse is installed via conda
51
+ conda_prefix = os.getenv("CONDA_PREFIX")
52
+
53
+ if conda_prefix:
54
+ if os.name == "nt": # Windows
55
+ conda_include = Path(conda_prefix) / "Library" / "include" / "suitesparse"
56
+ conda_lib = Path(conda_prefix) / "Library" / "lib"
57
+ else:
58
+ conda_include = Path(conda_prefix) / "include" / "suitesparse"
59
+ conda_lib = Path(conda_prefix) / "lib"
60
+
61
+ if conda_include.is_dir():
62
+ INCLUDE_DIRS.append(str(conda_include))
63
+ if conda_lib.is_dir():
64
+ LIBRARY_DIRS.append(str(conda_lib))
65
+
66
+ # Check if suitesparse is installed via homebrew
67
+ try:
68
+ homebrew_prefix = (
69
+ subprocess.run(
70
+ "readlink -f $(brew --prefix suitesparse)",
71
+ shell=True,
72
+ stdout=subprocess.PIPE,
73
+ stderr=subprocess.DEVNULL,
74
+ check=True, # raise an error if command fails
75
+ )
76
+ .stdout.decode()
77
+ .strip()
78
+ )
79
+ brew_include = Path(homebrew_prefix) / "include" / "suitesparse"
80
+ brew_lib = Path(homebrew_prefix) / "lib"
81
+ if brew_include.is_dir():
82
+ INCLUDE_DIRS.append(str(brew_include))
83
+ if brew_lib.is_dir():
84
+ LIBRARY_DIRS.append(str(brew_lib))
85
+ except Exception:
86
+ pass
87
+
88
+ # Check system-wide directories
89
+ INCLUDE_DIRS.append(str(Path(sys.prefix) / "include"))
90
+ INCLUDE_DIRS.append("/usr/include/suitesparse") # Linux default path
91
+
92
+ extension_names = [
93
+ "cholmod",
94
+ "amd",
95
+ "btf",
96
+ "camd",
97
+ "colamd",
98
+ "ccolamd",
99
+ "klu",
100
+ "spqr",
101
+ "umfpack",
102
+ ]
103
+
104
+ extensions = [
105
+ Extension(
106
+ f"sksparse.{name}",
107
+ [f"src/sksparse/{name}.pyx"],
108
+ include_dirs=INCLUDE_DIRS,
109
+ library_dirs=LIBRARY_DIRS,
110
+ libraries=[name] if name != "spqr" else ["cholmod", "spqr"],
111
+ )
112
+ for name in extension_names
113
+ ]
114
+
115
+ # No need to call "cythonize" here. Rely on pyproject.toml.
116
+ setup(ext_modules=extensions)