durandtibo/hya

View on GitHub
pyproject.toml

Summary

Maintainability
Test Coverage
[tool.poetry]
name = "hya"
version = "0.2.5a0"
description = "A library of custom OmegaConf resolvers"
readme = "README.md"
authors = ["Thibaut Durand <durand.tibo+gh@gmail.com>"]
homepage = "https://github.com/durandtibo/hya"
repository = "https://github.com/durandtibo/hya"
keywords = ["omegaconf", "resolver"]
license = "BSD-3-Clause"

classifiers = [
    "Development Status :: 4 - Beta",
    "Intended Audience :: Developers",
    "Intended Audience :: Information Technology",
    "Intended Audience :: Science/Research",
    "License :: OSI Approved :: BSD License",
    "Operating System :: POSIX :: Linux",
    "Programming Language :: Python :: 3.9",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Topic :: Scientific/Engineering",
    "Topic :: Software Development :: Libraries",
]

packages = [
    { include = "hya", from = "src" },
]

[tool.poetry.dependencies]
# Core dependencies
python = ">=3.9,<3.14"
omegaconf = ">=2.2,<3.0"

# Optional dependencies
braceexpand = { version = ">=0.1.7,<0.2.0", optional = true }
numpy = { version = ">=1.21,<3.0", optional = true }
torch = [
    { version = ">=1.9.0,<2.3", markers = "sys_platform == 'darwin' and platform_machine != 'arm64'", python = ">=3.9,<3.13" },
    { version = ">=1.9.0,<3.0", python = ">=3.9,<3.13" }
]

[tool.poetry.extras]
all = ["braceexpand", "numpy", "torch"]

[tool.poetry.group.docs.dependencies]
mike = "^2.1"
mkdocs-material = "^9.5"
mkdocstrings = { extras = ["python"], version = "^0.26" }

[tool.poetry.group.dev.dependencies]
black = "^24.10"
coverage = { extras = ["toml"], version = "^7.6" }
docformatter = { extras = ["tomli"], version = "^1.7" }
pre-commit = ">=4.0,<5.0"
pygments = "^2.18"
pytest = "^8.3"
pytest-cov = ">=5,<7"
pytest-timeout = "^2.3"
ruff = ">=0.6,<1.0"
xdoctest = "^1.2"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.coverage.paths]
source = ["src", "*/site-packages"]

[tool.coverage.run]
branch = true
source = ["hya"]

[tool.coverage.report]
show_missing = true
exclude_lines = [
    "pragma: no cover",
    "if TYPE_CHECKING:"
]

[tool.pytest.ini_options]
testpaths = "tests/"
log_format = "%(asctime)s - %(levelname)s - %(name)s - %(message)s"
log_level = "DEBUG"
addopts = "--color yes --durations 10 -rf"
# Configuration of the short test summary info
# https://docs.pytest.org/en/stable/usage.html#detailed-summary-report

[tool.black]
line-length = 100
target-version = ["py39", "py310", "py311", "py312"]
include = '\.pyi?$'

[tool.pylint.FORMAT]
max-line-length = 100

[tool.isort]
profile = "black"

[tool.docformatter]
recursive = true
wrap-summaries = 72
wrap-descriptions = 72
syntax = "google"

[tool.ruff]
# List of rules: https://docs.astral.sh/ruff/rules/
lint.select = [
    "A", # builtins
    "ANN", # annotations
    "ARG", # flake8-unused-arguments
    "B", # bugbear
    "BLE", # flake8-blind-except
    "C4", # flake8-comprehensions
    "D", # pydocstyle
    "DTZ", # flake8-datetimez
    "E", # pycodestyle (Error)
    "EM", # flake8-errmsg
    "EXE", # flake8-executable
    "F", # pyflakes
    "FA", # flake8-future-annotations
    "FURB", # refurb
    "ICN", # flake8-import-conventions
    "INP", # flake8-no-pep420
    "ISC", # flake8-implicit-str-concat
    "LOG", # logging
    "N", # naming
    "NPY", # NumPy-specific rules
    "PD", # pandas-vet
    "PERF", # Perflint
    "PGH", # pygrep-hooks
    "PIE", # flake8-pie
    "PL", # Pylint
    "PT", # flake8-pytest-style
    "PTH", # pathlib
    "PYI", # flake8-pyi
    "Q", # flake8-quotes
    "RET", # flake8-return
    "RSE", # flake8-raise
    "RUF", # Ruff-specific rules
    "S", # flake8-bandit
    "SIM", # flake8-simplify
    "T20", # flake8-print
    "TCH", # flake8-type-checking
    "TD", # flake8-todos
    "TID", # flake8-tidy-imports
    "TRY", # tryceratops
    "UP", # pyupgrade
    "W", # pycodestyle (Warning)
]
lint.ignore = [
    "A003", # Class attribute `{name}` is shadowing a python builtin
    "ANN101", # Missing type annotation for `self` in method
    "ANN102", # Missing type annotation for `cls` in classmethod
    "ANN401", # Dynamically typed expressions (typing.Any) are disallowed.
    "B905", # `zip()` without an explicit strict= parameter set. The `strict=` argument was added in Python 3.10
    "E501", # Line lengths are recommended to be no greater than 79 characters.
    "W505", # Doc line too long
    "PLR0913", # Too many arguments in function definition (8 > 5)
    "PLR2004", # Magic value used in comparison, consider replacing 0.0 with a constant variable

    # The following rules are ignored because they conflict with another library like docformatter.
    "D102", # Missing docstring in public method
    "D105", # Missing docstring in magic method
    "D107", # Missing docstring in `__init__`
    "D205", # 1 blank line required between summary line and description
    "D209", # Multi-line docstring closing quotes should be on a separate line
]

# Allow autofix for all enabled rules (when `--fix`) is provided.
lint.fixable = [
    "A", # builtins
    "ANN", # annotations
    "ARG", # flake8-unused-arguments
    "B", # bugbear
    "BLE", # flake8-blind-except
    "C4", # flake8-comprehensions
    "D", # pydocstyle
    "DTZ", # flake8-datetimez
    "E", # pycodestyle (Error)
    "EM", # flake8-errmsg
    "EXE", # flake8-executable
    "F", # pyflakes
    "FA", # flake8-future-annotations
    "FURB", # refurb
    "ICN", # flake8-import-conventions
    "INP", # flake8-no-pep420
    "ISC", # flake8-implicit-str-concat
    "LOG", # logging
    "N", # naming
    "NPY", # NumPy-specific rules
    "PD", # pandas-vet
    "PERF", # Perflint
    "PGH", # pygrep-hooks
    "PIE", # flake8-pie
    "PL", # Pylint
    "PT", # flake8-pytest-style
    "PTH", # pathlib
    "PYI", # flake8-pyi
    "Q", # flake8-quotes
    "RET", # flake8-return
    "RSE", # flake8-raise
    "RUF", # Ruff-specific rules
    "S", # flake8-bandit
    "SIM", # flake8-simplify
    "T20", # flake8-print
    "TCH", # flake8-type-checking
    "TD", # flake8-todos
    "TID", # flake8-tidy-imports
    "TRY", # tryceratops
    "UP", # pyupgrade
    "W", # pycodestyle (Warning)
]
lint.unfixable = []

lint.exclude = [
    ".bzr",
    ".direnv",
    ".eggs",
    ".git",
    ".hg",
    ".mypy_cache",
    ".nox",
    ".pants.d",
    ".pytype",
    ".ruff_cache",
    ".tox",
    ".venv",
    "__pypackages__",
    "_build",
    "buck-out",
    "build",
    "dist",
    "node_modules",
    "venv",
]

# Enable on top of the Google convention.
lint.extend-select = ["D400", "D401", "D404"]

line-length = 100
target-version = "py39"
src = ["src"]

[tool.ruff.lint.per-file-ignores]
# Ignore all directories named `tests`.
"tests/**" = [
    "D", # pydocstyle
    "PL", # Pylint
    "S101", # flake8-bandit
]

[tool.ruff.lint.mccabe]
max-complexity = 10

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.lint.pycodestyle]
max-doc-length = 72

[tool.ruff.lint.isort]
force-sort-within-sections = true
combine-as-imports = true
known-first-party = ["src"]

[tool.ruff.lint.flake8-import-conventions]
[tool.ruff.lint.flake8-import-conventions.aliases]
numpy = "np"