Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .github/workflows/cd.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
timeout-minutes: 30
steps:
- name: Check out repository
Expand All @@ -113,7 +113,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.12"]
python-version: ["3.12", "3.13"]
timeout-minutes: 30
steps:
- name: Check out repository
Expand All @@ -136,7 +136,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.11", "3.12"]
python-version: ["3.11", "3.12", "3.13"]
timeout-minutes: 30
steps:
- name: Check out repository
Expand Down
Empty file added docs/__init__.py
Empty file.
128 changes: 80 additions & 48 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ maintainers = [{ name = "Litestar Developers", email = "[email protected]" }]
name = "sqlspec"
readme = "README.md"
requires-python = ">=3.9, <4.0"
version = "0.6.0"
version = "0.7.0"

[project.optional-dependencies]
adbc = ["adbc-driver-manager", "pyarrow"]
Expand All @@ -21,6 +21,7 @@ fastapi = ["fastapi"]
flask = ["flask"]
litestar = ["litestar"]
msgspec = ["msgspec"]
nanoid = ["fastnanoid>=0.4.1"]
oracledb = ["oracledb"]
orjson = ["orjson"]
performance = ["sqlglot[rs]"]
Expand All @@ -29,20 +30,22 @@ pydantic = ["pydantic", "pydantic-extra-types"]
pymssql = ["pymssql"]
pymysql = ["pymysql"]
spanner = ["google-cloud-spanner"]
uuid = ["uuid-utils>=0.6.1"]

[dependency-groups]
build = ["bump-my-version"]
dev = [
"adbc-driver-sqlite",
"adbc-driver-postgresql",
"adbc-driver-flightsql",
{ include-group = "lint" },
{ include-group = "doc" },
{ include-group = "test" },
{ include-group = "build" },
]
doc = [
"auto-pytabs[sphinx]>=0.5.0",
"git-cliff>=2.6.1",
"litestar-sphinx-theme @ git+https://github.com/litestar-org/litestar-sphinx-theme.git@v3",
"shibuya",
"sphinx>=7.0.0; python_version <= \"3.9\"",
"sphinx>=8.0.0; python_version >= \"3.10\"",
"sphinx-autobuild>=2021.3.14",
Expand All @@ -53,6 +56,8 @@ doc = [
"sphinx-paramlinks>=0.6.0",
"sphinx-togglebutton>=0.3.2",
"sphinx-toolbox>=3.8.1",
"myst-parser",
"sphinx-autodoc-typehints",
]
lint = [
"mypy>=1.13.0",
Expand All @@ -76,7 +81,6 @@ test = [
"pytest-xdist>=3.6.1",
]


[build-system]
build-backend = "hatchling.build"
requires = ["hatchling"]
Expand All @@ -93,6 +97,40 @@ include = ["NOTICE"]
packages = ["sqlspec"]


[tool.bumpversion]
allow_dirty = true
commit = false
commit_args = "--no-verify"
current_version = "0.33.1"
ignore_missing_files = false
ignore_missing_version = false
message = "chore(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 = false
tag_message = "chore(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 = "advanced-alchemy"
version = "{new_version}"
"""
search = """
name = "advanced-alchemy"
version = "{current_version}"
"""

[tool.codespell]
ignore-words-list = "te"
skip = 'uv.lock'
Expand All @@ -104,6 +142,7 @@ disable_warnings = ["no-data-collected", "module-not-measured", "module-not-impo
omit = ["*/tests/*"]
parallel = true
plugins = ["covdefaults"]
relative_files = true
source = ["sqlspec"]

[tool.coverage.report]
Expand Down Expand Up @@ -132,6 +171,17 @@ exclude_lines = [
addopts = "-ra -q --doctest-glob='*.md' --strict-markers --strict-config"
asyncio_default_fixture_loop_scope = "function"
asyncio_mode = "auto"
filterwarnings = [
"ignore::DeprecationWarning:pkg_resources.*",
"ignore:pkg_resources is deprecated as an API:DeprecationWarning",
"ignore::DeprecationWarning:pkg_resources",
"ignore::DeprecationWarning:google.rpc",
"ignore::DeprecationWarning:google.gcloud",
"ignore::DeprecationWarning:google.iam",
"ignore::DeprecationWarning:google",
"ignore::DeprecationWarning:websockets.connection",
"ignore::DeprecationWarning:websockets.legacy",
]
testpaths = ["tests"]
xfail_strict = true

Expand Down Expand Up @@ -177,46 +227,19 @@ reportUnnecessaryTypeIgnoreComments = true
strict-imports = false

[tool.ruff]
lint.select = [
"A", # flake8-builtins
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"C90", # mccabe
"D", # pydocstyle
"DJ", # flake8-django
"DTZ", # flake8-datetimez
"E", # pycodestyle errors
"ERA", # eradicate
"EXE", # flake8-executable
"F", # pyflakes
"G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"N", # pep8-naming
"PIE", # flake8-pie
"PLC", # pylint - convention
"PLE", # pylint - error
"PLW", # pylint - warning
"PTH", # flake8-use-pathlib
"Q", # flake8-quotes
"RET", # flake8-return
"RUF", # Ruff-specific rules
"S", # flake8-bandit
"SIM", # flake8-simplify
"T10", # flake8-debugger
"T20", # flake8-print
"TC", # flake8-type-checking
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"W", # pycodestyle - warning
"YTT", # flake8-2020
exclude = [".venv", "node_modules"]
line-length = 120
src = ["sqlspec", "tests", "docs/examples", "tools"]
target-version = "py39"

]
[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = 60

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

[tool.ruff.lint.pydocstyle]
convention = "google"
Expand Down Expand Up @@ -278,10 +308,12 @@ known-first-party = ["sqlspec", "tests"]
"SIM",
"TC",
"TRY",
"PT012",
"INP001",
]
"tools/**/*.*" = ["D", "ARG", "EM", "TRY", "G", "FBT", "S603", "F811", "PLW0127"]
"tools/**/*.*" = ["D", "ARG", "EM", "TRY", "G", "FBT", "S603", "F811", "PLW0127", "PLR0911"]
"tools/prepare_release.py" = ["S603", "S607"]

[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = 88
[tool.ruff.lint.flake8-tidy-imports]
# Disallow all relative imports.
ban-relative-imports = "all"
4 changes: 3 additions & 1 deletion sqlspec/_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ def encode_json(data: Any) -> str: # pragma: no cover

def encode_json(data: Any) -> str: # pragma: no cover
return _encode_json(
data, default=_type_to_string, option=OPT_SERIALIZE_NUMPY | OPT_NAIVE_UTC | OPT_SERIALIZE_UUID
data,
default=_type_to_string,
option=OPT_SERIALIZE_NUMPY | OPT_NAIVE_UTC | OPT_SERIALIZE_UUID,
).decode("utf-8")

except ImportError:
Expand Down
3 changes: 0 additions & 3 deletions sqlspec/adapters/adbc/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ class AdbcDatabaseConfig(NoPoolSyncConfig["Connection"]):
ADBC Driver Manager.([1](https://arrow.apache.org/adbc/current/python/api/adbc_driver_manager.html))
"""

__supports_connection_pooling = False
__is_async = False

uri: "Union[str, EmptyType]" = Empty
"""Database URI"""
driver_name: "Union[str, EmptyType]" = Empty
Expand Down
2 changes: 1 addition & 1 deletion sqlspec/adapters/aiosqlite/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .config import AiosqliteConfig
from sqlspec.adapters.aiosqlite.config import AiosqliteConfig

__all__ = ("AiosqliteConfig",)
2 changes: 1 addition & 1 deletion sqlspec/adapters/asyncmy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .config import AsyncMyConfig, AsyncmyPoolConfig
from sqlspec.adapters.asyncmy.config import AsyncMyConfig, AsyncmyPoolConfig

__all__ = ("AsyncMyConfig", "AsyncmyPoolConfig")
10 changes: 6 additions & 4 deletions sqlspec/adapters/asyncmy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class AsyncmyPoolConfig(GenericPoolConfig):
init_command: "Union[str, EmptyType]" = Empty
"""Initial SQL statement to execute once connected."""

cursor_class: "Union[type[Cursor], type[DictCursor], EmptyType]" = Empty
cursor_class: "Union[type[Union[Cursor, DictCursor]], EmptyType]" = Empty
"""Custom cursor class to use."""

minsize: "Union[int, EmptyType]" = Empty
Expand Down Expand Up @@ -125,6 +125,9 @@ def pool_config_dict(self) -> "dict[str, Any]":

Returns:
A string keyed dict of config kwargs for the Asyncmy create_pool function.

Raises:
ImproperConfigurationError: If the pool configuration is not provided.
"""
if self.pool_config:
return dataclass_to_dict(self.pool_config, exclude_empty=True, convert_nested=False)
Expand All @@ -151,10 +154,11 @@ async def create_pool(self) -> "Pool": # pyright: ignore[reportUnknownParameter
import asyncmy # pyright: ignore[reportMissingTypeStubs]

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

async def provide_pool(self, *args: "Any", **kwargs: "Any") -> "Pool": # pyright: ignore[reportUnknownParameterType]
"""Create a pool instance.
Expand All @@ -171,8 +175,6 @@ async def provide_connection(self, *args: "Any", **kwargs: "Any") -> "AsyncGener
Yields:
An Asyncmy connection instance.

Raises:
ImproperConfigurationError: If the connection could not be established.
"""
pool = await self.provide_pool(*args, **kwargs) # pyright: ignore[reportUnknownVariableType,reportUnknownMemberType]
async with pool.acquire() as connection: # pyright: ignore[reportUnknownMemberType,reportUnknownVariableType]
Expand Down
Loading