# hatch is our build and development tool.

[project]
name = "importnb"
description = "import jupyter notebooks as python modules and scripts."
readme = "README.md"
requires-python = ">=3.7"
license = "BSD-3-Clause"
keywords = []
authors = [{ name = "tonyfast", email = "tony.fast@gmail.com" }]
classifiers = [
  "Development Status :: 4 - Beta",
  "Natural Language :: English",
  "Framework :: IPython",
  "Framework :: Jupyter",
  "Programming Language :: Python",
  "Programming Language :: Python :: 3.7",
  "Programming Language :: Python :: 3.8",
  "Programming Language :: Python :: 3.9",
  "Programming Language :: Python :: 3.10",
  "Programming Language :: Python :: 3.11",
  "Programming Language :: Python :: Implementation :: CPython",
  "Programming Language :: Python :: Implementation :: PyPy",
  "License :: OSI Approved :: BSD License",
]
dependencies = [] # no dependencies!
dynamic = ["version"] # uses hatch-vcs

[project.optional-dependencies]
interactive = ["IPython"]
docs = ["mkdocs-material", "mkdocs-jupyter", "ruamel.yaml"]
tasks = ["doit", "toml"]

[project.entry-points.pytest11]
importnb = "importnb.utils.pytest_importnb"

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

[project.urls]
Documentation = "https://github.com/deathbeds/importnb#readme"
Issues = "https://github.com/deathbeds/importnb/issues"
Source = "https://github.com/deathbeds/importnb"

[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

# hatch/hatchling configuration
[tool.hatch.build.hooks.custom]

# we build a json grammar with each release because we fiend for line numbers
dependencies = ["lark"]

# versioning
[tool.hatch.version]
source = "vcs"

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

# test matrix
[tool.hatch.envs.test]
dependencies = ["pytest", "pytest-cov", "doit", "toml"]

[[tool.hatch.envs.test.matrix]]
version = ["interactive", "stdlib"]

[tool.hatch.envs.test.interactive.overrides]
matrix.version.features = ["interactive"]

[tool.hatch.envs.test.overrides]
matrix.version.dev-mode = [{ value = false, env = ["CI=true"] }]

[tool.hatch.envs.test.scripts]
cov = "pytest"

[tool.pytest.ini_options]
addopts = "-pno:warnings --cov importnb --cov-report html --cov-report term"

[tool.coverage.report]
omit = ["src/importnb/_json_parser.py", "docs/*"]

[tool.coverage.html]
directory = "docs/coverage"


# test a release on test-pypi
[tool.hatch.envs.released]
skip-install = true
dependencies = ["importnb", "IPython", "pytest", "pytest-cov"]

[tool.hatch.envs.released.scripts]
test = "pytest"

[tool.hatch.envs.released.env-vars]
PIP_INDEX_URL = "https://test.pypi.org/simple/"
PIP_EXTRA_INDEX_URL = "https://pypi.org/simple/"
PIP_PRE = "1"

[[tool.hatch.envs.released.matrix]]
version = ["interactive", "stdlib"]

# documentation
[tool.hatch.envs.docs]
features = ["docs"]

[tool.hatch.envs.docs.scripts]
build = "mkdocs build"
serve = "mkdocs serve"

# formatting cause linting sucks
[tool.isort]
profile = "black"

[tool.black]
line_length = 100

[tool.hatch.envs.format]
skip-install = true
dependencies = ["black", "isort"]

[tool.hatch.envs.format.scripts]
code = """
isort .
black .
"""
