[build-system]
requires = ["flit_core >=3.4,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "myst-parser"
dynamic = ["version", "description"]
authors = [{name = "Chris Sewell", email = "chrisj_sewell@hotmail.com"}]
readme = "README.md"
license = {file = "LICENSE"}
classifiers = [
    "Development Status :: 4 - Beta",
    "Framework :: Sphinx :: Extension",
    "Intended Audience :: Developers",
    "License :: OSI Approved :: MIT License",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3 :: Only",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Programming Language :: Python :: 3.14",
    "Programming Language :: Python :: Implementation :: CPython",
    "Programming Language :: Python :: Implementation :: PyPy",
    "Topic :: Software Development :: Libraries :: Python Modules",
    "Topic :: Text Processing :: Markup",
]
keywords = [
    "markdown",
    "lexer",
    "parser",
    "development",
    "docutils",
    "sphinx",
]
requires-python = ">=3.11"
dependencies = [
    "docutils>=0.20,<0.23",
    "jinja2", # required for substitutions, but let sphinx choose version
    "markdown-it-py~=4.0",
    "mdit-py-plugins~=0.5",
    "pyyaml",
    "sphinx>=8,<10",
]

[project.urls]
Homepage = "https://github.com/executablebooks/MyST-Parser"
Documentation = "https://myst-parser.readthedocs.io"

[project.optional-dependencies]
code_style = ["pre-commit~=4.0"]
# for use with "linkify" extension
linkify = ["linkify-it-py~=2.0"]
# Note: This is only required for internal use
rtd = [
    "sphinx>=8",
    "ipython",
    "sphinx-book-theme~=1.1",
    "sphinx-design",
    "sphinx-copybutton",
    "sphinxext-rediraffe~=0.3.0",
    # TODO this can uncommented once https://github.com/mgaitan/sphinxcontrib-mermaid/issues/109 is fixed
    # "sphinxcontrib.mermaid~=0.7.1",
    "sphinxext-opengraph~=0.13.0",
    "sphinx-pyscript",
    "sphinx-tippy>=0.4.3",
    "sphinx-autodoc2~=0.5.0",
    "sphinx-togglebutton",
]
testing = [
    "beautifulsoup4",
    "coverage[toml]",
    "defusedxml",  # required by sphinx 7.3 testing utils
    "pytest>=9,<10",
    "pytest-cov",
    "pytest-regressions",
    "pytest-param-files~=0.6.0",
    "sphinx-pytest~=0.3.0",
    "pygments<2.20",  # TODO fix test regression with 2.19"
]
testing-docutils = [
    "pygments",
    "pytest>=9,<10",
    "pytest-param-files~=0.6.0",
]

[dependency-groups]
mypy = [
    "mypy==1.19.1",
    "types-urllib3",
    "sphinx~=8.2",
    "markdown-it-py~=4.0",
    "mdit-py-plugins~=0.5.0",
]
ruff = ["ruff==0.14.11"]

[project.scripts]
myst-anchors = "myst_parser.cli:print_anchors"
myst-inv = "myst_parser.inventory:inventory_cli"
myst-docutils-html = "myst_parser.parsers.docutils_:cli_html"
myst-docutils-html5 = "myst_parser.parsers.docutils_:cli_html5"
myst-docutils-demo = "myst_parser.parsers.docutils_:cli_html5_demo"
myst-docutils-latex = "myst_parser.parsers.docutils_:cli_latex"
myst-docutils-xml = "myst_parser.parsers.docutils_:cli_xml"
myst-docutils-pseudoxml = "myst_parser.parsers.docutils_:cli_pseudoxml"

[tool.flit.module]
name = "myst_parser"

[tool.flit.sdist]
exclude = [
    "docs/",
    "tests/",
]

[tool.ruff.lint]
extend-select = ["B", "C4", "FA", "FURB", "I", "ICN", "ISC", "N", "PERF", "PGH", "PIE", "RUF", "SIM", "UP"]
extend-ignore = ["ISC001", "RUF005", "RUF012"]

[tool.ruff.lint.per-file-ignores]
"myst_parser/parsers/docutils_.py" = ["FA"]
"myst_parser/config/main.py" = ["FA"]

[tool.mypy]
show_error_codes = true
check_untyped_defs = true
strict_equality = true
warn_unused_ignores = true
disallow_any_generics = true

[[tool.mypy.overrides]]
module = ["docutils.*", "yaml.*", "pygments.*"]
ignore_missing_imports = true

[[tool.mypy.overrides]]
# shrink me
module = [
    "myst_parser.config.dc_validators",
    "myst_parser.config.main",
    "myst_parser.inventory",
    "myst_parser.parsers.directives",
    "myst_parser.parsers.docutils_",
    "myst_parser.parsers.parse_html",
]
disallow_any_generics = false

[tool.pytest.ini_options]
filterwarnings = [
    "ignore:.*The default for the setting.*:FutureWarning",
    "ignore:.*:PendingDeprecationWarning",
]

[tool.coverage.run]
omit = ["*/_docs.py"]
