-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyproject.toml
More file actions
297 lines (275 loc) · 8.86 KB
/
Copy pathpyproject.toml
File metadata and controls
297 lines (275 loc) · 8.86 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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
# The repo root is the kernel. `src/nu` is this distribution and nothing else;
# the rest of the stack sits in `pkgs/`, one directory per distribution:
#
# src/nu -> nucore (the kernel) import nu
# pkgs/nustd -> nustd (the fabrics) import nustd
# pkgs/nucli -> nucli (the `nu` command) import nucli
# pkgs/nudle -> nudle (the compiled SPA) import nudle
# pkgs/ts/ui-core -> @nustackdev/ui-core
# pkgs/ts/ui-kit -> @nustackdev/ui-kit
# pkgs/ts/nudle -> the vite app; its dist/ is what the nudle wheel ships
#
# One distribution, one import name, one tree each. Nothing reaches into
# anyone else's package directory, except the nudle wheel reaching for the
# vite output that is its entire payload.
[project]
name = "nucore"
version = "0.5.2"
description = "The interaction primitive. Build apps in one primitive that spans your whole stack (databases, UIs, AI agents, and services). No glue. 50x less code."
readme = "README.md"
license = "Apache-2.0"
authors = [{ name = "Gor Arakelyan", email = "gorarkln@gmail.com" }]
requires-python = ">=3.10"
# The kernel: language, engine, core/flows/spans/forms, tree, prog, info,
# inspect. No fabric backend ever lands here -- those live in the `nustd`
# distribution and merge into the same `nu.` namespace. The `nu` command lives
# in `nucli`.
dependencies = [
"typing-extensions>=4.7.0",
"cloudpickle>=3.0",
]
keywords = [
"nu",
"nustack",
"python",
"state-management",
"distributed-systems",
"ai-agents",
"agentic",
"ray",
"llm",
"database",
"key-value-store",
"rocksdb",
"ui",
"real-time",
"observability",
]
classifiers = [
"Development Status :: 3 - Alpha",
"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",
]
# No extras here on purpose. Fabric backends live on `nustd`'s extras and the
# `nu` command lives in `nucli`; the kernel never reaches up into its own
# dependents. Install everything with `pip install "nustd[all]" nucli`.
[project.urls]
Repository = "https://github.com/nustackdev/nu"
[tool.hatch.build.targets.wheel]
packages = ["src/nu"]
# The project root is the repo root, so the sdist default (everything not
# gitignored) would swallow `pkgs/`, `tests/` and `examples/` into the kernel
# tarball. Name what belongs to this distribution and nothing else.
[tool.hatch.build.targets.sdist]
only-include = [
"src/nu",
"README.md",
"LICENSE.md",
]
# =============================================================================
# Workspace
# =============================================================================
# Dev-time wiring only. `[tool.uv.workspace]` and `[tool.uv.sources]` never
# reach published metadata, so every member stays a self-sufficient
# distribution with its own pyproject, version and dependencies. What the
# workspace buys: `uv sync` installs all four editable against each other
# instead of pulling the kernel from PyPI, and `uv build --package <name>`
# (what the Makefile and CI release on) works from the root.
#
# `pkgs/ts` is the npm workspace and holds no pyproject, so the members are
# listed rather than globbed.
[tool.uv.workspace]
members = ["pkgs/nustd", "pkgs/nucli", "pkgs/nudle"]
[tool.uv.sources]
# The root project is a member too: without this entry `nustd`'s `nucore`
# dependency resolves from PyPI instead of `src/nu`, and you end up testing
# the published kernel while editing the local one.
nucore = { workspace = true }
nustd = { workspace = true }
nucli = { workspace = true }
nudle = { workspace = true }
[tool.uv]
default-groups = ["dev"]
[dependency-groups]
dev = [
# The root project (nucore) installs itself; these are the rest of the
# workspace, editable, with every fabric backend -- so a bare `uv sync`
# gives you the full dev environment and the whole suite.
"nustd[all]",
"nucli",
"ruff>=0.8.0",
"pre-commit>=3.0.0",
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
"pytest-xdist>=3.0.0",
"pytest-timeout>=2.1.0",
"pytest-benchmark>=4.0.0",
"hypothesis>=6.0.0",
"pytest-asyncio>=1.3.0",
# The narrowing suite is a mypy suite -- without this it skips itself and
# static-narrowing regressions land unnoticed.
"mypy>=1.0",
]
# =============================================================================
# Shared tooling -- covers every package in the repo, not just the kernel
# =============================================================================
# Tests stay at the repo root: one suite over the whole stack.
[tool.pytest.ini_options]
testpaths = [
"tests",
]
# `tests/_lib` is the only directory on sys.path, and `_support` is the only
# thing in it -- so no test directory can ever shadow a real package name.
# The underscore also keeps pytest from collecting it as tests.
pythonpath = [
"tests/_lib",
]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = ["-ra", "--strict-markers", "--strict-config", "--import-mode=importlib"]
asyncio_mode = "auto"
xfail_strict = true
markers = [
"slow: marks tests as slow",
"integration: marks tests as integration tests",
"inmemory: storage-backend parametrization — in-memory tkv",
"rocksdb: storage-backend parametrization — rocksdb tkv",
"lmdb: storage-backend parametrization — lmdb tkv",
"text: storage-backend parametrization — text/debug tkv",
]
[tool.coverage.run]
source = [
"src",
"pkgs/nustd/src",
"pkgs/nucli/src",
]
omit = ["*/tests/*", "*/__pycache__/*"]
branch = true
parallel = true
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"def __str__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"if typing.TYPE_CHECKING:",
"@abstractmethod",
"@abc.abstractmethod",
]
precision = 2
show_missing = true
skip_covered = true
[tool.coverage.html]
directory = "reports/coverage"
[tool.ruff]
line-length = 100
target-version = "py310"
src = [
"src",
"pkgs/nustd/src",
"pkgs/nucli/src",
"pkgs/nudle/src",
]
extend-exclude = [".venv", "build", "dist", "*.egg-info", "node_modules"]
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
"N", # pep8-naming
"YTT", # flake8-2020
"S", # flake8-bandit (security)
"T20", # flake8-print
"D", # pydocstyle
"ANN", # flake8-annotations
"TC", # flake8-type-checking
"RUF", # ruff-specific rules
"PTH", # flake8-pathlib
]
ignore = [
"E501", # handled by formatter
"D105", # docstring in magic method
"D107", # docstring in __init__ (covered by class docstring)
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.per-file-ignores]
"**/tests/**/*.py" = [
"S101", "S108", "T20", "D", "E711", "E712", "ANN", "N806",
]
"**/testing/**/*.py" = [
"S101", "T20", "D", "E711", "E712", "ANN", "N806", "B017",
]
"examples/**/*.py" = [
"S101", "T20", "D", "ANN",
]
# The demos the `nu` command ships are examples that happen to live in a
# package, so they get the same rules as examples/.
"**/src/nucli/demos/**/*.py" = [
"S101", "T20", "D", "ANN",
]
"benchmarks/**/*.py" = [
"S101", "T20", "D", "ANN", "B007",
]
"**/ops/control/**/*.py" = [
"ANN401", # Any needed for polymorphic control op parameters
]
"**/refs/std.py" = [
"N811", "N812", # std Forms (UUID, date, ...) aliased as *Form to not shadow stdlib types
]
"**/src/nustd/ui/core/**/*.py" = [
"D102", "D103",
"ANN401", # _acompile athunks legitimately return Any (host-lifted primitive)
]
"**/src/nustd/ui/refs/**/*.py" = [
"D102", # widget setters are one-liners; docstring per method is ceremony
"ANN401",
]
"**/src/nustd/ui/nudle/**/*.py" = [
"D102", "D103", "D205", "ANN401", "S110",
]
"**/src/nustd/ws_server/**/*.py" = [
"D102", "D103", "D205", "ANN401", "S110",
]
"**/src/nustd/http/methods.py" = [
"N802", # GET/POST/PUT/PATCH/DELETE mirror HTTP verbs
]
[tool.ruff.lint.isort]
known-first-party = [
"nu", "nustd", "nucli",
"virtuals", "invisibles",
]
force-single-line = false
lines-after-imports = 2
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
[tool.mypy]
python_version = "3.10"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = false
ignore_missing_imports = true
exclude = [
"build/",
"dist/",
".venv/",
"node_modules/",
]
[tool.bandit]
exclude_dirs = ["examples/"]