File size: 5,771 Bytes
0ad74ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
[build-system]
requires = [
  "hatchling",
  "hatch-requirements-txt",
  "hatch-fancy-pypi-readme>=22.5.0",
]
build-backend = "hatchling.build"

[project]
name = "gradio"
dynamic = ["version", "dependencies", "optional-dependencies", "readme"]
description = "Python library for easily interacting with trained machine learning models"
license = "Apache-2.0"
requires-python = ">=3.10"
authors = [
  { name = "Abubakar Abid", email = "[email protected]" },
  { name = "Ali Abid", email = "[email protected]" },
  { name = "Ali Abdalla", email = "[email protected]" },
  { name = "Dawood Khan", email = "[email protected]" },
  { name = "Ahsen Khaliq", email = "[email protected]" },
  { name = "Pete Allen", email = "[email protected]" },
  { name = "Ömer Faruk Özdemir", email = "[email protected]" },
  { name = "Freddy A Boulton", email = "[email protected]" },
  { name = "Hannah Blair", email = "[email protected]" },
]
keywords = ["machine learning", "reproducibility", "visualization"]

classifiers = [
  'Development Status :: 5 - Production/Stable',
  'License :: OSI Approved :: Apache Software License',
  'Operating System :: OS Independent',
  'Programming Language :: Python :: 3',
  'Programming Language :: Python :: 3 :: Only',
  'Programming Language :: Python :: 3.8',
  'Programming Language :: Python :: 3.9',
  'Programming Language :: Python :: 3.10',
  'Programming Language :: Python :: 3.11',
  'Topic :: Scientific/Engineering',
  'Topic :: Scientific/Engineering :: Artificial Intelligence',
  'Topic :: Scientific/Engineering :: Visualization',
]

[project.scripts]
gradio = "gradio.cli:cli"
upload_theme = "gradio.themes.upload_theme:main"

[project.urls]
Homepage = "https://github.com/gradio-app/gradio"

[tool.hatch.version]
path = "gradio/package.json"
pattern = ".*\"version\":\\s*\"(?P<version>[^\"]+)\""

[tool.hatch.metadata.hooks.requirements_txt]
filename = "requirements.txt"

[tool.hatch.metadata.hooks.requirements_txt.optional-dependencies]
oauth = ["requirements-oauth.txt"]

[tool.hatch.metadata.hooks.fancy-pypi-readme]
content-type = "text/markdown"
fragments = [{ path = "README.md" }]

[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = "(website/homepage|readme_files)/"
replacement = 'https://raw.githubusercontent.com/gradio-app/gradio/main/\g<1>/'

[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = 'demo/([\S]*.gif)'
replacement = 'https://raw.githubusercontent.com/gradio-app/gradio/main/demo/\g<1>'

[tool.hatch.build]
artifacts = [
  "/gradio/templates",
  "/gradio/_frontend_code",
  "*.pyi",
  "/gradio/node",
  "py.typed",
]

[tool.hatch.build.targets.lite]
artifacts = ["!gradio/templates", "!*.pyi", "!/gradio/test_data", "!/gradio/_frontend_code", "!/gradio/node"]
directory = "dist-lite"
dependencies = ["lite-builder @ {root:uri}/../.config/lite-builder"]

[tool.hatch.build.targets.wheel.hooks.custom]
path = ".config/copy_frontend.py"

[tool.hatch.build.targets.sdist]
include = [
  "/gradio",
  "/test",
  "/README.md",
  "/requirements.txt",
  "/requirements-oauth.txt",
  "/.config/copy_frontend.py",
  "/js",
  "/client/js",
]

[tool.pyright]
include = [
  "gradio/**/*.py",
  "demo/**/*.py",
  "test/**/*.py",
]
exclude = [
  "gradio/themes/",
  "gradio/_frontend_code/",
  "gradio/components/*_plot.py",
  "gradio/node/*.py",
  "gradio/_frontend_code/*.py",
]
stubPath = "gradio/stubs"
extraPaths = ["gradio/stubs"]
reportMissingImports = false

[tool.ruff]
exclude = ["gradio/node/*.py", ".venv/*", "gradio/_frontend_code/*.py"]

[tool.ruff.lint]
extend-select = [
  "ARG",
  "B",
  "C",
  "E",
  "F",
  "I",
  "N",
  "PL",
  "S101",
  "SIM",
  "UP",
  "W",
]
ignore = [
  "B008",    # function call in argument defaults
  "B017",    # pytest.raises considered evil
  "B023",    # function definition in loop (TODO: un-ignore this)
  "B028",    # explicit stacklevel for warnings
  "B905",    # zip without explicit `strict` argument
  "C901",    # function is too complex (TODO: un-ignore this)
  "E501",    # from scripts/lint_backend.sh
  "PLR091",  # complexity rules
  "PLR2004", # magic numbers
  "PLW2901", # `for` loop variable overwritten by assignment target
  "SIM105",  # contextlib.suppress (has a performance cost)
  "SIM117",  # multiple nested with blocks (doesn't look good with gr.Row etc)
  "UP006",   # use `list` instead of `List` for type annotations (fails for 3.8)
  "UP007",   # use X | Y for type annotations (TODO: can be enabled once Pydantic plays nice with them)
  "UP038",   # uses of isinstance and issubclass that take a tuple of types for comparison.
]

[tool.ruff.lint.per-file-ignores]
"demo/*" = [
  "ARG",
  "E402", # Demos may have imports not at the top
  "E741", # Demos may have ambiguous variable names
  "F405", # Demos may use star imports
  "I",    # Don't care about import order
]
"gradio/__init__.py" = [
  "F401", # "Imported but unused" (TODO: it would be better to be explicit and use __all__)
]
"gradio/routes.py" = [
  "UP006", # Pydantic on Python 3.7 requires old-style type annotations (TODO: drop when Python 3.7 is dropped)
]
"gradio/cli/commands/files/NoTemplateComponent.py" = ["ALL"]
"client/python/gradio_client/serializing.py" = [
  "ARG",  # contains backward compatibility code, so args need to be named as such
]
"client/python/test/*" = [
  "ARG",
  "S101", # tests may use assertions
]
"test/*" = [
  "ARG",
  "S101", # tests may use assertions
]
"client/python/test/test_client.py" = [
  "PLW0603" # using global to keep track of server progress
]

[tool.pytest.ini_options]
GRADIO_ANALYTICS_ENABLED = "False"
filterwarnings = ["ignore::UserWarning:gradio.*:", "ignore::DeprecationWarning:gradio.*:"]