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

[project]
name = "nmn"
dynamic = ["version"]
authors = [{ name = "Taha Bouhsine", email = "taha@azetta.ai" }]
description = "Neural-Matter Network (NMN) - Advanced neural network layers with attention mechanisms"
readme = "README.md"
requires-python = ">=3.8"
classifiers = [
    "Programming Language :: Python :: 3",
    "License :: OSI Approved :: GNU Affero General Public License v3",
    "Operating System :: OS Independent",
]

[project.urls]
"Homepage" = "https://github.com/azettaai/nmn"
"Bug Tracker" = "https://github.com/azettaai/nmn/issues"

[project.optional-dependencies]
dev = [
    "pytest>=7.0.0",
    "pytest-cov>=4.0.0",
    "black>=23.0.0",
    "flake8>=6.0.0",
    "isort>=5.12.0",
    "mypy>=1.0.0",
    "hatch-vcs>=0.3.0",
]
nnx = ["jax>=0.9.1", "jaxlib>=0.9.1", "flax>=0.12.5"]
torch = ["torch>=1.11.0", "torchvision>=0.12.0"]
keras = ["tensorflow>=2.10.0"]
tf = ["tensorflow>=2.10.0"]
linen = ["jax>=0.9.1", "jaxlib>=0.9.1", "flax>=0.12.5"]
all = ["nmn[nnx,torch,keras,tf,linen]"]
test = [
    "nmn[dev,all]",
    "tensorflow-datasets>=4.8.0",
    "optax>=0.1.4",
    "matplotlib>=3.5.0",
    "seaborn>=0.11.0",
    "scikit-learn>=1.1.0",
]

[tool.black]
line-length = 88
target-version = ['py38']
include = '\.pyi?$'
exclude = '''
/(
    \.eggs
  | \.git
  | \.hg
  | \.mypy_cache
  | \.tox
  | \.venv
  | _build
  | buck-out
  | build
  | dist
)/
'''

[tool.isort]
profile = "black"
multi_line_output = 3
line_length = 88
known_first_party = ["nmn"]
skip_glob = ["build/*", "dist/*"]

[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = ["--verbose", "--tb=short", "--strict-markers"]
markers = [
    "slow: marks tests as slow (deselect with '-m \"not slow\"')",
    "integration: marks tests as integration tests",
    "torch: marks tests requiring PyTorch",
    "jax: marks tests requiring JAX/Flax",
    "tf: marks tests requiring TensorFlow",
]

[tool.mypy]
python_version = "3.8"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = false
disallow_incomplete_defs = false
check_untyped_defs = true
disallow_untyped_decorators = false
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_unreachable = true
strict_equality = true

[[tool.mypy.overrides]]
module = [
    "jax.*",
    "flax.*",
    "torch.*",
    "tensorflow.*",
    "keras.*",
    "numpy.*",
    "matplotlib.*",
    "seaborn.*",
    "sklearn.*",
    "optax.*",
]
ignore_missing_imports = true

[tool.coverage.run]
source = ["src/nmn"]
omit = ["*/tests/*", "*/examples/*", "*/__pycache__/*"]

[tool.coverage.report]
exclude_lines = [
    "pragma: no cover",
    "def __repr__",
    "if self.debug:",
    "if settings.DEBUG",
    "raise AssertionError",
    "raise NotImplementedError",
    "if 0:",
    "if __name__ == .__main__.:",
    "except ImportError:",
]


[tool.hatch.version]
source = "vcs"
fallback-version = "0.2.11"

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

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