Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
132 lines (121 loc) · 4.21 KB
/
Copy pathpyproject.toml
File metadata and controls
132 lines (121 loc) · 4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "pyfusejs"
version = "1.5.0"
description = "Fuzzy search over records — a behavioural Python port of fuse.js."
readme = "README.md"
license = { text = "Apache-2.0" }
requires-python = ">=3.10"
authors = [{ name = "Ayan Bag" }]
keywords = [
"fuzzy",
"search",
"fuzzy-search",
"bitap",
"fuse",
"pyfuse",
"full-text-search",
"approximate-string-matching",
"typo-tolerant",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Text Processing :: Indexing",
"Typing :: Typed",
]
# Zero runtime dependencies, mirroring fuse.js's zero-dep design.
dependencies = []
[project.optional-dependencies]
dev = [
"pytest>=8.0",
"hypothesis>=6.100",
"ruff>=0.6",
"mypy>=1.11",
]
[project.urls]
Homepage = "https://github.com/ayanbag/pyfuse"
Repository = "https://github.com/ayanbag/pyfuse"
Demo = "https://ayanbag.github.io/pyfuse/"
Issues = "https://github.com/ayanbag/pyfuse/issues"
"Decision log" = "https://github.com/ayanbag/pyfuse/blob/main/DECISIONS.md"
"Upstream (fuse.js)" = "https://github.com/krisk/Fuse"
[tool.hatch.build.targets.wheel]
packages = ["src/pyfuse"]
# The sdist carries the sources needed to build and verify the package, and
# nothing else. `tests/original/` is a vendored fuse.js checkout kept for
# provenance — it belongs in the repository, not in everyone's download.
[tool.hatch.build.targets.sdist]
include = [
"/src",
"/tests/port",
"/examples",
"/README.md",
"/DECISIONS.md",
"/LICENSE",
"/NOTICE",
"/pyproject.toml",
]
[tool.pytest.ini_options]
testpaths = ["tests/port"]
pythonpath = ["src"]
addopts = "-q"
markers = [
"differential: compares against the live fuse.js oracle via Node",
]
[tool.ruff]
line-length = 88
target-version = "py310"
src = ["src", "tests/port", "fuzz", "bench"]
[tool.ruff.lint]
select = ["E", "F", "W", "I", "N", "UP", "B", "C4", "SIM", "RUF", "ANN", "PL"]
ignore = [
# The port mirrors fuse.js's control flow deliberately; several hot loops
# keep the original's shape rather than a more "Pythonic" rewrite so the
# arithmetic order — and therefore the float results — stay identical.
"PLR0912", # too many branches
"PLR0913", # too many arguments
"PLR0915", # too many statements
"PLR0911", # too many returns — type-dispatch chains ported from JS
"PLR2004", # magic value comparison
"C901", # complexity
# A search engine indexes documents whose shape it cannot know. `Any` at
# that boundary is the honest type; banning it would only push the
# imprecision into `cast()` calls, which are genuinely unsafe. The
# Zero-Unsafe budget is measured on `cast`, `type: ignore`, `eval`/`exec`
# and bare `except` instead — see DECISIONS.md.
"ANN401",
]
[tool.ruff.lint.per-file-ignores]
# These files contain exotic whitespace and lookalike letters *on purpose*:
# they transcribe the ECMAScript whitespace set and fuse.js's
# non-decomposable character map. RUF001 would have us "fix" the data.
"src/pyfuse/_js.py" = ["RUF001"]
"src/pyfuse/helpers/diacritics.py" = ["RUF001", "E501"]
"tests/port/*" = ["ANN", "PLR2004", "RUF012", "N802", "N803", "N806", "RUF001"]
"fuzz/*" = ["ANN", "PLR2004", "RUF012"]
# The benchmark imports platform-specific modules (`ctypes`, `resource`) inside
# the function that needs them, on purpose: importing either unconditionally at
# module scope would fail on the other platform.
"bench/*" = ["ANN", "PLR2004", "RUF012", "PLC0415"]
[tool.mypy]
python_version = "3.10"
strict = true
# `packages` rather than `files`: `src/pyfuse/types.py` would otherwise be
# resolved as the stdlib top-level `types` module.
mypy_path = "src"
packages = ["pyfuse"]
warn_unreachable = true
disallow_any_explicit = false
show_error_codes = true
[[tool.mypy.overrides]]
module = "tests.*"
ignore_errors = true