-
Notifications
You must be signed in to change notification settings - Fork 168
Expand file tree
/
Copy pathpyproject.toml
More file actions
177 lines (157 loc) · 6.33 KB
/
Copy pathpyproject.toml
File metadata and controls
177 lines (157 loc) · 6.33 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
[project]
name = "streamlit-extras"
version = "1.6.0"
license = "Apache-2.0"
description = "A community-driven collection of useful Streamlit components and utilities that extend Streamlit's functionality."
authors = [
{ name = "Arnaud Miribel", email = "arnaudmiribel@gmail.com" },
{ name = "Zachary Blackwood", email = "zachary@streamlit.io" },
{ name = "Lukas Masuch", email = "lukas.masuch@gmail.com" },
]
readme = "README.md"
requires-python = ">=3.10"
keywords = ["python", "streamlit", "ui", "data"]
dependencies = [
"plotly >= 5.23.0",
"streamlit >= 1.54.0",
]
[project.packages]
include = ["streamlit_extras"]
from = "src"
exclude = ["gallery/"]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
# =============================================================================
# Hatch build configuration
# =============================================================================
[tool.hatch.build.targets.wheel]
# For react-based CCv2 extras: exclude everything under frontend/ except the build/ folder
# This keeps only the compiled JS bundles, not the React/TypeScript source
exclude = [
"src/streamlit_extras/*/frontend/*",
"!src/streamlit_extras/*/frontend/build",
"!src/streamlit_extras/*/frontend/build/**",
]
[tool.hatch.build.targets.wheel.hooks.custom]
# Build React frontends automatically during wheel packaging
path = "scripts/hatch_build.py"
[dependency-groups]
dev = [
"pytest >= 7.4.4",
"mypy==1.20.2",
"ty==0.0.38",
"pre-commit >= 3.0.0",
"ruff==0.15.13",
"types-requests",
"types-python-dateutil",
"types-pytz",
"types-PyYAML",
"types-toml",
"pandas-stubs>=2.3.3.260113",
]
[project.urls]
"Homepage" = "https://github.com/arnaudmiribel/streamlit-extras"
"Bug Tracker" = "https://github.com/arnaudmiribel/streamlit-extras/issues"
# =============================================================================
# Ruff configuration (linting + formatting)
# =============================================================================
[tool.ruff]
line-length = 120
[tool.ruff.lint]
preview = true
select = ["ALL"]
extend-safe-fixes = ["TC002", "TC003"]
ignore = [
# === Rule sets to ignore ===
"D", # Docstrings - existing docstrings don't follow strict convention
"DTZ", # Datetime timezone
"C90", # McCabe complexity
"SLF", # Private member access
"BLE", # Blind except
"CPY", # Copyright
"FBT", # Boolean positional args
"TID252", # Relative imports
"S101", # Assert statements
"TRY", # Try/except style
"EM", # Exception message style
"NPY", # NumPy legacy random
"PGH003", # Blanket type:ignore
# === Individual rules ===
"ANN401", # Any type - needed for decorators and generic wrappers
"COM812", "COM819", # Trailing comma (conflicts with formatter)
"E501", # Line too long
"ERA001", # Commented out code
"FIX002", # TODO comments
"FURB152",
"PLC0415", "PLC2701",
"PLR0904", "PLR0911", "PLR0912", "PLR0913", "PLR0914", "PLR0915", "PLR0916", "PLR0917", "PLR1702", "PLR2004", "PLR6301",
"RET504",
"RUF052",
"SIM117", "SIM102",
"T201", # Print statements
"TD002", "TD003",
"TRY300",
"B008", # Function call in default argument (common pattern in Streamlit)
"B018", # Useless expression (used for examples)
"PT011", "PT018", "PT019",
"A002", # Builtin argument shadowing (type, help - common in Streamlit APIs)
"S324", # Insecure hash (md5 used for non-security purposes)
"S110", # try-except-pass
"S113", # requests without timeout (example code)
"PLR6201", # literal-membership (tuple vs set - minor)
"PLW2901", # redefined-loop-name
"RUF028", # invalid-formatter-suppression-comment
"RUF067", # __init__ module should only contain re-exports (project uses __init__.py for main code)
]
[tool.ruff.lint.per-file-ignores]
"tests/**" = ["ANN", "ARG", "D", "INP", "N", "PERF", "S", "TRY"]
"gallery/**" = ["INP001", "PERF203"] # Gallery is an app, not a package
"docs/**" = ["INP001", "T201", "RUF001"] # Docs scripts
"**/__init__.py" = ["F401"] # Allow re-exports
"scripts/hatch_build.py" = ["INP001", "S404", "S603", "S607", "DOC201", "DOC501"] # Build script needs subprocess
[tool.ruff.lint.isort]
known-first-party = ["streamlit_extras"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.flake8-unused-arguments]
ignore-variadic-names = true
[tool.ruff.lint.flake8-comprehensions]
allow-dict-calls-with-keyword-arguments = true
[tool.ruff.format]
docstring-code-format = true
# =============================================================================
# mypy configuration (type checking)
# =============================================================================
[tool.mypy]
files = ["src", "gallery"]
python_version = "3.10"
cache_dir = ".mypy_cache"
incremental = true
warn_return_any = false # Don't warn when returning Any from typed function
warn_unused_ignores = true # Warn about unused # type: ignore comments
check_untyped_defs = true # Type check inside untyped functions
ignore_missing_imports = true # Silence errors for imports without stubs
disallow_any_generics = false # Allow generic types without type parameters
disallow_untyped_defs = true # Require type annotations on all functions
disallow_incomplete_defs = true # Require full signatures (no partial annotations)
disable_error_code = ["import-untyped"] # Disable error code for imports without stubs
[[tool.mypy.overrides]]
module = "tests.*"
ignore_errors = true
[[tool.mypy.overrides]]
module = "docs.*"
ignore_errors = true
# =============================================================================
# ty configuration (type checking)
# =============================================================================
[tool.ty.src]
include = ["src", "gallery"]
[tool.ty.rules]
unused-type-ignore-comment = "ignore" # Allow mypy-compatible type:ignore comments (ty doesn't need them)
unresolved-import = "ignore" # Optional dependencies may not be installed
unresolved-attribute = "ignore" # Dynamic attributes from decorators/modules
# Ignore - these are false positives from incomplete pandas/numpy type stubs
invalid-argument-type = "ignore" # pandas DataFrame columns parameter
invalid-assignment = "ignore" # Complex type inference in example code
no-matching-overload = "ignore" # numpy random method overloads