[build-system] requires = [ "setuptools>=77", "setuptools-scm>=8", "packaging", # same as scikit-learn "Cython>=3.1.4", # building against numpy 2.x is compatible with numpy 1.x "numpy>=2.0.0", # scikit-learn requirements "scikit-learn~=1.9.0; python_version<='3.14'", "scikit-learn; python_version>'3.14'", ] build-backend = "setuptools.build_meta" [project] name = "scikit-survival" description = "Survival analysis built on top of scikit-learn" readme = "README.rst" authors = [ {name = "Sebastian Pölsterl", email = "sebp@k-d-w.org"} ] license = "GPL-3.0-or-later" license-files = ["COPYING"] requires-python = ">=3.11" classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Science/Research", "Intended Audience :: Developers", "Operating System :: MacOS", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: C++", "Programming Language :: Cython", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", "Topic :: Software Development", "Topic :: Scientific/Engineering" ] dependencies = [ "clarabel", "ecos", "joblib", "narwhals >=2.0.1", "numexpr", "numpy >=2.0.0", "osqp >=1.0.2", "pandas >=2.2.0", "scipy >=1.13.0", "scikit-learn >=1.9.0,<1.10", ] dynamic = ["version"] [project.urls] "Homepage" = "https://github.com/sebp/scikit-survival" "Documentation" = "https://scikit-survival.readthedocs.io" "Source Code" = "https://github.com/sebp/scikit-survival" "Bug Tracker" = "https://github.com/sebp/scikit-survival/issues" "Release Notes" = "https://scikit-survival.readthedocs.io/en/latest/release_notes.html" [dependency-groups] formatting = [ "black[jupyter]", "ruff", ] # This file purposely does not contain libraries that depend on C modules. # See https://docs.readthedocs.io/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules docs = [ "ipython !=8.7.0", "matplotlib ~=3.10.0", "nbsphinx >=0.9.2", "docutils", "setuptools-scm", "sphinx ~=8.2.3", "pydata-sphinx-theme ~=0.18.0", "sphinxcontrib-spelling", "sphinx-design ~=0.7.0", "sphinx-copybutton ~=0.5.2", ] test = [ "coverage", "polars >=1.0.0", "pytest >=9", ] test-nb = [ "ipykernel", "ipython!=8.7.0", "matplotlib~=3.10.0", "nbformat", "nbval>=0.10.0", "seaborn~=0.13.2", ] dev = [ {include-group = "formatting"}, {include-group = "test"}, "build", "Cython >=3.0.10", "packaging", "pre-commit", "setuptools-scm >=8", "tomli", "tox", ] [tool.setuptools] include-package-data = false [tool.setuptools.packages.find] include = ["sksurv*"] namespaces = false [tool.setuptools.package-data] "sksurv.datasets" = ["data/*.arff"] [tool.black] line-length = 120 extend-exclude = "sksurv/linear_model/src/eigen" target-version = ["py311"] [tool.pytest] minversion = "9.0" addopts = ["--strict-markers"] doctest_optionflags = ["NORMALIZE_WHITESPACE", "ELLIPSIS"] norecursedirs = [".*", "*.egg", "build", "dist", "venv", "{arch}", "eigen"] testpaths = ["tests"] filterwarnings = [ # Treat all warnings as errors other than the ignored ones "error", "ignore:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning", # deprecated since Pandas 2.2.0 "ignore:\\nPyarrow will become a required dependency of pandas in the next major release of pandas.*:DeprecationWarning", # deprecated since Python 3.12 "ignore:datetime\\.datetime\\.utcfromtimestamp\\(\\) is deprecated and scheduled for removal in a future version.*:DeprecationWarning", "ignore:ast\\.Num is deprecated and will be removed in Python 3\\.14.*:DeprecationWarning", "ignore:Attribute n is deprecated and will be removed in Python 3\\.14.*:DeprecationWarning", # deprecated since scipy 1.16.0, scheduled for removal in 1.18 "ignore:scipy\\.optimize. The `disp` and `iprint` options of the L-BFGS-B solver are deprecated.*:DeprecationWarning", # deprecated since pandas 3.0.0 "ignore:The copy keyword is deprecated and will be removed in a future version.*:DeprecationWarning", # pandas 4 deprecates the implicit ``str``-via-``object`` inclusion in # ``DataFrame.select_dtypes``. Listing ``"str"`` explicitly would resolve # the deprecation but is rejected by pandas <= 3.x with ``TypeError``, # so the cross-version-safe call still emits the warning on pandas 4. "ignore:For backward compatibility, 'str' dtypes are included by select_dtypes.*", # deprecated since polars 1.40.1 "ignore: the default behavior of `how='horizontal'` for `concat` is deprecated and will require equal heights in the next breaking release.*:DeprecationWarning", # deprecated since polars 1.43, to be removed in 2.0 "ignore:`cat.get_categories\\(\\)` is deprecated.*:DeprecationWarning", ] [tool.coverage.run] branch = true plugins = ["Cython.Coverage"] relative_files = true source = ["sksurv"] [tool.coverage.report] exclude_lines = [ # Have to re-enable the standard pragma "pragma: no cover", # Don't complain about missing debug-only code: "def __repr__", "if self\\.debug", # Don't complain if tests don't hit defensive assertion code: "raise AssertionError", "raise NotImplementedError", # Don't complain if non-runnable code isn't run: "if 0:", "if __name__ == .__main__.:", ] ignore_errors = true omit = [ "tests/*", "*/setup.py", "*/_version.py", ] [tool.ruff] extend-exclude = [ "doc/conf.py", "sksurv/linear_model/src/eigen", ] # Group violations by containing file. output-format = "grouped" line-length = 120 target-version = "py311" [tool.ruff.lint] ignore = ["A005", "C408"] select = [ # pycodestyle "E", "W", # mccabe "C90", # pyflakes "F", # isort "I", # flake8-builtins "A", # flake8-comprehensions "C4", # flake8-pytest-style "PT", ] [tool.ruff.lint.flake8-pytest-style] fixture-parentheses = true mark-parentheses = true parametrize-names-type = "csv" [tool.ruff.lint.mccabe] max-complexity = 10 [tool.ruff.lint.isort] force-sort-within-sections = true known-first-party = ["sksurv"] [tool.numpydoc_validation] checks = [ "all", # report on all checks, except the below "ES01", # no extended summary "EX01", # no examples section "SA01", # no See Also section ] exclude = [ # Exclude all private functions and classes (those beginning with _): '\._', '.+_$', ] exclude_files = [ '(^|.*/)_[^/]*\.py$', '(^|.*/)tests/.*', '(^|.*/)sksurv/linear_model/src/eigen/.*', ] [tool.setuptools_scm] [tool.tox] requires = ["tox>=4.40"] env_list = [ "lint", "docs", ] [tool.tox.env.lint] description = "Run linters" skip_install = true deps = [ "numpydoc", "sphinx-lint", ] commands = [ ["sphinx-lint", "doc", "-i", "doc{/}api{/}generated"], ["numpydoc", "lint", { replace = "glob", pattern = "sksurv/**/*.py", extend = true }], ] [tool.tox.env.docs] description = "Build documentation" dependency_groups = [ "docs", ] change_dir = "doc" commands = [ ["sphinx-build", "-j", "1", "-d", "_build{/}doctrees", "-E", "-W", "-b", "html", ".", "_build{/}html"] ] [tool.tox.env.spelling] description = "Spellcheck documentation" dependency_groups = [ "docs", ] change_dir = "doc" commands = [ ["sphinx-build", "-j", "auto", "-d", "_build{/}doctrees", "-E", "-W", "-b", "spelling", ".", "_build{/}spelling"] ]