--- a +++ b/pyproject.toml @@ -0,0 +1,231 @@ +[build-system] +build-backend = "hatchling.build" +requires = ["hatchling"] + +[project] +name = "ehrapy" +version = "0.12.0" +description = "Electronic Health Record Analysis with Python." +readme = "README.md" +requires-python = ">=3.10,<3.14" +license = {file = "LICENSE"} +authors = [ + {name = "Lukas Heumos"}, + {name = "Philipp Ehmele"}, + {name = "Eljas Roellin"}, + {name = "Lilly May"}, + {name = "Tim Treis"}, + {name = "Altana Namsaraeva"}, + {name = "Vladimir Shitov"}, + {name = "Luke Zappia"}, + {name = "Xinyue Zhang"}, +] +maintainers = [ + {name = "Lukas Heumos", email = "lukas.heumos@posteo.net"}, +] +urls.Documentation = "https://ehrapy.readthedocs.io" +urls.Source = "https://github.com/theislab/ehrapy" +urls.Home-page = "https://github.com/theislab/ehrapy" + +classifiers = [ + "License :: OSI Approved :: Apache Software License", + "Development Status :: 4 - Beta", + "Environment :: Console", + "Framework :: Jupyter", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "Natural Language :: English", + "Operating System :: MacOS :: MacOS X", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Topic :: Scientific/Engineering :: Bio-Informatics", + "Topic :: Scientific/Engineering :: Visualization", +] + +dependencies = [ + "session-info2", + "lamin_utils", + "rich", + "scanpy", + "requests", + "miceforest", + "scikit-misc", # required for seuratv3 highly variable features + "lifelines>=0.30.0", + "missingno", + "thefuzz[speedup]", + "dowhy", + "fhiry", + "pyampute", + "tableone", + "imbalanced-learn", + "fknni>=1.2.0", + "python-dateutil", + "filelock", + "numpy>=2.0.0", + "numba>=0.60.0", + "igraph" +] + +[project.optional-dependencies] +medcat = [ + "medcat", +] +dask = [ + "anndata[dask]", + "dask-ml>=2025.1.0", +] +dev = [ + "pre-commit", +] +docs = [ + "docutils", + "sphinx", + "furo", + "myst-nb", + "myst-parser", + "sphinxcontrib-bibtex", + "sphinx-gallery", + "sphinx-autodoc-typehints", + "sphinx-copybutton", + "sphinx-remove-toctrees", + "sphinx-design", + "sphinx-last-updated-by-git", + "sphinx-automodapi", + "sphinxext-opengraph", + "pygments", + "nbsphinx", + "nbsphinx-link", + "ipykernel", + "ipython", + "ehrapy[dask]", +] +test = [ + "ehrapy[dask]", + "pytest", + "pytest-cov", + "pytest-mock" +] + + +[tool.hatch.version] +source = "vcs" + +[tool.coverage.run] +source_pkgs = ["ehrapy"] +omit = [ + "**/test_*.py", + "ehrapy/data/_datasets.py", # Difficult to test +] + +[tool.pytest.ini_options] +testpaths = "tests" +xfail_strict = true +addopts = [ + "--import-mode=importlib", # allow using test files with same name +] +markers = [ + "conda: marks a subset of tests to be ran on the Bioconda CI.", + "extra: marks tests that require extra dependencies." +] +filterwarnings = [ + "ignore::DeprecationWarning", + "ignore::anndata.OldFormatWarning:", + "ignore:X converted to numpy array with dtype object:UserWarning", + "ignore:`flavor='seurat_v3'` expects raw count data, but non-integers were found:UserWarning", + "ignore:All-NaN slice encountered:RuntimeWarning", + "ignore:Observation names are not unique. To make them unique, call `.obs_names_make_unique`.:UserWarning", + "ignore:Trying to modify attribute `.var` of view, initializing view as actual.:anndata.ImplicitModificationWarning", + "ignore:Transforming to str index.:anndata.ImplicitModificationWarning:" +] +minversion = 6.0 +norecursedirs = [ '.*', 'build', 'dist', '*.egg', 'data', '__pycache__'] + +[tool.ruff] +line-length = 120 + +[tool.ruff.format] +docstring-code-format = true + +[tool.ruff.lint] +select = [ + "F", # Errors detected by Pyflakes + "E", # Error detected by Pycodestyle + "W", # Warning detected by Pycodestyle + "I", # isort + "D", # pydocstyle + "B", # flake8-bugbear + "TID", # flake8-tidy-imports + "C4", # flake8-comprehensions + "BLE", # flake8-blind-except + "UP", # pyupgrade + "RUF100", # Report unused noqa directives + "TCH", # Typing imports + "NPY", # Numpy specific rules + "PTH" # Use pathlib +] +ignore = [ + # line too long -> we accept long comment lines; black gets rid of long code lines + "E501", + # Do not assign a lambda expression, use a def -> lambda expression assignments are convenient + "E731", + # allow I, O, l as variable names -> I is the identity matrix + "E741", + # Missing docstring in public package + "D104", + # Missing docstring in public module + "D100", + # Missing docstring in __init__ + "D107", + # Errors from function calls in argument defaults. These are fine when the result is immutable. + "B008", + # __magic__ methods are are often self-explanatory, allow missing docstrings + "D105", + # first line should end with a period [Bug: doesn't work with single-line docstrings] + "D400", + # First line should be in imperative mood; try rephrasing + "D401", + ## Disable one in each pair of mutually incompatible rules + # We don’t want a blank line before a class docstring + "D203", + # We want docstrings to start immediately after the opening triple quote + "D213", + # Imports unused + "F401", + # camcelcase imported as lowercase + "N813", + # module import not at top level of file + "E402", +] + +[tool.ruff.lint.pydocstyle] +convention = "google" + +[tool.ruff.lint.per-file-ignores] +"docs/*" = ["I"] +"tests/*" = ["D"] +"*/__init__.py" = ["F401"] + +[tool.mypy] +strict = false +pretty = true +show_column_numbers = true +show_error_codes = true +show_error_context = true +ignore_missing_imports = true +no_strict_optional = true + +[tool.cruft] +skip = [ + "tests", + "src/**/__init__.py", + "src/**/basic.py", + "docs/api.md", + "docs/changelog.md", + "docs/references.bib", + "docs/references.md", + "docs/notebooks/example.ipynb" +]