[build-system]
requires = [
    "maturin>=1,<1.12.0",
    "cffi",
]
build-backend = 'maturin'

[project]
name = "sourmash"
description = "tools for comparing biological sequences with k-mer sketches"
readme = "README.md"
version = "4.9.5-dev"
license = "BSD-3-Clause"

authors = [
  { name="Luiz Irber" },
  { name="N. Tessa Pierce-Ward" },
  { name="Mohamed Abuelanin" },
  { name="Harriet Alexander" },
  { name="Abhishek Anant" },
  { name="Keya Barve" },
  { name="Colton Baumler" },
  { name="Olga Botvinnik" },
  { name="Phillip Brooks" },
  { name="Luca Cappelletti" },
  { name="Peter Cock" },
  { name="Daniel Dsouza" },
  { name="Jade Gardner" },
  { name="Laurent Gautier" },
  { name="Tim Head" },
  { name="Mahmudur Rahman Hera" },
  { name="Hannah Eve Houts" },
  { name="Lisa K. Johnson" },
  { name="Fabian Klötzl" },
  { name="David Koslicki" },
  { name="Katrin Leinweber" },
  { name="Marisa Lim" },
  { name="Ricky Lim" },
  { name="Chase Mateusiak" },
  { name="Bradley Nelson" },
  { name="Ivan Ogasawara" },
  { name="Aiden Pike" },
  { name="Taylor Reiter" },
  { name="Camille Scott" },
  { name="Andreas Sjödin" },
  { name="Connor T. Skennerton" },
  { name="Jason Stajich" },
  { name="Daniel Standage" },
  { name="S. Joshua Swamidass" },
  { name="Connor Tiffany" },
  { name="Pranathi Vemuri" },
  { name="Erik Young" },
  { name="Nick H" },
  { name="C. Titus Brown" },
]

maintainers = [
  { name="Luiz C. Irber, Jr", email="luiz@sourmash.bio" },
  { name="C. Titus Brown", email="titus@idyll.org" },
  { name="N. Tessa Pierce-Ward", email="ntpierce@ucdavis.edu" },
]

classifiers = [
  "Development Status :: 5 - Production/Stable",
  "Environment :: Console",
  "Environment :: MacOS X",
  "Intended Audience :: Science/Research",
  "Natural Language :: English",
  "Operating System :: POSIX :: Linux",
  "Operating System :: MacOS :: MacOS X",
  "Programming Language :: Rust",
  "Programming Language :: Python :: 3.13",
  "Programming Language :: Python :: 3.12",
  "Programming Language :: Python :: 3.11",
  "Topic :: Scientific/Engineering :: Bio-Informatics",
]

dependencies = [
  "screed>=1.1.3,<2",
  "cffi>=1.14.0",
  "numpy",
  "matplotlib",
  "scipy",
  "deprecation>=2.0.6",
  "cachetools>=4,<8",
  "bitstring>=3.1.9,<5",
]

requires-python = ">=3.11"

[tool.sourmash.metadata]
authors = [
  { name="Luiz Irber", orcid="0000-0003-4371-9659" },
  { name="N. Tessa Pierce-Ward", orcid="0000-0002-2942-5331" },
  { name="Mohamed Abuelanin", orcid="0000-0002-3419-4785" },
  { name="Harriet Alexander", orcid="0000-0003-1308-8008" },
  { name="Abhishek Anant", orcid="0000-0002-5751-2010" },
  { name="Keya Barve", orcid="0000-0003-3241-2117" },
  { name="Colton Baumler", orcid="0000-0002-5926-7792" },
  { name="Olga Botvinnik", orcid="0000-0003-4412-7970" },
  { name="Phillip Brooks", orcid="0000-0003-3987-244X" },
  { name="Luca Cappelletti", orcid="0000-0002-1269-2038" },
  { name="Peter Cock", orcid="0000-0001-9513-9993" },
  { name="Daniel Dsouza", orcid="0000-0001-7843-8596" },
  { name="Jade Gardner", orcid="0009-0005-0787-5752" },
  { name="Laurent Gautier", orcid="0000-0003-0638-3391" },
  { name="Tim Head", orcid="0000-0003-0931-3698" },
  { name="Mahmudur Rahman Hera", orcid="0000-0002-5992-9012" },
  { name="Hannah Eve Houts", orcid="0000-0002-7954-4793" },
  { name="Lisa K. Johnson", orcid="0000-0002-3600-7218" },
  { name="Fabian Klötzl", orcid="0000-0002-6930-0592" },
  { name="David Koslicki", orcid="0000-0002-0640-954X" },
  { name="Katrin Leinweber", orcid="0000-0001-5135-5758" },
  { name="Marisa Lim", orcid="0000-0003-2097-8818" },
  { name="Ricky Lim", orcid="0000-0003-1313-7076" },
  { name="Chase Mateusiak", orcid="0000-0002-2890-4242" },
  { name="Bradley Nelson", orcid="0009-0001-1553-932X" },
  { name="Ivan Ogasawara", orcid="0000-0001-5049-4289" },
  { name="Aiden Pike", orcid="0009-0002-1398-0207"},
  { name="Taylor Reiter", orcid="0000-0002-7388-421X" },
  { name="Camille Scott", orcid="0000-0001-8822-8779" },
  { name="Andreas Sjödin", orcid="0000-0001-5350-4219" },
  { name="Connor T. Skennerton", orcid="0000-0003-1320-4873" },
  { name="Jason Stajich", orcid="0000-0002-7591-0020" },
  { name="Daniel Standage", orcid="0000-0003-0342-8531" },
  { name="S. Joshua Swamidass", orcid="0000-0003-2191-0778" },
  { name="Connor Tiffany", orcid="0000-0001-8188-7720" },
  { name="Pranathi Vemuri", orcid="0000-0002-5748-9594"},
  { name="Erik Young", orcid="0000-0002-9195-9801" },
  { name="Nick H", orcid="0000-0002-1685-302X" },
  { name="C. Titus Brown", orcid="0000-0001-6001-2677" },
]


[metadata]
license = { text = "BSD 3-Clause License" }

[project.urls]
"Homepage" = "https://sourmash.bio/"
"Documentation" = "https://sourmash.readthedocs.io"
"CI" = "https://github.com/sourmash-bio/sourmash/actions"
"Source" = "https://github.com/sourmash-bio/sourmash"
"Tracker" = "https://github.com/sourmash-bio/sourmash/issues"

[project.scripts]
"sourmash" = "sourmash.__main__:main"

[project.optional-dependencies]
test = [
  "pytest>=6.2.4,<9.1.0",
  "pytest-cov>=4,<8.0",
  "pytest-xdist>=3.1",
  "pyyaml>=6,<7",
  "diff-cover>=7.3",
  "covdefaults>=2.2.2",
  "recommonmark",
  "hypothesis",
  "build",
]
demo = [
  "jupyter",
  "jupyter_client",
  "ipython",
]
doc = [
  "sphinx>=6,<10",
  "myst-parser",
  "Jinja2",
  "alabaster",
  "sphinxcontrib-napoleon",
  "nbsphinx",
  "sphinx-design==0.7.0",
  "ipython",
  "sphinx-copybutton",
]
storage = [
  "ipfshttpclient>=0.4.13",
  "redis",
]
# hmm, I think this is a hack, but it works...
# https://github.com/pypa/pip/issues/10393#issuecomment-941885429
all = ["sourmash[test,demo,doc,storage]"]

[tool.maturin]
python-source = "src"
manifest-path = "src/core/Cargo.toml"
bindings = "cffi"
include = [
  { path = "include/sourmash.h", format = ["sdist","wheel"] },
  { path = "requirements.txt", format = ["sdist"] },
  { path = "Cargo.*", format = ["sdist"] },
  { path = "tests/**/*", format = ["sdist"] },
  { path = "CITATION.cff", format = ["sdist", "wheel"] },
  { path = "LICENSE", format = ["sdist"] },
]
exclude = [
  { path = "**/__pycache__/*", format = ["sdist", "wheel"] },
]
features = ["maturin", "branchwater"]
locked = true
module-name = "sourmash._lowlevel"

# macOS deployment target SDK version
[tool.maturin.target.x86_64-apple-darwin]
macos-deployment-target = "10.14"
[tool.maturin.target.aarch64-apple-darwin]
macos-deployment-target = "11.0"

[tool.ruff]
extend-exclude = ["*.ipynb"]

[tool.ruff.lint]
extend-select = [
  "UP",  # pyupgrade
]
ignore = ["F401", "E712", "E402", "F821", "E722", "E741", "F811", "F403", "F822"]

[tool.isort]
known_third_party = ["deprecation", "hypothesis", "mmh3", "numpy", "pytest", "screed", "sourmash_tst_utils"]
multi_line_output = 3 
include_trailing_comma = true
force_grid_wrap = 0
line_length = 88
known_first_party = ["sourmash"]

[tool.cibuildwheel]
build = "cp311-*"
skip = "*-win32 *-manylinux_i686 *-musllinux_* *-ppc64le *-s390x"
before-all = [
  "curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=stable",
  "cargo update --dry-run",
]
macos.before-build = [
  "rustup target add aarch64-apple-darwin",
  "rustup target add x86_64-apple-darwin",
]
build-verbosity = 3

[tool.cibuildwheel.environment]
CARGO_REGISTRIES_CRATES_IO_PROTOCOL="sparse"
PATH="$HOME/.cargo/bin:$PATH"

[tool.cibuildwheel.linux]
before-all = [
  "curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=stable",
  "cargo update --dry-run",
  "if [ -f /etc/system-release ]; then dnf -y install llvm-compat-libs; fi",
]

[tool.cibuildwheel.pyodide.environment]
# avoid needing a nightly compiler
RUSTC_BOOTSTRAP=1

[tool.cibuildwheel.pyodide]
before-build = [
  "rustup target add wasm32-unknown-emscripten"
]

[tool.cibuildwheel.linux.environment]
CARGO_REGISTRIES_CRATES_IO_PROTOCOL="sparse"
PATH="$HOME/.cargo/bin:$PATH"
LIBCLANG_PATH="/usr/lib64/llvm17/lib"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/rh/gcc-toolset-14/root/usr/lib64"
C_INCLUDE_PATH="/opt/rh/gcc-toolset-14/root/usr/lib/gcc/x86_64-redhat-linux/14/include/:/opt/rh/gcc-toolset-14/root/usr/lib/gcc/aarch64-redhat-linux/14/include/"

[tool.pytest.ini_options]
addopts = "--doctest-glob='doc/*.md' -n4"
norecursedirs = [
  "utils",
  "build",
  "buildenv",
  ".tox",
  ".asv",
  ".eggs",
]
testpaths = [
  "tests",
  "doc",
]

[tool.coverage]
html.show_contexts = true
html.skip_covered = false
paths.source = [
  "src",
  ".tox*/*/lib/python*/site-packages",
  ".tox*/pypy*/site-packages",
  ".tox*\\*\\Lib\\site-packages",
  "*/src",
  "*\\src",
  "*/tests",
  "*\tests",
]
report.fail_under = 88
run.parallel = true
run.plugins = ["covdefaults"]

[tool.pixi.workspace]
channels = ["conda-forge"]
platforms = ["linux-64", "linux-aarch64", "osx-64", "osx-arm64", "win-64"]

[tool.pixi.feature.build.dependencies]
clangdev = ">=16.0.6,<16.1"
cxx-compiler = ">=1.7.0,<1.8"
libclang = ">=16.0.6,<16.1"

[tool.pixi.feature.msrv.dependencies]
rust = "~=1.74.0"

[tool.pixi.feature.msrv.tasks]
check-msrv = "cargo build --all-features"

[tool.pixi.feature.dev.dependencies]
cargo-llvm-cov = "~=0.6.15"
cargo-nextest = "~=0.9.78"
git = "2.41.0.*"
rust = "~=1.91.0"

pandoc = "3.1.3.*"
python = "3.11.*"
tox = ">=4.11.0,<5"

# prefer conda deps over PyPI
screed = ">=1.1.2,<2"
cffi = ">=1.14.0"
numpy = "*"
matplotlib = "*"
scipy = "*"
deprecation = ">=2.0.6"
cachetools = ">=4,<6"
bitstring = ">=3.1.9,<5"
make = ">=4.4.1,<5"

[tool.pixi.feature.dev.tasks.install-tools]
cmd = "cargo install cargo-binstall@1.17.3 && cargo binstall -y cargo-semver-checks && cargo binstall -y cargo-feature-combinations && cargo binstall -y wasm-pack && cargo binstall -y cbindgen --version 0.26.0"
outputs = [
  "$CARGO_HOME/bin/cbindgen",
  "$CARGO_HOME/bin/cargo-semver-checks",
  "$CARGO_HOME/bin/cargo-binstall",
  "$CARGO_HOME/bin/cargo-feature-combinations",
  "$CARGO_HOME/bin/wasm-pack",
]

[tool.pixi.feature.dev.tasks.semver-check]
cmd = "cargo semver-checks check-release --default-features --features branchwater"
depends-on = "install-tools"

[tool.pixi.feature.dev.tasks.cbindgen-generate]
cmd = "cbindgen -c cbindgen.toml . -o ../../include/sourmash.h"
cwd = "src/core"
env = { RUSTC_BOOTSTRAP = "1" }
depends-on = "install-tools"
inputs = [
  "src/core/src/lib.rs",
  "src/core/src/errors.rs",
  "src/core/src/ffi/*.rs",
  "src/core/cbindgen.toml",
]
outputs = ["include/sourmash.h"]

[tool.pixi.feature.dev.tasks.check-features]
cmd = "cargo fc nextest run"
depends-on = "install-tools"

[tool.pixi.feature.dev.tasks.coverage-rust]
cmd = "cargo llvm-cov nextest --all-features --lcov --output-path lcov.info"

[tool.pixi.feature.wasm.dependencies]
rust-std-wasm32-unknown-unknown = "*"
nodejs = "~=20.0"

[tool.pixi.feature.wasm.tasks.build-wasm]
cmd = "wasm-pack build src/core -d ../../pkg -- --features 'niffler/wasm'"
depends-on = ["install-tools"]
outputs = [
  "pkg/package.json",
  "pkg/README",
  "pkg/sourmash_bg.js",
  "pkg/sourmash_bg.wasm",
  "pkg/sourmash_bg.wasm.d.ts",
  "pkg/sourmash.d.ts",
  "pkg/sourmash.js",
]

[tool.pixi.feature.wasm.activation.env]
CARGO_HOME = "$CONDA_PREFIX/.cargo_cache"
PATH = "$PATH:$CARGO_HOME/bin"

[tool.pixi.feature.wasm.tasks]
test-wasm = { cmd = "wasm-pack test --node src/core -- --features 'niffler/wasm'" , depends-on = ["install-tools"] }
pack-npm = { cmd = "npm pack" , depends-on = ["build-wasm"], cwd = "pkg", outputs = ["pkg/sourmash-*.tgz"] }
publish-npm = { cmd = "npm publish" , depends-on = ["pack-npm"], cwd = "pkg" }

[tool.pixi.environments]
default = { features = ["dev", "build", "test", "demo", "doc", "storage", "all"], solve-group = "default" }
msrv = { features = ["build", "msrv"], solve-group = "msrv", no-default-feature = true }
wasm = { features = ["dev", "build", "wasm"], solve-group = "default", no-default-feature = true }

[tool.pixi.system-requirements]
macos = "11.0"

[tool.pixi.activation.env]
CARGO_HOME = "$CONDA_PREFIX/.cargo_cache"
PATH = "$PATH:$CARGO_HOME/bin"
