[build-system]
requires = [
  "setuptools>=48.0.0",
  "cython",
  "numpy>=1.17.0",
  "versioneer[toml]==0.28",
]
build-backend = "setuptools.build_meta"

[project]
name = "pytensor"
dynamic = [
  'version'
]
requires-python = ">=3.8"
authors = [
    {name = "pymc-devs", email = "pymc.devs@gmail.com"}
]
description = "Optimizing compiler for evaluating mathematical expressions on CPUs and GPUs."
readme = "README.rst"
license = {file = "LICENSE.txt"}
classifiers = [
    "Development Status :: 6 - Mature",
    "Intended Audience :: Education",
    "Intended Audience :: Science/Research",
    "Intended Audience :: Developers",
    "License :: OSI Approved :: BSD License",
    "Programming Language :: Python",
    "Topic :: Software Development :: Code Generators",
    "Topic :: Software Development :: Compilers",
    "Topic :: Scientific/Engineering :: Mathematics",
    "Operating System :: Microsoft :: Windows",
    "Operating System :: POSIX",
    "Operating System :: Unix",
    "Operating System :: MacOS",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.8",
    "Programming Language :: Python :: 3.9",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
]

keywords = [
    "pytensor",
    "math",
    "numerical",
    "symbolic",
    "blas",
    "numpy",
    "autodiff",
    "differentiation",
]
dependencies = [
    "setuptools>=48.0.0",
    "scipy>=0.14",
    "numpy>=1.17.0",
    "filelock",
    "etuples",
    "logical-unification",
    "miniKanren",
    "cons",
    "typing_extensions",
]

[project.urls]
homepage = "https://github.com/pymc-devs/pytensor"
repository = "https://github.com/pymc-devs/pytensor"
documentation = "https://pytensor.readthedocs.io/en/latest/"


[project.scripts]
pytensor-cache = "pytensor.bin.pytensor_cache:main"

[project.optional-dependencies]
complete = [
    "pytensor[jax]",
    "pytensor[numba]",
]
development = [
    "pytensor[complete]",
    "pytensor[tests]",
    "pytensor[rtd]"
]
tests = [
    "pytest",
    "pre-commit",
    "pytest-cov>=2.6.1",
    "coverage>=5.1",
    "pytest-benchmark",
]
rtd = [
    "sphinx>=5.1.0,<6",
    "pygments",
    "pydot",
    "pydot2",
    "pydot-ng",
]
jax = [
    "jax",
    "jaxlib",
]
numba = [
    "numba>=0.55",
    "numba-scipy>=0.3.0"
]

[tool.setuptools.packages.find]
include = ["pytensor*", "bin"]

[tool.setuptools.package-data]
pytensor = [
    "py.typed"
]
"pytensor.d3viz" = [
    "html/*",
    "css/*",
    "js/*",
]

[tool.coverage.run]
omit = [
    "pytensor/_version.py",
    "tests/*",
    "pytensor/assert_op.py",
    "pytensor/graph/opt.py",
    "pytensor/graph/opt_utils.py",
    "pytensor/graph/optdb.py",
    "pytensor/graph/kanren.py",
    "pytensor/graph/unify.py",
    "pytensor/link/jax/jax_linker.py",
    "pytensor/link/jax/jax_dispatch.py",
    "pytensor/graph/toolbox.py",
    "pytensor/scalar/basic_scipy.py",
]
branch = true
relative_files = true

[tool.coverage.report]
omit = [
    "pytensor/_version.py",
    "tests/",
]
exclude_lines = [
    "pragma: no cover",
    "if TYPE_CHECKING:",
]
show_missing = true

[tool.versioneer]
VCS = "git"
style = "pep440"
versionfile_source = "pytensor/_version.py"
versionfile_build = "pytensor/_version.py"
tag_prefix = "rel-"

[tool.pytest]
addopts = "--durations=50"
testpaths = "tests/"

[tool.pylint]
max-line-length = 88

[tool.pylint.messages_control]
disable = ["C0330", "C0326"]

[tool.isort]
profile = "black"
lines_after_imports = 2
lines_between_sections = 1
honor_noqa = true
skip_gitignore = true
skip = "pytensor/version.py"
skip_glob = "**/*.pyx"

[tool.mypy]
ignore_missing_imports = true
no_implicit_optional = true
check_untyped_defs = false
strict_equality = true
warn_redundant_casts = true
warn_unused_configs = true
warn_unused_ignores = true
warn_return_any = true
warn_no_return = false
warn_unreachable = true
show_error_codes = true
allow_redefinition = false
files = ["pytensor", "tests"]
plugins = ["numpy.typing.mypy_plugin"]

[tool.cibuildwheel]
build = "*"
# Uncomment to skip builds that compile but fail when trying to test (maybe due to incompatibility with runner)
# archs = ["auto64"]
# Disable any-platform (pp*), and 32-bit builds.
# Additional options to consider: "*musllinux*"
skip = ["pp*", "*-win32", "*-manylinux_i686"]
build-frontend = "build"
test-command = 'python -c "import pytensor; print(pytensor.__version__); from pytensor.scan import scan_perform; print(scan_perform.get_version())"'
test-skip = ["cp37*", "*musllinux*", "*win32*", "*i686*"]

# Testing seems to be running into issues locating libs where expected
# test-requires = ["pytest", "numba", "jax", "jaxlib"]
# test-command = "pytest {package}/tests"
