[build-system]
# if you are seeing odd dependency / env errors, try `python3 -m hatch env prune`
requires = ["hatchling>=1.9.0", "hatch-vcs"]
build-backend = "hatchling.build"

# Metadata about the project. This is the source of truth for the version.
[project]
name = "wallaroo"
description = "Wallaroo.ai model management API client"
dynamic = ["version"]
readme = "public_README.md"
urls.Homepage = "https://www.wallaroo.ai/"
license = { text = "UNKNOWN" }
# TODO: We can replace this, and dependencies, with matrix specifiers to support more versions.
requires-python = ">=3.8.6"
authors = [{ name = "Wallaroo.ai", email = "hello@wallaroo.ai" }]
classifiers = [
  "Development Status :: 1 - Planning",
  "Operating System :: OS Independent",
  "Programming Language :: Python :: 3.8",
]
dependencies = [
  "appdirs == 1.4.4",
  "gql == 3.4.0",
  "ipython == 7.24.1",
  "matplotlib == 3.5.0",
  "numpy == 1.22.3",
  "orjson == 3.8.0",
  "pandas == 1.3.4",
  "pyarrow == 12.0.1",
  "PyJWT == 2.4.0",
  "python_dateutil == 2.8.2",
  "PyYAML == 6.0",
  "requests == 2.25.1",
  "scipy == 1.8.0",
  "seaborn == 0.11.2",
  "tenacity == 8.0.1",
  # Required by gql?
  "requests_toolbelt>=0.9.1,<1",
  # Required by the autogenerated ML Ops client
  "httpx >= 0.15.4,<0.24.0",
  "attrs >= 21.3.0",
  # These are documented as part of the autogenerated ML Ops requirements
  # "python = ^3.7",
  # "python-dateutil = ^2.8.0",
]

[tool.hatch.envs.default.overrides]
env.CI.system-packages = { value = true, if = ["true"] }

[tool.hatch.build.hooks.vcs]
version-file = "_version.py"

[tool.hatch]
metadata.allow-direct-references = true

[tool.hatch.version]
source = "vcs"
raw-options = { root = "..", version_scheme = "post-release", local_scheme = "no-local-version" }
tag-pattern = "^v?(?P<version>[0-9\\.]+)"
fallback-version = "2023.1.0.dev0"

[tool.hatch.build]
ignore-vcs = true
exclude = ["wallaroo/graphql"]
artifacts = ["./wallaroo/wallaroo_ml_ops_api_client"]

[tool.hatch.build.force-include]
"../api/graphql" = "wallaroo/graphql"
"../conductor/model-auto-conversion/mac/mac" = "wallaroo/mac"

[tool.hatch.build.sources]
"wallaroo/mac" = "mac"

[tool.hatch.envs.test]
dependencies = [
  "aioresponses == 0.7.2",
  "httpx == 0.23.0",
  "pytest == 6.2.4",
  "pytest-snapshot==0.6.1",
  "responses == 0.21.0",
  "respx == 0.19.2",
  # Required for black formatting
  "black == 23.*",
  # Required for mypy type checking
  "mypy == 0.910",
  "types-PyYAML == 6.0",
  "types-python-dateutil == 2.8.2",
  "types-requests == 2.25.1",
  # Required for cov
  "pytest-cov == 4.0.0",
]

# This environment is for Sphinx documentation.
[tool.hatch.envs.docs]
dependencies = [
  "google-cloud-storage==2.3.0",
  "IPython==7.24.1",
  "kubernetes==17.17.0",
  "requests==2.25.1",
  "myst_parser==0.15.1",
  "nbsphinx==0.8.6",
  "sgqlc==14.0",
  "sphinx==4.5.0",
  "jinja2==3.1.1",
  "sphinx-markdown-builder==0.5.5",
]

# This environment is for pdoc documentation.
[tool.hatch.envs.pdoc]
dependencies = ["pdoc == 12.1.0"]

[tool.hatch.build.targets.wheel]
packages = ["./wallaroo"]

# https://docs.python.org/3/distutils/sourcedist.html#specifying-the-files-to-distribute
[tool.hatch.build.targets.sdist]
exclude = ["dist", ".pytest_cache"]

[tool.hatch.envs.docs.scripts]
sphinx = "python -m sphinx docs/source docs/build"
md = "python -m sphinx -M markdown docs/source docs/build"

[tool.hatch.envs.pdoc.scripts]
serve = "python -m pdoc wallaroo --logo https://images.squarespace-cdn.com/content/v1/5fb9935f9e259c7340e1c158/09742b2e-4129-4aa2-9b91-e50a8efc2e11/Wallaroo+Horizontal+White+Text+Medium.png?format=1500w"
#build = "python -m pdoc -o html wallaroo --logo https://images.squarespace-cdn.com/content/v1/5fb9935f9e259c7340e1c158/09742b2e-4129-4aa2-9b91-e50a8efc2e11/Wallaroo+Horizontal+White+Text+Medium.png?format=1500w"
build = "python -m pdoc -t ./pdoc_templates -o html wallaroo --logo https://images.squarespace-cdn.com/content/v1/5fb9935f9e259c7340e1c158/09742b2e-4129-4aa2-9b91-e50a8efc2e11/Wallaroo+Horizontal+White+Text+Medium.png?format=1500w"

[tool.hatch.envs.test.scripts]
unit = "python -m pytest unit_tests {args}"
snapshot = "python -m pytest --snapshot-update unit_tests {args}"
cov = "pytest --cov=wallaroo unit_tests"
install_types = "python -m mypy --install-types wallaroo"
typecheck = "python -m mypy wallaroo"
format = "python -m black --extend-exclude wallaroo_ml_ops_api_client --check wallaroo"
fix_format = "python -m black --extend-exclude wallaroo_ml_ops_api_client wallaroo"

# TODO: This doesn't seem to do anything, neither here nor in pytest.ini
[tool.pytest.ini_options]
filterwarnings = ['ignore::DeprecationWarning']

# Useful hack for forcing python to recognize a package.
# [tool.hatch.envs.test.env-vars]
# PYTHONPATH = "{env:PYTHONPATH:.}:./wallaroo-ml-ops-api-client:../api"
