[build-system]
requires = ["setuptools>=64", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"

[project]
name = "snakemake"
dynamic = ["version"]
description = "Workflow management system to create reproducible and scalable data analyses"
readme = { content-type = "text/markdown", text = """
  Snakemake is a workflow management system that aims to reduce the
  complexity of creating workflows by providing a fast and comfortable
  execution environment, together with a clean and modern specification
  language in python style. Snakemake workflows are essentially Python
  scripts extended by declarative code to define rules. Rules describe
  how to create output files from input files.
""" }
requires-python = ">= 3.11"
license = "MIT"
authors = [{ name = "Johannes Köster", email = "johannes.koester@uni-due.de" }]
classifiers = [
  "Development Status :: 5 - Production/Stable",
  "Environment :: Console",
  "Intended Audience :: Science/Research",
  "Natural Language :: English",
  "Programming Language :: Python :: 3 :: Only",
  "Programming Language :: Python :: 3.11",
  "Programming Language :: Python :: 3.12",
  "Programming Language :: Python :: 3.13",
  "Topic :: Scientific/Engineering",
]

dependencies = [
  "appdirs",
  "immutables",
  "configargparse",
  "connection_pool>=0.0.3",
  "docutils",
  "gitpython",
  "humanfriendly",
  "jinja2>=3.0,<4.0",
  "jsonschema",
  "nbformat",
  "packaging >=24.0",
  "psutil",
  "pulp>=2.3.1,<3.4",
  "pyyaml",
  "referencing",
  "requests>=2.8.1,<3.0",
  "reretry",
  "smart-open>=4.0,<8.0",
  "snakemake-interface-executor-plugins>=9.3.2,<10.0",
  "snakemake-interface-common>=1.20.1,<2.0",
  "snakemake-interface-storage-plugins>=4.1.0,<5.0",
  "snakemake-interface-report-plugins>=1.2.0,<2.0.0",
  "snakemake-interface-logger-plugins>=1.1.0,<3.0.0",
  "snakemake-interface-scheduler-plugins>=2.0.0,<3.0.0",
  "tabulate",
  "throttler",
  "wrapt",
  "yte>=1.5.5,<2.0",
  "dpath>=2.1.6,<3.0.0",
  "conda-inject>=1.3.1,<2.0",
]

[project.urls]
Homepage = "https://snakemake.github.io"
Documentation = "https://snakemake.readthedocs.io"
Source = "https://github.com/snakemake/snakemake"

[project.optional-dependencies]
pep = ["eido", "peppy"]
reports = ["pygments"]
all = ["eido", "peppy", "pygments"]

[project.scripts]
snakemake = "snakemake.cli:main"

[tool.setuptools_scm]
version_file = "src/snakemake/_version.py"
# Ignore Git hash
local_scheme = "no-local-version"

[tool.codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = '.git,*.pdf,*.svg,versioneer.py,*.css,test_*'
check-hidden = true
ignore-regex = '^\s*"image/\S+": ".*|\b[Mm]anuel[. ][Hh]oltgrewe\b'
ignore-words-list = 'testin'

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

[tool.pixi.pypi-dependencies]
snakemake = { path = ".", editable = true, extras = ["all"] }

[tool.pixi.environments]
dev = { features = ["test", "docs", "style"] }

py311 = { features = ["py311", "test"] }
py312 = { features = ["py312", "test"] }
py313 = { features = ["py313", "test"] }


docs = { features = ["docs"] }
quality = { features = ["style"] }
publish = { features = ["publish"] }

# Python Envs
[tool.pixi.feature.py311.dependencies]
python = ">=3.11.0,<3.12"

[tool.pixi.feature.py312.dependencies]
python = ">=3.12.0,<3.13"


[tool.pixi.feature.py313.dependencies]
python = ">=3.13.0,<3.14"

# Test
[tool.pytest.ini_options]
addopts = "--verbose --show-capture=stderr" #  --exitfirst
markers = [
  #  (use '-m "not needs_envmodules"' to skip these tests)
  "needs_envmodules: marks tests that require environment modules",
  "needs_s3: marks tests that require S3 credentials",
]
[tool.pixi.feature.test]
channels = ["conda-forge", "bioconda", "nodefaults"]

[tool.pixi.feature.test.tasks.test-simple]
cmd = [
  "pytest",
  "-m",
  "not needs_envmodules",
  "-k",
  "not test_conda_global",
  "tests/tests.py",
]
description = "Run tests only for tests/tests.py"

[tool.pixi.feature.test.target.osx-arm64.tasks.test-simple]
cmd = [
  "pytest",
  "-m",
  "not (needs_s3 or needs_envmodules)", # needs_s3 is not supported on osx-arm64
  "-k",
  "not (test_conda_global or queue)", # queue is buggy on osx-arm64
  "tests/tests.py",
]

[tool.pixi.feature.test.tasks.test-all]
description = "Run all tests in the tests directory"
cmd = [
  "pytest",
  "tests",
  # TODO for the two excluded tests, see https://github.com/snakemake/snakemake/pull/3369#issuecomment-2718056637
  "-m",
  "not needs_envmodules",
  "-k",
  "not test_conda_global",
  "tests/tests.py",                    # tested in test-simple
  "tests/tests_using_conda.py",
  "tests/test_expand.py",
  "tests/test_io.py",
  "tests/test_schema.py",
  "tests/test_linting.py",
  "tests/test_executor_test_suite.py",
  "tests/test_api.py",
  "tests/test_internals.py",
  # the tests below were never tested in the old CI and currently fail
  # "tests/test_args.py",
  # "tests/test_output_index.py",
  # "tests/test_path_modifier.py",
  # "tests/test_persistence.py"
  # "tests/test_prefix_lookup.py",
  # "tests/test_script.py",
  # "tests/test_sourcecache.py",
]

[tool.pixi.feature.test.dependencies]
pytest = ">=8.3.5,<9"
pytest-mock = ">=3.14.0,<4"
pytest-cov = ">=6.0.0,<7"
pytest-split = ">=0.10.0,<0.11"
graphviz = ">=12.2.1,<13"
oauth2client = ">=4.1.3,<5"
numpy = ">=2.2.3,<3"
glpk = ">=5.0,<6"
pulp = ">=2.8.0,<3"
boto3 = ">=1.37.9,<2"
responses = ">=0.25.6,<0.26"
pytools = ">=2024.1.6,<2026"
pandoc = ">=3.6.3,<4"
crc32c = ">=2.7.1,<3"
filelock = ">=3.17.0,<4"
humanfriendly = ">=10.0,<11"
pandas = ">=2.2.3,<3"
pygments = ">=2.19.1,<3"
pysftp = ">=0.2.9,<0.3"
yte = ">=1.5.7,<2"
ftputil = ">=5.1.0,<6"
httpretty = ">=1.1.4,<2"
polars = ">=1.24.0,<2"
requests-mock = ">=1.12.1,<2"
docutils = ">=0.20.1,<0.22"
conda = "*"
pip = "*"

[tool.pixi.feature.test.pypi-dependencies]
snakemake-executor-plugin-cluster-generic = "*"
snakemake-storage-plugin-http = "*"
snakemake-storage-plugin-s3 = "*"
snakemake-storage-plugin-fs = "*"

[tool.pixi.feature.test.target.linux-64.pypi-dependencies]
snakemake-storage-plugin-xrootd = "*"

[tool.pixi.feature.test.target.linux-64.dependencies]
# environment-modules = "*"
xorg-libxrender = "*"
xorg-libxext = "*"
xorg-libxau = "*"
xorg-libxdmcp = "*"
xorg-libsm = "*"
stress-ng = "*"
nodejs = "*"
squashfuse = "*"
cwltool = "*"
cwl-utils = "*"
# # moved to pixi from main.yaml installing via apt
apptainer = "*"
git = "*"
wget = "*"
dash = "*"
openmpi = "*"
xrootd = ">=5.7.3,<6"

# Docs
[tool.pixi.feature.docs.dependencies]
sphinx = ">=7.2.6,<8"
sphinx-argparse = ">=0.4.0,<0.6"
sphinx_rtd_theme = ">=3.0.1,<4"
sphinxawesome-theme = ">=5.2.0,<6"
recommonmark = ">=0.7.1,<0.8"
commonmark = ">=0.9.1,<0.10"
myst-parser = ">=3.0.1,<5"
sphinxcontrib-napoleon = ">=0.7,<0.8"
sphinx-autobuild = ">=2024.10.3,<2025"
sphinx-tabs = ">=3.4.1,<4"
sphinx-autodoc-typehints = ">=2.0.1,<3"


[tool.pixi.feature.docs.tasks.build-docs]
description = "Build the documentation in the docs/ directory"
cwd = "docs"
cmd = 'make html SPHINXOPTS="-W --keep-going -n"'

[tool.pixi.feature.docs.tasks.docs]
description = "Serve the documentation on http://localhost:8000 with live reload"
cmd = "sphinx-autobuild docs/ docs/_build/html --host 0.0.0.0 --port 8000 --watch docs"

[tool.pixi.feature.docs.tasks.build-apidocs]
description = "Build the API documentation in the apidocs/ directory"
cwd = "apidocs"
cmd = 'make html SPHINXOPTS="--keep-going -n"'

# Style
[tool.pixi.feature.style.dependencies]
black = "*"

[tool.pixi.feature.style.tasks]
format = { cmd = "black docs/ apidocs/ src/ tests/*.py", description = "Format the code" }

# Build
[tool.pixi.feature.publish.dependencies]
twine = ">=6.1.0,<7"
python-build = ">=1.2.2,<2"

[tool.pixi.feature.publish.tasks]
build = { cmd = "python -m build", description = "Build the package into the dist/ directory" }
build-check = { cmd = "python -m twine check --strict dist/*", depends-on = [
  "build",
], description = "Check that the package can be uploaded" }
