Skip to content

Commit 7eb2f0a

Browse files
authored
chore(ci): package improvements (#18)
This release includes several improvements and updates: - Added support for `fastnanoid` and `uuid-utils` dependencies - Updated Python version support to include Python 3.13 in CI/CD workflows - Refactored code to improve type hints and code quality - Updated Ruff linter configuration - Added `bump-my-version` for release management - Updated documentation dependencies - Simplified import statements and type checking
1 parent 55f7a1d commit 7eb2f0a

File tree

22 files changed

+509
-202
lines changed

22 files changed

+509
-202
lines changed

.github/workflows/cd.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
strategy:
9191
fail-fast: true
9292
matrix:
93-
python-version: ["3.9", "3.10", "3.11", "3.12"]
93+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
9494
timeout-minutes: 30
9595
steps:
9696
- name: Check out repository
@@ -113,7 +113,7 @@ jobs:
113113
strategy:
114114
fail-fast: true
115115
matrix:
116-
python-version: ["3.12"]
116+
python-version: ["3.12", "3.13"]
117117
timeout-minutes: 30
118118
steps:
119119
- name: Check out repository
@@ -136,7 +136,7 @@ jobs:
136136
strategy:
137137
fail-fast: true
138138
matrix:
139-
python-version: ["3.11", "3.12"]
139+
python-version: ["3.11", "3.12", "3.13"]
140140
timeout-minutes: 30
141141
steps:
142142
- name: Check out repository

docs/__init__.py

Whitespace-only changes.

pyproject.toml

Lines changed: 80 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ maintainers = [{ name = "Litestar Developers", email = "hello@litestar.dev" }]
77
name = "sqlspec"
88
readme = "README.md"
99
requires-python = ">=3.9, <4.0"
10-
version = "0.6.0"
10+
version = "0.7.0"
1111

1212
[project.optional-dependencies]
1313
adbc = ["adbc-driver-manager", "pyarrow"]
@@ -21,6 +21,7 @@ fastapi = ["fastapi"]
2121
flask = ["flask"]
2222
litestar = ["litestar"]
2323
msgspec = ["msgspec"]
24+
nanoid = ["fastnanoid>=0.4.1"]
2425
oracledb = ["oracledb"]
2526
orjson = ["orjson"]
2627
performance = ["sqlglot[rs]"]
@@ -29,20 +30,22 @@ pydantic = ["pydantic", "pydantic-extra-types"]
2930
pymssql = ["pymssql"]
3031
pymysql = ["pymysql"]
3132
spanner = ["google-cloud-spanner"]
33+
uuid = ["uuid-utils>=0.6.1"]
3234

3335
[dependency-groups]
36+
build = ["bump-my-version"]
3437
dev = [
3538
"adbc-driver-sqlite",
3639
"adbc-driver-postgresql",
3740
"adbc-driver-flightsql",
3841
{ include-group = "lint" },
3942
{ include-group = "doc" },
4043
{ include-group = "test" },
44+
{ include-group = "build" },
4145
]
4246
doc = [
4347
"auto-pytabs[sphinx]>=0.5.0",
44-
"git-cliff>=2.6.1",
45-
"litestar-sphinx-theme @ git+https://github.com/litestar-org/litestar-sphinx-theme.git@v3",
48+
"shibuya",
4649
"sphinx>=7.0.0; python_version <= \"3.9\"",
4750
"sphinx>=8.0.0; python_version >= \"3.10\"",
4851
"sphinx-autobuild>=2021.3.14",
@@ -53,6 +56,8 @@ doc = [
5356
"sphinx-paramlinks>=0.6.0",
5457
"sphinx-togglebutton>=0.3.2",
5558
"sphinx-toolbox>=3.8.1",
59+
"myst-parser",
60+
"sphinx-autodoc-typehints",
5661
]
5762
lint = [
5863
"mypy>=1.13.0",
@@ -76,7 +81,6 @@ test = [
7681
"pytest-xdist>=3.6.1",
7782
]
7883

79-
8084
[build-system]
8185
build-backend = "hatchling.build"
8286
requires = ["hatchling"]
@@ -93,6 +97,40 @@ include = ["NOTICE"]
9397
packages = ["sqlspec"]
9498

9599

100+
[tool.bumpversion]
101+
allow_dirty = true
102+
commit = false
103+
commit_args = "--no-verify"
104+
current_version = "0.33.1"
105+
ignore_missing_files = false
106+
ignore_missing_version = false
107+
message = "chore(release): bump to v{new_version}"
108+
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
109+
regex = false
110+
replace = "{new_version}"
111+
search = "{current_version}"
112+
serialize = ["{major}.{minor}.{patch}"]
113+
sign_tags = false
114+
tag = false
115+
tag_message = "chore(release): v{new_version}"
116+
tag_name = "v{new_version}"
117+
118+
[[tool.bumpversion.files]]
119+
filename = "pyproject.toml"
120+
replace = 'version = "{new_version}"'
121+
search = 'version = "{current_version}"'
122+
123+
[[tool.bumpversion.files]]
124+
filename = "uv.lock"
125+
replace = """
126+
name = "advanced-alchemy"
127+
version = "{new_version}"
128+
"""
129+
search = """
130+
name = "advanced-alchemy"
131+
version = "{current_version}"
132+
"""
133+
96134
[tool.codespell]
97135
ignore-words-list = "te"
98136
skip = 'uv.lock'
@@ -104,6 +142,7 @@ disable_warnings = ["no-data-collected", "module-not-measured", "module-not-impo
104142
omit = ["*/tests/*"]
105143
parallel = true
106144
plugins = ["covdefaults"]
145+
relative_files = true
107146
source = ["sqlspec"]
108147

109148
[tool.coverage.report]
@@ -132,6 +171,17 @@ exclude_lines = [
132171
addopts = "-ra -q --doctest-glob='*.md' --strict-markers --strict-config"
133172
asyncio_default_fixture_loop_scope = "function"
134173
asyncio_mode = "auto"
174+
filterwarnings = [
175+
"ignore::DeprecationWarning:pkg_resources.*",
176+
"ignore:pkg_resources is deprecated as an API:DeprecationWarning",
177+
"ignore::DeprecationWarning:pkg_resources",
178+
"ignore::DeprecationWarning:google.rpc",
179+
"ignore::DeprecationWarning:google.gcloud",
180+
"ignore::DeprecationWarning:google.iam",
181+
"ignore::DeprecationWarning:google",
182+
"ignore::DeprecationWarning:websockets.connection",
183+
"ignore::DeprecationWarning:websockets.legacy",
184+
]
135185
testpaths = ["tests"]
136186
xfail_strict = true
137187

@@ -177,46 +227,19 @@ reportUnnecessaryTypeIgnoreComments = true
177227
strict-imports = false
178228

179229
[tool.ruff]
180-
lint.select = [
181-
"A", # flake8-builtins
182-
"B", # flake8-bugbear
183-
"BLE", # flake8-blind-except
184-
"C4", # flake8-comprehensions
185-
"C90", # mccabe
186-
"D", # pydocstyle
187-
"DJ", # flake8-django
188-
"DTZ", # flake8-datetimez
189-
"E", # pycodestyle errors
190-
"ERA", # eradicate
191-
"EXE", # flake8-executable
192-
"F", # pyflakes
193-
"G", # flake8-logging-format
194-
"I", # isort
195-
"ICN", # flake8-import-conventions
196-
"ISC", # flake8-implicit-str-concat
197-
"N", # pep8-naming
198-
"PIE", # flake8-pie
199-
"PLC", # pylint - convention
200-
"PLE", # pylint - error
201-
"PLW", # pylint - warning
202-
"PTH", # flake8-use-pathlib
203-
"Q", # flake8-quotes
204-
"RET", # flake8-return
205-
"RUF", # Ruff-specific rules
206-
"S", # flake8-bandit
207-
"SIM", # flake8-simplify
208-
"T10", # flake8-debugger
209-
"T20", # flake8-print
210-
"TC", # flake8-type-checking
211-
"TID", # flake8-tidy-imports
212-
"UP", # pyupgrade
213-
"W", # pycodestyle - warning
214-
"YTT", # flake8-2020
230+
exclude = [".venv", "node_modules"]
231+
line-length = 120
232+
src = ["sqlspec", "tests", "docs/examples", "tools"]
233+
target-version = "py39"
215234

216-
]
235+
[tool.ruff.format]
236+
docstring-code-format = true
237+
docstring-code-line-length = 60
217238

218-
line-length = 120
219-
lint.ignore = [
239+
[tool.ruff.lint]
240+
extend-safe-fixes = ["TC"]
241+
fixable = ["ALL"]
242+
ignore = [
220243
"A003", # flake8-builtins - class attribute {name} is shadowing a python builtin
221244
"B010", # flake8-bugbear - do not call setattr with a constant attribute value
222245
"D100", # pydocstyle - missing docstring in public module
@@ -236,9 +259,16 @@ lint.ignore = [
236259
"ISC001", # Ruff formatter incompatible
237260
"A005", # flake8 - Module `x` shadows a Python standard-library module
238261
"PLC0415", # pylint - `import` should be at the top of the file
262+
"FA100", # Add `from __future__ import annotations` to simplify
263+
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
264+
"FBT001", # Boolean-typed positional argument in function definition
265+
"FBT002", # Boolean default positional argument in function definition
266+
"PLR0913", # pylint - Too many arguments in function definition
267+
"ARG002", # Unused method argument
268+
"ARG001", # Unused function argument
269+
"CPY001", # pycodestyle - Missing Copywrite notice at the top of the file
239270
]
240-
src = ["sqlspec", "tests", "docs/examples"]
241-
target-version = "py39"
271+
select = ["ALL"]
242272

243273
[tool.ruff.lint.pydocstyle]
244274
convention = "google"
@@ -278,10 +308,12 @@ known-first-party = ["sqlspec", "tests"]
278308
"SIM",
279309
"TC",
280310
"TRY",
311+
"PT012",
312+
"INP001",
281313
]
282-
"tools/**/*.*" = ["D", "ARG", "EM", "TRY", "G", "FBT", "S603", "F811", "PLW0127"]
314+
"tools/**/*.*" = ["D", "ARG", "EM", "TRY", "G", "FBT", "S603", "F811", "PLW0127", "PLR0911"]
283315
"tools/prepare_release.py" = ["S603", "S607"]
284316

285-
[tool.ruff.format]
286-
docstring-code-format = true
287-
docstring-code-line-length = 88
317+
[tool.ruff.lint.flake8-tidy-imports]
318+
# Disallow all relative imports.
319+
ban-relative-imports = "all"

sqlspec/_serialization.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ def encode_json(data: Any) -> str: # pragma: no cover
4242

4343
def encode_json(data: Any) -> str: # pragma: no cover
4444
return _encode_json(
45-
data, default=_type_to_string, option=OPT_SERIALIZE_NUMPY | OPT_NAIVE_UTC | OPT_SERIALIZE_UUID
45+
data,
46+
default=_type_to_string,
47+
option=OPT_SERIALIZE_NUMPY | OPT_NAIVE_UTC | OPT_SERIALIZE_UUID,
4648
).decode("utf-8")
4749

4850
except ImportError:

sqlspec/adapters/adbc/config.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ class AdbcDatabaseConfig(NoPoolSyncConfig["Connection"]):
2222
ADBC Driver Manager.([1](https://arrow.apache.org/adbc/current/python/api/adbc_driver_manager.html))
2323
"""
2424

25-
__supports_connection_pooling = False
26-
__is_async = False
27-
2825
uri: "Union[str, EmptyType]" = Empty
2926
"""Database URI"""
3027
driver_name: "Union[str, EmptyType]" = Empty
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from .config import AiosqliteConfig
1+
from sqlspec.adapters.aiosqlite.config import AiosqliteConfig
22

33
__all__ = ("AiosqliteConfig",)

sqlspec/adapters/asyncmy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from .config import AsyncMyConfig, AsyncmyPoolConfig
1+
from sqlspec.adapters.asyncmy.config import AsyncMyConfig, AsyncmyPoolConfig
22

33
__all__ = ("AsyncMyConfig", "AsyncmyPoolConfig")

sqlspec/adapters/asyncmy/config.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class AsyncmyPoolConfig(GenericPoolConfig):
7878
init_command: "Union[str, EmptyType]" = Empty
7979
"""Initial SQL statement to execute once connected."""
8080

81-
cursor_class: "Union[type[Cursor], type[DictCursor], EmptyType]" = Empty
81+
cursor_class: "Union[type[Union[Cursor, DictCursor]], EmptyType]" = Empty
8282
"""Custom cursor class to use."""
8383

8484
minsize: "Union[int, EmptyType]" = Empty
@@ -125,6 +125,9 @@ def pool_config_dict(self) -> "dict[str, Any]":
125125
126126
Returns:
127127
A string keyed dict of config kwargs for the Asyncmy create_pool function.
128+
129+
Raises:
130+
ImproperConfigurationError: If the pool configuration is not provided.
128131
"""
129132
if self.pool_config:
130133
return dataclass_to_dict(self.pool_config, exclude_empty=True, convert_nested=False)
@@ -151,10 +154,11 @@ async def create_pool(self) -> "Pool": # pyright: ignore[reportUnknownParameter
151154
import asyncmy # pyright: ignore[reportMissingTypeStubs]
152155

153156
self.pool_instance = await asyncmy.create_pool(**self.pool_config_dict) # pyright: ignore[reportUnknownMemberType]
154-
return self.pool_instance # pyright: ignore[reportUnknownVariableType,reportUnknownMemberType]
155157
except Exception as e:
156158
msg = f"Could not configure the Asyncmy pool. Error: {e!s}"
157159
raise ImproperConfigurationError(msg) from e
160+
else:
161+
return self.pool_instance # pyright: ignore[reportUnknownVariableType,reportUnknownMemberType]
158162

159163
async def provide_pool(self, *args: "Any", **kwargs: "Any") -> "Pool": # pyright: ignore[reportUnknownParameterType]
160164
"""Create a pool instance.
@@ -171,8 +175,6 @@ async def provide_connection(self, *args: "Any", **kwargs: "Any") -> "AsyncGener
171175
Yields:
172176
An Asyncmy connection instance.
173177
174-
Raises:
175-
ImproperConfigurationError: If the connection could not be established.
176178
"""
177179
pool = await self.provide_pool(*args, **kwargs) # pyright: ignore[reportUnknownVariableType,reportUnknownMemberType]
178180
async with pool.acquire() as connection: # pyright: ignore[reportUnknownMemberType,reportUnknownVariableType]

0 commit comments

Comments
 (0)