-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
341 lines (311 loc) · 10.9 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
[project]
name = "strawchemy"
version = "0.3.0"
description = "Generate GraphQL API from SQLAlchemy models"
readme = "README.md"
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: Web Environment",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python",
"Topic :: Software Development",
"Typing :: Typed",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Topic :: Database",
"Topic :: Database :: Database Engines/Servers",
]
requires-python = ">=3.9"
dependencies = ["sqlalchemy", "pydantic", "strawberry-graphql"]
keywords = ["sqlalchemy", "strawberry", "graphql", "SQL"]
license = { text = "MIT" }
[project.urls]
Changelog = "https://github.com/gazorby/strawchemy/blob/main/CHANGELOG.md"
Documentation = "https://github.com/gazorby/strawchemy"
Homepage = "https://github.com/gazorby/strawchemy"
Issues = "https://github.com/gazorby/strawchemy/issues"
Repository = "https://github.com/gazorby/strawchemy"
[project.optional-dependencies]
geo = ["GeoAlchemy2", "shapely", "geojson-pydantic"]
[dependency-groups]
build = ["bump-my-version", "git-cliff"]
dev = [
{ include-group = "build" },
{ include-group = "test" },
{ include-group = "lint" },
{ include-group = "doc" },
]
lint = ["pyright", "ruff", "vulture"]
doc = ["git-cliff>=2.6.1"]
test = [
"nox[uv]",
"pytest",
"pytest-cov",
"pytest-asyncio>=0.24",
"pytest-pretty",
"pytest-xdist",
]
[tool.bumpversion]
allow_dirty = true
commit = true
commit_args = "--no-verify"
current_version = "0.3.0"
ignore_missing_files = false
ignore_missing_version = false
message = "build(release): bump to v{new_version}"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
regex = false
replace = "{new_version}"
search = "{current_version}"
serialize = ["{major}.{minor}.{patch}"]
sign_tags = false
tag = true
tag_message = "build(release): v{new_version}"
tag_name = "v{new_version}"
[[tool.bumpversion.files]]
filename = "pyproject.toml"
replace = 'version = "{new_version}"'
search = 'version = "{current_version}"'
[[tool.bumpversion.files]]
filename = "uv.lock"
replace = """
name = "strawchemy"
version = "{new_version}"
"""
search = """
name = "strawchemy"
version = "{current_version}"
"""
[tool.uv]
default-groups = ["test", "lint"]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["src/strawchemy"]
[tool.pytest.ini_options]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
testpaths = ["tests"]
[tool.pyright]
venv = ".venv"
exclude = [
"**/__pycache__",
"**/.hypothesis",
"**/.mypy_cache",
"**/.pytest_cache",
"**/.ruff_cache",
"**/.venv",
"**/.tox",
"**/.nox",
"**/build",
"**/dist",
"**/node_modules",
"**/cdk.out",
"**/alembic/versions",
]
verboseOutput = true
pythonVersion = "3.12"
typeCheckingMode = "strict"
reportUnknownMemberType = false
reportMissingTypeStubs = false
reportUnknownArgumentType = false
reportUnknownVariableType = false
reportPrivateUsage = false
reportUnnecessaryTypeIgnoreComment = true
reportImplicitOverride = true
reportPropertyTypeMismatch = true
reportShadowedImports = true
[tool.ruff]
line-length = 120
fix = true
target-version = "py311"
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".tox",
".pants.d",
".ruff_cache",
".svn",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"tests/codegen/snapshots",
"alembic/* ",
]
src = ["src/strawchemy"]
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"A005", # flake8-builtins - module {name} shadows a Python standard-library module
"D100", # pydocstyle - missing docstring in public module
"D101", # pydocstyle - missing docstring in public class
"D102", # pydocstyle - missing docstring in public method
"D103", # pydocstyle - missing docstring in public function
"D104", # pydocstyle - missing docstring in public package
"D105", # pydocstyle - missing docstring in magic method
"D106", # pydocstyle - missing docstring in public nested class
"D107", # pydocstyle - missing docstring in __init__
"E501", # pycodestyle - line too long, handled by ruff format
"PLR0913", # pylint - too many arguments
"ARG002", # flake8-unused-argument - unused arguments
"COM812", # flake8-commas - Checks for the absence of trailing commas
"S101", # flake8-bandit - Assert statements, investigate
"ANN401", # flake8-annotations - typing Any disallowed in function arguments
"FBT", # flake8-annotations - boolean trap. Try to remove this in the future
]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.lint.mccabe]
max-complexity = 12
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["TCH001", "UP037"]
[tool.unasyncd]
add_editors_note = true
ruff_fix = true
ruff_format = true
update_docstrings = true
cache = true
[tool.unasyncd.files]
"src/strawchemy/sqlalchemy/repository/_async.py" = "src/strawchemy/sqlalchemy/repository/_sync.py"
"src/strawchemy/strawberry/repository/_async.py" = "src/strawchemy/strawberry/repository/_sync.py"
[tool.unasyncd.per_file_add_replacements."src/strawchemy/sqlalchemy/repository/_async.py"]
"strawchemy.sqlalchemy._executor.AsyncQueryExecutor" = "strawchemy.sqlalchemy._executor.SyncQueryExecutor"
SQLAlchemyGraphQLAsyncRepository = "SQLAlchemyGraphQLSyncRepository"
"strawchemy.sqlalchemy.typing.AnyAsyncSession" = "strawchemy.sqlalchemy.typing.AnySyncSession"
[tool.unasyncd.per_file_add_replacements."src/strawchemy/strawberry/repository/_async.py"]
"strawchemy.sqlalchemy.repository.SQLAlchemyGraphQLAsyncRepository" = "strawchemy.sqlalchemy.repository.SQLAlchemyGraphQLSyncRepository"
"strawchemy.sqlalchemy.typing.AnyAsyncSession" = "strawchemy.sqlalchemy.typing.AnySyncSession"
"strawchemy.strawberry.typing.AsyncSessionGetter" = "strawchemy.strawberry.typing.SyncSessionGetter"
StrawchemyAsyncRepository = "StrawchemySyncRepository"
[tool.git-cliff.changelog]
# template for the changelog header
header = """
# Changelog\n
All notable changes to this project will be documented in this file.\n
"""
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{%- macro remote_url() -%}
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
{%- endmacro -%}
{% macro print_commit(commit) -%}
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message | upper_first }} - \
([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
{% endmacro -%}
{% if version %}\
{% if previous.version %}\
## [{{ version | trim_start_matches(pat="v") }}]\
({{ self::remote_url() }}/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% endif %}\
{% else %}\
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits
| filter(attribute="scope")
| sort(attribute="scope") %}
{{ self::print_commit(commit=commit) }}
{%- endfor %}
{% for commit in commits %}
{%- if not commit.scope -%}
{{ self::print_commit(commit=commit) }}
{% endif -%}
{% endfor -%}
{% endfor -%}
{%- if github -%}
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
## New Contributors ❤️
{% endif %}\
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
* @{{ contributor.username }} made their first contribution
{%- if contributor.pr_number %} in \
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
{%- endif %}
{%- endfor -%}
{%- endif %}
"""
# template for the changelog footer
footer = """
<!-- generated by git-cliff -->
"""
# remove the leading and trailing s
trim = true
# postprocessors
postprocessors = [
# { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
]
# render body even when there are no releases to process
# render_always = true
# output file path
# output = "test.md"
[tool.git-cliff.git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
# Replace issue numbers
#{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"},
# Check spelling of the commit with https://github.com/crate-ci/typos
# If the spelling is incorrect, it will be automatically fixed.
#{ pattern = '.*', replace_command = 'typos --write-changes -' },
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
{ message = "^build\\(release\\): prepare for", skip = true },
{ message = "^build\\(deps.*\\)", skip = true },
{ message = "^build\\(pr\\)", skip = true },
{ message = "^build\\(pull\\)", skip = true },
{ message = "^build|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
{ message = ".*", group = "<!-- 10 -->💼 Other" },
{ body = "$^", skip = true },
]
# filter out the commits that are not matched by commit parsers
filter_commits = false
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"
[tool.git-cliff.remote.github]
owner = "gazorby"
repo = "strawchemy"
token = ""