-
Notifications
You must be signed in to change notification settings - Fork 26
/
pyproject.toml
218 lines (191 loc) · 4.83 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
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
[project]
name = "g2p"
dynamic = ["version"]
description = "Module for creating context-aware, rule-based G2P mappings that preserve indices"
readme = "README.md"
license = "MIT"
requires-python = ">= 3.7"
authors = [
{ name = "Aidan Pine", email = "[email protected]" },
]
classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
]
dependencies = [
"click>=8.0.4",
"coloredlogs>=15.0.1",
"openpyxl",
"panphon>=0.19",
"panphon<0.21; python_version<'3.9'",
"panphon<0.21; platform_system=='Windows'",
"pydantic>=2.4, <2.9", # pydantic 2.9.0 changes our schema
"pyyaml>=5.2",
"regex",
"text_unidecode",
"tqdm",
"typing_extensions",
]
[project.optional-dependencies]
api = [
# See https://github.com/encode/starlette/discussions/2413
"fastapi>=0.109.0",
"starlette>=0.40.0",
"python-socketio>=5.9.0",
"uvicorn",
"jinja2",
]
test = [
"g2p[api]; python_version >= '3.8'",
"coverage[toml]>=6.5",
"playwright>=1.26.1",
"jsonschema>=4.17.3",
"pep440>=0.1.2",
"httpx",
# Kind of bogus that we need both httpx and aiohttp, but socketio
# wants this
"aiohttp",
]
dev = [
"g2p[test]",
"black>=23; python_version < '3.8'",
"black~=24.3; python_version >= '3.8'",
"gitlint-core>=0.17.0",
"isort>=5.10.1",
"mypy>=1; python_version < '3.8'",
"mypy>=1.8.0; python_version >= '3.8'",
"pre-commit>=3.2.0; python_version >= '3.8'",
]
# This one is a bit special and cannot depend on other features,
# because if it depends on `g2p[api]` then we end up with
# `g2p==SOMEVERSION` in requirements.txt and we DO NOT want that to
# happen.
# See https://github.com/jazzband/pip-tools/issues/2002
# See https://github.com/juftin/hatch-pip-compile/issues/78
prod = [
"gunicorn>=22.0.0",
]
docs = [
"mkdocs>=1.5.2",
"mkdocs-click>=0.8.0",
"mkdocs-material>=9.2.5",
"mkdocstrings[python]>=0.22.0",
"mike>=1.1.2",
]
[project.scripts]
g2p = "g2p.cli:cli"
[project.urls]
Homepage = "https://github.com/roedoejet/g2p"
[tool.setuptools]
packages = ["g2p"]
include-package-data = true
[tool.setuptools_scm]
[tool.hatch.version]
source = "vcs"
[tool.hatch.build.hooks.vcs]
version-file = "g2p/_version.py"
template = """
# file generated by setuptools_scm
# don't change, don't track in version control
TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple, Union
VERSION_TUPLE = Tuple[Union[int, str], ...]
else:
VERSION_TUPLE = object
VERSION: str
version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE
VERSION = __version__ = version = {version!r}
__version_tuple__ = version_tuple = {version_tuple!r}
"""
[tool.hatch.build.targets.sdist]
include = [
"/g2p",
]
[tool.hatch.env]
requires = [
"hatch-pip-compile"
]
[tool.hatch.envs.api]
features = [ "api" ]
[tool.hatch.envs.api.scripts]
serve = "uvicorn g2p.app:APP --reload --port 5000"
[tool.hatch.envs.prod]
template = "api"
features = [ "api", "prod" ]
type = "pip-compile"
python = "3.10"
lock-filename = "requirements.txt"
pip-compile-verbose = false
[tool.hatch.envs.prod.scripts]
serve = "gunicorn --worker-class uvicorn.workers.UvicornWorker -w 1 g2p.app:APP --bind 0.0.0.0:5000"
[tool.hatch.envs.test]
features = [ "test" ]
[[tool.hatch.envs.test.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
[tool.hatch.envs.test.scripts]
serve-cov = "coverage run run_studio.py"
test = "python run_tests.py dev"
test-cov = "coverage run run_tests.py dev"
test-studio = "python g2p/tests/test_studio.py"
cov-report = [
"- coverage combine",
"coverage report",
]
cov = [
"test-cov",
"cov-report",
]
[tool.hatch.envs.dev]
features = [ "dev" ]
post-install-commands = [
"pre-commit install",
"gitlint install-hook || true",
]
[tool.hatch.envs.dev.scripts]
check = "mypy {args:g2p}"
[tool.coverage.run]
source_pkgs = ["g2p"]
branch = true
parallel = true
omit = [
"g2p/_version.py",
"g2p/tests/**/*.py",
]
[tool.coverage.report]
precision = 2
[tool.mypy]
plugins = ["pydantic.mypy"]
install_types = true
non_interactive = true
[tool.isort]
profile = "black"
[tool.pylint.main]
# Unsure how to make pylint recursively ignore
ignore = [
"g2p/tests",
"g2p/tests/public",
"g2p/tests/public/data",
]
[tool.pylint.messages_control]
# This is TOO LONG but the code is that way for the moment
max-line-length = 120
good-names = [
# We use single letter e for exception, f for file handles
"e", "f",
]
disable = [
# We do this to speed loading time, sorry pylint but not sorry
"import-outside-toplevel",
# We use isort for sorting our imports, so nevermind what pylint thinks
"wrong-import-order",
# I find the "unnecessary" else makes code more readable
"no-else-return",
]