Add dependency groups to pyproject and drop pytest-cov dependency

This commit is contained in:
Veronica Berglyd Olsen
2025-10-18 17:41:25 +02:00
parent 8642086d34
commit c1968ba4e3
2 changed files with 64 additions and 43 deletions
+45 -33
View File
@@ -4,11 +4,9 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "novelWriter" name = "novelWriter"
authors = [ authors = [{ name = "Veronica Berglyd Olsen", email = "code@vkbo.net" }]
{name = "Veronica Berglyd Olsen", email = "code@vkbo.net"},
]
description = "A plain text editor for planning and writing novels" description = "A plain text editor for planning and writing novels"
readme = {file = "setup/description_pypi.md", content-type = "text/markdown"} readme = { file = "setup/description_pypi.md", content-type = "text/markdown" }
license = "GPL-3.0-or-later AND Apache-2.0 AND CC-BY-4.0" license = "GPL-3.0-or-later AND Apache-2.0 AND CC-BY-4.0"
license-files = ["LICENSE.md", "setup/LICENSE-Apache-2.0.txt"] license-files = ["LICENSE.md", "setup/LICENSE-Apache-2.0.txt"]
classifiers = [ classifiers = [
@@ -26,12 +24,28 @@ classifiers = [
"Topic :: Text Editors", "Topic :: Text Editors",
] ]
requires-python = ">=3.10" requires-python = ">=3.10"
dependencies = [ dependencies = ["pyqt6>=6.4", "pyenchant>=3.0.0"]
"pyqt6>=6.4",
"pyenchant>=3.0.0",
]
dynamic = ["version"] dynamic = ["version"]
[dependency-groups]
dev = [
{ include-group = "docs" },
{ include-group = "test" },
{ include-group = "lint" },
]
docs = [
"docutils>=0.17.1",
"pygments>=2.7",
"sphinx-book-theme",
"sphinx-copybutton",
"sphinx-design",
"sphinx-favicon",
"sphinx-intl",
"sphinx>=5.0",
]
test = ["coverage>=7.2.0", "pytest-qt", "pytest-timeout", "pytest>=6.0.0"]
lint = ["isort", "pyright", "ruff"]
[project.urls] [project.urls]
Homepage = "https://novelwriter.io" Homepage = "https://novelwriter.io"
Documentation = "https://docs.novelwriter.io" Documentation = "https://docs.novelwriter.io"
@@ -42,13 +56,13 @@ Issues = "https://github.com/vkbo/novelWriter/issues"
novelwriter = "novelwriter:main" novelwriter = "novelwriter:main"
[tool.setuptools.dynamic] [tool.setuptools.dynamic]
version = {attr = "novelwriter.__version__"} version = { attr = "novelwriter.__version__" }
[tool.setuptools.packages.find] [tool.setuptools.packages.find]
include = ["novelwriter*"] include = ["novelwriter*"]
[tool.isort] [tool.isort]
py_version="310" py_version = "310"
line_length = 99 line_length = 99
wrap_length = 79 wrap_length = 79
multi_line_output = 5 multi_line_output = 5
@@ -64,26 +78,26 @@ preview = true
# Rules: https://docs.astral.sh/ruff/rules # Rules: https://docs.astral.sh/ruff/rules
select = [ select = [
"A", # flake8-builtins (A) "A", # flake8-builtins (A)
"ANN", # flake8-annotations (ANN) "ANN", # flake8-annotations (ANN)
"B", # flake8-bugbear (B) "B", # flake8-bugbear (B)
"D", # pydocstyle (D) "D", # pydocstyle (D)
"E", # pycodestyle (E) "E", # pycodestyle (E)
"F", # Pyflakes (F) "F", # Pyflakes (F)
"FA", # flake8-future-annotations (FA) "FA", # flake8-future-annotations (FA)
"PERF", # Perflint (PERF) "PERF", # Perflint (PERF)
"PLC", # Pylint Convention (PLC) "PLC", # Pylint Convention (PLC)
"PLE", # Pylint Error (PLE) "PLE", # Pylint Error (PLE)
"PLR17", # Refactor (PLR) - Only PLR17xx "PLR17", # Refactor (PLR) - Only PLR17xx
"PLW", # Pylint Warning (PLW) "PLW", # Pylint Warning (PLW)
"Q", # flake8-quotes (Q) "Q", # flake8-quotes (Q)
"RET", # flake8-return (RET) "RET", # flake8-return (RET)
"RUF", # Ruff-specific rules (RUF) "RUF", # Ruff-specific rules (RUF)
"SLF", # flake8-self (SLF) "SLF", # flake8-self (SLF)
"SLOT", # flake8-slots (SLOT) "SLOT", # flake8-slots (SLOT)
"TC", # flake8-type-checking (TC) "TC", # flake8-type-checking (TC)
"UP", # pyupgrade (UP) "UP", # pyupgrade (UP)
"W", # pycodestyle (W) "W", # pycodestyle (W)
] ]
ignore = [ ignore = [
"ANN401", # any-type "ANN401", # any-type
@@ -149,6 +163,4 @@ branch = false
[tool.coverage.report] [tool.coverage.report]
precision = 2 precision = 2
exclude_also = [ exclude_also = ["if TYPE_CHECKING:"]
"if TYPE_CHECKING:"
]
+19 -10
View File
@@ -3,6 +3,7 @@
import argparse import argparse
import os import os
import shlex
import subprocess import subprocess
import sys import sys
@@ -12,27 +13,35 @@ if __name__ == "__main__":
parser.add_argument("-o", action="store_true", help="Run off screen") parser.add_argument("-o", action="store_true", help="Run off screen")
parser.add_argument("-r", action="store_true", help="Generate reports") parser.add_argument("-r", action="store_true", help="Generate reports")
parser.add_argument("-t", action="store_true", help="Generate terminal report") parser.add_argument("-t", action="store_true", help="Generate terminal report")
parser.add_argument("-m", help="Test modules") parser.add_argument("-u", action="store_true", help="Generate uncovered terminal report")
parser.add_argument("-k", help="Test filters") parser.add_argument("-m", help="Test modules", metavar="MARKEXPR")
parser.add_argument("-k", help="Test filters", metavar="EXPRESSION")
args = parser.parse_args() args = parser.parse_args()
env = os.environ.copy() env = os.environ.copy()
env["QT_SCALE_FACTOR"] = "1.0" env["QT_SCALE_FACTOR"] = "1.0"
cmd = [sys.executable, "-m", "pytest", "-vv"]
if args.r or args.t or args.u:
cmd = [sys.executable, "-m"]
else:
cmd = ["coverage", "-m"]
cmd += ["pytest", "-vv"]
if args.o: if args.o:
env["QT_QPA_PLATFORM"] = "offscreen" env["QT_QPA_PLATFORM"] = "offscreen"
if args.r or args.t:
cmd += ["--cov=novelwriter"]
if args.r:
cmd += ["--cov-report=xml", "--cov-report=html"]
if args.t:
cmd += ["--cov-report=term"]
if args.m: if args.m:
cmd += ["-m", args.m] cmd += ["-m", args.m]
if args.k: if args.k:
cmd += ["-k", args.k] cmd += ["-k", args.k]
print("Calling:", " ".join(cmd)) print("Calling:", shlex.join(cmd))
subprocess.call(cmd, env=env) subprocess.call(cmd, env=env)
if args.r:
subprocess.call(["coverage", "xml"])
subprocess.call(["coverage", "html"])
if args.t and not args.u:
subprocess.call(["coverage", "report"])
if args.u:
subprocess.call(["coverage", "report", "--skip-covered "])