[project]
name = "moin"
dynamic = ["version"]
authors = [{name="Juergen Hermann et al."}]
maintainers = [
    {name="RogerHaase", email="haaserd@gmail.com"},
    {name="Thomas Waldmann", email="tw@waldmann-edv.de"},
]
description = "MoinMoin is an easy to use, full-featured and extensible wiki software package"
readme = {file="README.md", content-type="text/markdown"}
license = "GPL-2.0-or-later"
license-files = ["LICENSE.txt"]
requires-python = ">=3.10"
keywords = ["wiki", "web"]
classifiers = [
    "Development Status :: 4 - Beta",
    "Environment :: Web Environment",
    "Intended Audience :: Education",
    "Intended Audience :: End Users/Desktop",
    "Intended Audience :: Information Technology",
    "Intended Audience :: Other Audience",
    "Intended Audience :: Science/Research",
    "Natural Language :: English",
    "Operating System :: OS Independent",
    "Programming Language :: Python",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Programming Language :: Python :: 3.14",
    "Topic :: Internet :: WWW/HTTP :: WSGI",
    "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
    "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
    "Topic :: Office/Business :: Groupware",
    "Topic :: Text Processing :: Markup",
]
dependencies = [
    "Babel >= 2.16.0",  # internationalization support
    "blinker >= 1.6.2",  # event signalling (e.g. for change notification trigger)
    "docutils >= 0.18.1",  # reST markup processing
    "Markdown >= 3.4.1",  # Markdown markup processing
    "mdx_wikilink_plus >= 1.4.1",  # Markdown Wikilinks extension
    "Flask >= 3.0.0",  # lightweight WSGI web application framework
    "Flask-Babel >= 3.0.0",  # i18n support
    "Flask-Caching >= 1.2.0",  # caching support
    "Flask-Theme >= 0.3.6",  # theme support
    "emeraldtree >= 0.10.0",  # xml processing
    "feedgen >= 0.9.0",  # Atom feed
    "flatland >= 0.8",  # form handling
    "Jinja2 >= 3.1.0",  # template engine
    "markupsafe >= 3.0.2",  # safe html and xml
    "pygments >= 1.4",  # src code / text file highlighting
    "Werkzeug >= 3.0.0",  # WSGI toolkit
    "whoosh >= 2.7.0",  # needed for indexed search
    "pdfminer.six",  # pdf -> text/plain conversion
    "passlib >= 1.6.0",  # strong password hashing (1.6 needed for consteq)
    "sqlalchemy >= 2.0",  # used by sqla store
    "typing_extensions >= 4.12.2",
    "XStatic >= 0.0.2, < 2.0.0",  # support for static file pypi packages
    "XStatic-Bootstrap >=4.5.3.1, <= 4.5.3.1",
    "XStatic-Font-Awesome >= 6.2.1.0, <= 6.2.1.1",
    "XStatic-CKEditor >= 3.6.1.2, <= 3.6.4.0",
    "XStatic-autosize <= 1.17.2.1",
    "XStatic-jQuery >= 1.8.2, <= 3.5.1.1",
    "XStatic-jQuery-File-Upload >= 10.31.0, <= 10.31.0.1",
    "XStatic-svg-edit-moin >= 2012.11.15.1, <= 2012.11.27.1",
    "XStatic-JQuery.TableSorter >= 2.14.5.1, <= 2.14.5.2",
    "XStatic-Pygments >= 1.6.0.1, <= 2.9.0.1",
]

[project.optional-dependencies]
pillow = ["pillow"]  # successor to PIL; used by image get for scaling/rotating/etc.;
                     # requires special libs/header to be installed before it can be compiled successfully
ldap = ["python-ldap"]  # used by ldap auth; requires special libs/header
                        # to be installed before it can be compiled successfully

[project.urls]
"Homepage" = "https://moinmo.in/"
"Bug Tracker" = "https://github.com/moinwiki/moin/issues"
"Documentation" = "https://moin-20.readthedocs.io/"
"Repository" = "https://github.com/moinwiki/moin"
"Changelog" = "https://github.com/moinwiki/moin/blob/master/docs/changes/CHANGES"

[project.scripts]
moin = "moin.cli:cli"

[tool.setuptools]
# See also the MANIFEST.in file.
# We want to install all the files in the package directories...
include-package-data = true

[tool.setuptools.packages.find]
where = ["src"]

[build-system]
requires = ["setuptools >= 77.0.3", "setuptools_scm[toml] >= 6.2"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "src/moin/_version.py"

[tool.black]
line-length = 120
skip-magic-trailing-comma = true

[tool.pytest.ini_options]
norecursedirs = [".git", "_build", "tmp*", "env*", "dlc", "wiki", "support"]

[tool.ruff]
line-length = 120
target-version = "py310"

# Exclude a variety of commonly ignored directories.
exclude = [
    "contrib",
    ".cache",
    ".eggs",
    ".git",
    ".git-rewrite",
    ".idea",
    ".ruff_cache",
    ".tox",
    "build",
    "dist",
]

[tool.ruff.lint]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = ["E", "F"]

ignore = ["F405", "E401", "E402", "E501"]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
unfixable = []

# Code style violation exceptions:
# please note that the values are adjusted so that they do not cause failures
# with existing code. if you want to change them, you should first fix all
# ruff failures that appear with your change.
[tool.ruff.lint.per-file-ignores]
"scripts/coding_std.py" = ["E713"]
"docs/conf.py" = ["F401"]  # sphinx config, automatically generated
"src/moin/config/default.py" = ["F401", "F403"]
"src/moin/datastructures/__init__.py" = ["F401"]

[tool.bandit]
exclude_dirs = ["quickinstall.py", "*/_tests/*", "*/_ui_tests/*", "scripts", "contrib/loadtesting"]
skips = ["B101", "B105", "B106", "B307", "B311", "B403", "B608"]

# tox configuration - if you change anything here, run this to verify:
# tox --recreate

# run like this:
# tox
# tox run -e py310
# tox -- -v -k test_wikiutil
# tox -- -v

[tool.tox]
requires = ["tox>=4.21"]
envlist = ["3.10", "3.11", "3.12", "3.13", "3.14", "ruff"]

[tool.tox.env_run_base]
description = "Run tests under {base_python}"
deps = [
    "-r requirements.d/development.txt"
]
commands = [
    ["pytest", "-rs", "--pyargs", { replace="posargs", default=["moin"], extend=true }]
]

[tool.tox.env_run_base.set_env]
# some tests expect a specific order in dicts...
PYTHONHASHSEED = "0"
# needed so that lxml can build from source (e.g. on pypy):
CFLAGS = "-I/usr/include/libxml2"

[tool.tox.env.ruff]
description = "Run the ruff linter on the moin sources"
deps = ["ruff"]
package = "skip"
change_dir = ""
commands = [
    ["ruff", "check", "."]
]

[tool.babel.extractors]
# python works by default
jinja2 = "jinja2.ext:babel_extract"

[[tool.babel.mappings]]
method = "python"
pattern = "**/*.py"
encoding = "utf-8"

[[tool.babel.mappings]]
method = "jinja2"
pattern = ["**/templates/**/*.html", "**/templates/dictionary.js"]
encoding = "utf-8"
