forked from manzt/anywidget
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
160 lines (141 loc) · 4.49 KB
/
pyproject.toml
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "anywidget"
description = "custom jupyter widgets made easy"
authors = [
{ name = "Trevor Manz", email = "trevor.j.manz@gmail.com" }
]
license = { text = "MIT" }
dynamic = ["version"]
readme = "README.md"
requires-python = ">=3.8"
dependencies = [
"ipywidgets>=7.6.0",
"typing-extensions>=4.2.0",
"psygnal>=0.8.1",
]
classifiers = [
"Framework :: Jupyter",
"Framework :: Jupyter :: JupyterLab",
"Framework :: Jupyter :: JupyterLab :: 4",
"Framework :: Jupyter :: JupyterLab :: Extensions",
"Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
]
[project.urls]
homepage = "https://github.com/manzt/anywidget"
[project.optional-dependencies]
dev = ["watchfiles>=0.18.0"]
[tool.uv]
dev-dependencies = [
"comm>=0.1.4",
"jupyterlab>=4.2.4",
"msgspec>=0.18.6",
"mypy>=1.11.1",
"pydantic>=2.5.3",
"pytest>=7.4.4",
"ruff>=0.6.1",
"watchfiles>=0.23.0",
]
[tool.uv.sources]
anywidget = { workspace = true }
[tool.hatch.build.targets.wheel.shared-data]
"anywidget/nbextension" = "share/jupyter/nbextensions/anywidget"
"anywidget/labextension" = "share/jupyter/labextensions/anywidget"
"anywidget.json" = "etc/jupyter/nbconfig/notebook.d/anywidget.json"
[tool.hatch.build]
exclude = [".github"]
artifacts = [
"anywidget/nbextension/index.*",
"anywidget/labextension/*.tgz",
"anywidget/labextension",
]
[tool.hatch.build.hooks.jupyter-builder]
build-function = "hatch_jupyter_builder.npm_builder"
ensured-targets = [
"anywidget/nbextension/index.js",
"anywidget/labextension/package.json",
]
skip-if-exists = [
"anywidget/nbextension/index.js",
"anywidget/labextension/package.json",
]
dependencies = [
"hatch-jupyter-builder>=0.5.0",
]
[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
npm = "pnpm"
build_cmd = "build"
[tool.hatch.version]
path = "packages/anywidget/package.json"
pattern = "\"version\": \"(?P<version>.+?)\""
# https://github.com/charliermarsh/ruff
[tool.ruff]
line-length = 88
src = ["anywidget", "tests"]
exclude = ["packages", "docs"]
[tool.ruff.lint]
pydocstyle = { convention = "numpy" }
select = ["ALL"]
ignore = [
"D401", # First line should be in imperative mood (remove to opt in)
"COM812", # Missing trailing comma (conflicts with ruff format)
"ISC001", # Import sorting (conflicts with ruff format)
"FIX002", # Fixable issue
"DOC201", # TODO(manzt) enable in follow-up PR; no doc for return type.
"FBT", # TODO(manzt): enable in follow-up PR; require bool options to be keyword-only.
]
[tool.ruff.lint.per-file-ignores]
"tests/*.py" = [
"D", # No docstrings in tests
"S101", # Use of assert
"B018", # "useless expression", for accessing the Foo._repr_mimbundle_ descriptor
"SLF001", # Access private member
]
"docs/*.py" = ["D"]
# https://docs.pytest.org/en/latest/customize.html
[tool.pytest.ini_options]
minversion = "6.0"
testpaths = ["tests"]
filterwarnings = [
# this line turns warnings coming from anywidget into test errors
# best practice is to use pytest.warns to actually assert warnings happen
"error:::anywidget",
"ignore:Jupyter is migrating its paths:DeprecationWarning",
"ignore:Deprecated in traitlets 4.1, use the instance .metadata:DeprecationWarning",
]
log_cli_level = "INFO"
xfail_strict = true
addopts = ["-ra", "--strict-markers", "--strict-config"]
# https://coverage.readthedocs.io/en/6.4/config.html
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"@overload",
"except ImportError",
"\\.\\.\\.",
"raise NotImplementedError()"
]
# https://mypy.readthedocs.io/en/stable/config_file.html
[tool.mypy]
files = "anywidget/**/*.py"
strict = true
# this one is cumbersome, and not always that useful
disallow_any_generics = false
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
warn_unreachable = true
[[tool.mypy.overrides]]
module = "anywidget.widget" # makes heavy use of traitlets, which is not typed
disallow_untyped_calls = false
[[tool.mypy.overrides]]
module = "anywidget._cellmagic" # makes heavy use of IPython, which is not typed
disallow_untyped_calls = false
[[tool.mypy.overrides]]
# this might be missing in pre-commit, but they aren't typed anyway
module = ["ipywidgets", "traitlets.*", "comm", "IPython.*"]
ignore_missing_imports = true