-
Notifications
You must be signed in to change notification settings - Fork 316
/
pyproject.toml
465 lines (420 loc) · 13.3 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
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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "marimo"
description = "A library for making reactive notebooks and apps"
dynamic = ["version"]
# We try to keep dependencies to a minimum, to avoid conflicts with
# user environments;we need a very compelling reason for each dependency added.
# Dependencies should have lower bounds, which should be as loose as possible.
dependencies = [
# For maintainable cli
"click>=8.0,<9",
# code completion
"jedi>=0.18.0",
# compile markdown to html
"markdown>=3.4,<4",
# add features to markdown
"pymdown-extensions>=10,<11",
# syntax highlighting of code in markdown
"pygments>=2.13,<3",
# for reading, writing configs
"tomlkit>= 0.12.0",
# for managing frontmatter headers in markdown
"pyyaml>=6.0",
# web server
# - 0.22.0 introduced timeout-graceful-shutdown, which we use
"uvicorn >= 0.22.0",
# web framework
# - 0.26.1 introduced lifespans, which we use
# - starlette 0.36.0 introduced a bug
"starlette>=0.26.1,!=0.36.0",
# websockets for use with starlette
"websockets >= 10.0.0",
# python <=3.10 compatibility
"typing_extensions>=4.4.0; python_version < '3.11'",
# for rst parsing; lowerbound determined by awscli requiring < 0.17,
"docutils>=0.16.0",
# to show RAM, CPU usage, other system utilities
"psutil>=5.0",
# required dependency in Starlette for SessionMiddleware support
"itsdangerous>=2.0.0",
# for dataframe support
"narwhals>=1.12.0",
# for cell formatting; if user version is not compatible, no-op
# so no lower bound needed
"ruff",
# for packaging.version; not sure what the lower bound is.
"packaging",
]
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.9"
classifiers = [
"Operating System :: OS Independent",
"License :: OSI Approved :: Apache Software License",
"Environment :: Console",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Intended Audience :: Education",
"Programming Language :: Python",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
]
[project.scripts]
marimo = "marimo._cli.cli:main"
[project.urls]
homepage = "https://github.com/marimo-team/marimo"
[project.optional-dependencies]
sql = ["duckdb >= 1.0.0", "polars >= 1.9.0"]
# List of deps that are recommended for most users
# in order to unlock all features in marimo
recommended = [
"duckdb>=1.1.0", # SQL cells
"altair>=5.4.0", # Plotting in datasource viewer
"polars>=1.9.0", # SQL output back in Python
"openai>=1.41.1", # AI features
"ruff", # Formatting
"nbformat>=5.7.0", # Export as IPYNB
]
dev = [
"click <8.1.4", # https://github.com/pallets/click/issues/2558
"black~=23.12.1",
# For tracing debugging
"opentelemetry-api~=1.26.0",
"opentelemetry-sdk~=1.26.0",
# For SQL
"duckdb>=1.0.0",
# For linting
"ruff~=0.6.1",
# For AI
"openai~=1.41.1",
]
docs = [
"mkdocs>=1.6.1",
"mkdocs-material>=9.5.49",
"mkdocstrings[python]>=0.27.0",
"mkdocs-material-extensions>=1.3.1",
"mkdocs-autorefs>=1.0.1",
"mkdocs-git-revision-date-localized-plugin>=1.2.4",
"mkdocs-minify-plugin>=0.8.0",
"mkdocs-glightbox>=0.3.7",
"mkdocs-macros-plugin>=1.3.0",
"mkdocs-redirects>=1.0.0",
"mkdocs-click>=0.8.1",
"mike>=2.0.0", # for versioning
"pillow>=10.2.0", # for social cards
"cairosvg>=2.7.1", # for social cards
"mdx-include>=1.4.2",
"pymdown-extensions>=10.7",
]
[tool.hatch]
installer = "uv"
[tool.hatch.version]
path = "marimo/__init__.py"
[tool.hatch.build.targets.sdist]
include = ["/marimo"]
artifacts = ["marimo/_static/", "marimo/_lsp/", "third_party.txt", "third_party_licenses.txt"]
exclude = ["marimo/_smoke_tests"]
[tool.hatch.build.targets.wheel]
include = ["/marimo"]
artifacts = ["marimo/_static/", "marimo/_lsp/", "third_party.txt", "third_party_licenses.txt"]
exclude = ["marimo/_smoke_tests"]
# Override the default uv version to use the latest version
[tool.hatch.envs.hatch-uv]
dependencies = ["uv>=0.4.17"]
[tool.hatch.envs.default]
features = ["dev"]
python = "3.12"
installer = "uv"
dependencies = [
"uv>=0.4.17", # so we can bump the version used by hatch
# Typo checking
"typos~=1.23.6",
]
[tool.hatch.envs.default.scripts]
lint = "ruff check --fix"
format = "ruff format"
[tool.hatch.envs.typecheck]
python = "3.12"
installer = "uv"
dependencies = [
"mypy~=1.10.1",
# Types for mypy
"leafmap~=0.39.2",
"panel~=1.5.3",
"polars~=1.9.0",
"narwhals>=1.12.0",
"matplotlib>=3.8.0",
"pyarrow-stubs>=17.0",
"pandas-stubs>=1.5.3.230321",
"types-Pillow~=10.2.0.20240520",
"types-Pygments~=2.18.0.20240506",
"types-psutil~=5.9.5.20240516",
"types-Markdown~=3.6.0.20240316",
"types-PyYAML~=6.0.12.20240808",
]
[tool.hatch.envs.typecheck.scripts]
check = "mypy marimo/"
[tool.hatch.envs.test]
extra-dependencies = [
"hypothesis~=6.102.1",
# For server testing
"httpx~=0.27.0",
"matplotlib~=3.9.2",
"pytest~=8.3.2",
"pytest-timeout~=2.3.1",
"pytest-codecov~=0.5.1",
"pytest-asyncio~=0.23.8",
]
[[tool.hatch.envs.test.matrix]]
python = ["3.9", "3.10", "3.11", "3.12"]
[tool.hatch.envs.test.scripts]
test = "pytest{env:HATCH_TEST_ARGS:} {args:tests}"
default = "pytest{env:HATCH_TEST_ARGS:} {args:tests}"
# This is used externally from the narwhals repo to run our tests from their repo.
# This should include any tests that may use narwhals.
# It is ok if we test more than narwhals here, but we should not test less.
test-narwhals = """
pytest{env:HATCH_TEST_ARGS:} \
tests/_data/ \
tests/_plugins/ui/_impl/ \
tests/_utils/test_narwhals_utils.py
"""
[tool.hatch.envs.test-optional]
template = "test"
extra-dependencies = [
"hypothesis~=6.102.1",
"httpx~=0.27.0",
"matplotlib~=3.9.2",
"pytest~=8.3.2",
"pytest-timeout~=2.3.1",
"pytest-codecov~=0.5.1",
"pytest-asyncio~=0.23.8",
# For testing mo.ui.chart, table, ...
"vl-convert-python",
"pyarrow",
"pyarrow_hotfix",
"altair>=5.4.0",
"polars~=1.9.0",
"pandas>=1.5.3",
"geopandas~=0.14.4; python_version > '3.9'",
# FOr testing sql
"ibis-framework[duckdb]~=9.5.0; python_version > '3.9'",
# For testing mo.image
"pillow~=10.4.0",
"anywidget~=0.9.13",
"ipython~=8.12.3",
# testing gen ai
"openai~=1.41.1",
"anthropic==0.34.1",
"google-generativeai==0.8.2",
# exporting as ipynb
"nbformat >=5.10.4",
"sympy>=1.13.2",
# For standard scientific computing/ ML
"jax>=0.4.0; python_version == '3.12'",
"torch>=2.4.0; python_version == '3.12'",
"scikit-bio>=0.6.0; python_version == '3.12'",
]
[[tool.hatch.envs.test-optional.matrix]]
python = ["3.9", "3.10", "3.11", "3.12"]
[tool.hatch.envs.docs]
features = ["dev", "docs"]
dependencies = [
"marimo_docs @ file://docs",
]
[tool.uv.sources]
marimo_docs = { path = "./docs", editable = true }
[tool.hatch.envs.docs.scripts]
build = "mkdocs build {args}"
serve = "mkdocs serve --clean {args}"
deploy = "mkdocs gh-deploy --force {args}"
[tool.ruff]
line-length = 79
include = ["marimo/**/*.py", "tests/**/*.py", "dagger/**/*.py"]
exclude = [
"examples",
"scripts",
"marimo/_tutorials",
"marimo/_snippets/data",
"marimo/_smoke_tests",
"marimo/_test_utils/codegen_data",
"marimo/_test_utils/_tutorials",
"marimo/_static/files/wasm-intro.py",
"tests/_ast/app_data",
"tests/_ast/codegen_data",
"tests/_ast/cell_data",
"tests/_cli/cli_data",
"tests/_cli/ipynb_data",
"tests/_runtime/runtime_data",
"tests/_ast/test_app.py",
"frontend",
"docs",
"build",
]
[tool.ruff.lint]
ignore = [
"G004", # Logging statement uses f-string
"TCH001", # Move application import into a type-checking block
"D301", # Use r""" if any backslashes in a docstring
# TODO: we should fix these, and enable this rule
"PT011", # `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception
"E501", # Line too long, we still trim
"D415", # First line should end with a period, question mark, or exclamation point
]
extend-select = [
# pyflakes
"F",
# pycodestyle
"E",
# warning
"W",
# flake8 builtin-variable-shadowing
"A001",
# flake8 builtin-argument-shadowing
"A002",
# flake8-unused-arguments
"ARG",
# flake8-bugbear
"B",
"ANN002", # missing-type-args
"ANN003", # missing-type-kwargs
"ANN201", # missing-return-type-undocumented-public-function
"ANN202", # missing-return-type-private-function
"ANN205", # missing-return-type-static-method
"ANN206", # missing-return-type-class-method
# isort
"I001",
# Enable entire ruff rule section
"ASYNC", # subset of flake8-async rules
"TCH", # Rules around TYPE_CHECKING blocks
"G", # flake8-logging-format rules
"LOG", # flake8-logging rules, most of them autofixable
"PT", # flake8-pytest-style rules
"TID25", # flake8-tidy-imports rules
# Per rule enables
# "RUF100", # Unused noqa (auto-fixable)
# We ignore more pydocstyle than we enable, so be more selective at what we enable
# "D101", # Missing docstring in public class
"D106",
# "D2",
"D3",
# "D400", # First line should end with a period
# "D401", # First line of docstring should be in imperative mood
"D402",
"D403",
"D412",
"D419",
"PGH004", # Use specific rule codes when using noqa
"PGH005", # Invalid unittest.mock.Mock methods/attributes/properties
# "S101", # Checks use `assert` outside the test cases, test cases should be added into the exclusions
"B004", # Checks for use of hasattr(x, "__call__") and replaces it with callable(x)
"B006", # Checks for uses of mutable objects as function argument defaults.
"B017", # Checks for pytest.raises context managers that catch Exception or BaseException.
"B019", # Use of functools.lru_cache or functools.cache on methods can lead to memory leaks
"TRY002", # Prohibit use of `raise Exception`, use specific exceptions instead.
"T201", # No print statements
"D3", # pydocstyle Quotes Issues
"D4", # pydocstyle Docstring Content Issues
"D207", # Docstring is under-indented
"D208", # Docstring is over-indented
"D210", # No whitespaces allowed surrounding docstring text
"D211", # No blank lines allowed before class docstring
"D214", # Section is over-indented
"D215", # Section underline is over-indented
]
# Never try to fix `F401` (unused imports).
unfixable = ["F401"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.per-file-ignores]
"**/{tests}/*" = ["ANN201", "ANN202", "T201", "D"]
"dagger/*" = ["TID252"]
[tool.ruff.lint.isort]
required-imports = ["from __future__ import annotations"]
combine-as-imports = true
[tool.ruff.lint.flake8-type-checking]
exempt-modules = ["typing", "typing_extensions"]
[tool.ruff.format]
docstring-code-format = true
[tool.ruff.lint.flake8-tidy-imports]
# Disallow all relative imports.
ban-relative-imports = "all"
# Ban certain modules from being imported at module level, instead requiring
# that they're imported lazily (e.g., within a function definition).
banned-module-level-imports = [
"numpy",
"pandas",
"tomlkit",
"polars",
"altair",
"ipython",
"anywidget",
"packaging",
]
[tool.ruff.lint.flake8-pytest-style]
mark-parentheses = false
fixture-parentheses = false
[tool.mypy]
strict = true
exclude = [
'examples',
'tests/_ast/app_data',
'tests/_ast/codegen_data',
'tests/_ast/cell_data',
'tests/_cli/cli_data',
'tests/_cli/ipynb_data',
'tests/_runtime/runtime_data',
'marimo/_tutorials/',
'marimo/_snippets/data/',
'marimo/_smoke_tests/',
]
warn_unused_ignores = false
# tutorials shouldn't be type-checked (should be excluded), but they
# get included anyway, maybe due to import following; this is coarse but works
[[tool.mypy.overrides]]
module = "marimo._tutorials.*"
ignore_errors = true
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-ra -q -v --ignore tests/_cli/ipynb_data --ignore tests/_ast/codegen_data --ignore tests/_ast/app_data"
testpaths = ["tests"]
asyncio_mode = "auto"
timeout = 30 # seconds, per test
[tool.coverage.run]
omit = ["marimo/_tutorials/*"]
[tool.typos.default]
extend-ignore-re = ["[0-9a-zA-Z]{43}"]
[tool.typos.default.extend-words]
wheres = "wheres"
Ue = "Ue" # Used in one of the cell IDs
Nd = "Nd" # Confused with And
pn = "pn" # Panel
[tool.typos.files]
extend-exclude = [
"MultiSelectPlugin.test.ts",
"module_name_to_pypi_name.py",
"**/pnpm-lock.yaml",
"**/snapshots/*",
"**/__demo__/*",
"base64.test.ts",
]
[tool.black]
line-length = 79
[tool.marimo.ai]
rules = "- prefer polars over pandas\n- make charts using altair"
[tool.marimo.save]
autosave_delay = 1000
autosave = "after_delay"
format_on_save = true
[tool.marimo.experimental]
multi_column = true
chat_sidebar = true
[tool.marimo.display]
dataframes = "rich"