Skip to content
Draft
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
82f8db0
update .gitignore
stankudrow May 30, 2025
8fc4799
add the ref to the Python .gitignore template
stankudrow May 30, 2025
f87e15a
add .python-version
stankudrow May 30, 2025
7cf8d43
groom the main __init__
stankudrow May 30, 2025
1002795
instruct sphinx to read pyproject.toml
stankudrow May 30, 2025
ecfcdaa
remove setup.py
stankudrow May 30, 2025
fd5c5c0
introduce pyproject.toml + uv
stankudrow May 30, 2025
eedcca2
purge the [pytest] section
stankudrow May 30, 2025
d2ab5e7
purge the __version__ module attribute
stankudrow May 30, 2025
e396f61
ruff the enum test modules
stankudrow May 30, 2025
f46065d
set line-length=79 to please flake8 (for now)
stankudrow May 30, 2025
6984863
update GH pull request template file
stankudrow May 30, 2025
8494190
update CHANGELOG -> add the PR #379 record
stankudrow May 30, 2025
d8132cb
replace a comma with a point in the .python-version
stankudrow May 30, 2025
2377f91
update the line about the docs changed
stankudrow May 30, 2025
c85e132
update GHA docs with sphinx-pyproject
stankudrow May 30, 2025
546eb19
SA>=2.0,<2.1
stankudrow Jun 1, 2025
08eb05f
remove flake8 from the PR template
stankudrow Jun 1, 2025
e7df1e6
align dependencies
Oct 31, 2025
122d43e
update alembic_table_reflection + ruff format
Oct 31, 2025
48109bb
skip json test + ruff format
Oct 31, 2025
a036a45
ruff format docs/conf.py
Oct 31, 2025
3328d15
update setup.cfg: specify non-empty password
Oct 31, 2025
103dd32
Revert "update alembic_table_reflection + ruff format"
Oct 31, 2025
b4f8421
get back the alembic table reflector
Oct 31, 2025
6583a83
add uv into the CI
Oct 31, 2025
3774381
update CI
Oct 31, 2025
daf79af
remove E501 error
Oct 31, 2025
27439a7
Revert "skip json test + ruff format"
Oct 31, 2025
8e12fb9
ruff format only soem tests
Oct 31, 2025
0f1b7eb
ruff format ch-sa/__init__.py
Oct 31, 2025
1e679e5
disable file linting (TEMPORARILY, TO BE UNCOMMENTED IN NEXT PRs)
Oct 31, 2025
3706f36
add uv into the SA-version.yaml
Oct 31, 2025
e6c2bbb
update the _alembic_reflect_table (not with the solution from #369)
Nov 1, 2025
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
18 changes: 8 additions & 10 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<!--
Link to relevant issues or previous PRs, one per line. Use "fixes" to
automatically close an issue.
Link to relevant issue(s) or previous PR(s), one per line. Use "fixes" to automatically close the related issue.
-->

- fixes #<issue number>

<!--
Ensure each step in CONTRIBUTING.rst is complete by adding an "x" to
each box below.
Ensure each step in the "CONTRIBUTING.rst" file is completed by adding an "x" inside each box below.

If only docs were changed, these aren't relevant and can be removed.
If only docs are changed, the checklist below may be removed.
-->

Checklist:

- [ ] Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
- [ ] Add or update relevant docs, in the docs folder and in code.
- [ ] Ensure PR doesn't contain untouched code reformatting: spaces, etc.
- [ ] Run `flake8` and fix issues.
- [ ] Run `pytest` no tests failed. See https://clickhouse-sqlalchemy.readthedocs.io/en/latest/development.html.
- [ ] Add tests demonstrating the correct behavior of the change. All tests should pass.
- [ ] Add/Update relevant docs in the code and in the `docs` directory.
- [ ] Ensure the PR doesn't contain the code non-conformant with project formatting and linting rules.
- [ ] Run `flake8`/`ruff` and fix issues.
Comment thread
stankudrow marked this conversation as resolved.
Outdated
- [ ] Run `pytest` no tests failed. See the [development](https://clickhouse-sqlalchemy.readthedocs.io/en/latest/development.html) section.
79 changes: 50 additions & 29 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# https://github.com/github/gitignore/blob/main/Python.gitignore

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
.idea

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
Expand All @@ -21,6 +21,8 @@ lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
Expand All @@ -38,56 +40,75 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# celery beat schedule file
celerybeat-schedule
# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# uv.lock

# dotenv
.env
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# virtualenv
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

# Spyder project settings
.spyderproject
# Visual Studio Code
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
# and can be added to the global gitignore or merged into this file. However, if you prefer,
# you could uncomment the following to ignore the enitre vscode folder
.vscode/

# Rope project settings
.ropeproject
# Ruff stuff:
.ruff_cache/

# PyCharm project settings
.idea/
# PyPI configuration file
.pypirc
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.7.9
Comment thread
stankudrow marked this conversation as resolved.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@

## [Unreleased]

- Introduce the `pyproject.toml` with [`uv`](https://docs.astral.sh/uv/) project manager. Pull request [#379](https://github.com/xzkostyan/clickhouse-sqlalchemy/pull/379) by [stankudrow](https://github.com/stankudrow). Solves the issue [#345](https://github.com/xzkostyan/clickhouse-sqlalchemy/issues/345). Special thanks to [Daniil Anichin](https://github.com/DaniilAnichin). Features:
- update the ".gitignore" file
- add the "pyproject.toml" file
- backend the project the the uv manager (the uv.lock file added)
- remove the "setup.py" file
- move from the dynamic versioning in favour of an explicit value in the "pyproject.toml" file
- add the `sphinx-pyproject` dependency for parsing metadata from the "pyproject.toml" file

## [0.3.2] - 2024-06-12

### Added

- ``quantile`` and ``quantileIf`` functions. Pull request [#303](https://github.com/xzkostyan/clickhouse-sqlalchemy/pull/303) by [aronbierbaum](https://github.com/aronbierbaum).
- ``AggregateFunction`` and ``SimpleAggregateFunction`` aggregate types. Pull request [#297](https://github.com/xzkostyan/clickhouse-sqlalchemy/pull/297) by [aronbierbaum](https://github.com/aronbierbaum).
- Date32 type. Pull request [#307](https://github.com/xzkostyan/clickhouse-sqlalchemy/pull/307) by [BTheunissen](https://github.com/BTheunissen). Solves issue [#302](https://github.com/xzkostyan/clickhouse-sqlalchemy/issues/302).

### Fixed

- Broken nested Map types. Pull request [#315](https://github.com/xzkostyan/clickhouse-sqlalchemy/pull/315) by [aksenof](https://github.com/aksenof). Solves issue [#314](https://github.com/xzkostyan/clickhouse-sqlalchemy/issues/314).

## [0.3.1] - 2024-03-14
Expand Down
13 changes: 5 additions & 8 deletions clickhouse_sqlalchemy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
from .orm.session import make_session
from .sql import Table, MaterializedView, select


VERSION = (0, 3, 2)
__version__ = '.'.join(str(x) for x in VERSION)
Comment on lines -7 to -8

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I have not found an easier and cheaper way for uv to use dynamic versioning.

This solution - uv-dynamic-versioning - aims to retrieve data from a VCS.

I tried this solution - setuptools-scm - yet it didn't work (an unexpected version_file param or smth).

So, if you can find a better solution which allows the uv manager to support dynamic versioning in a cheap and an easy way, feel free to coautor and propose changes and even commits.



__all__ = (
'get_declarative_base',
'make_session',
'Table', 'MaterializedView', 'select'
"MaterializedView",
"Table",
"get_declarative_base",
"make_session",
"select"
)
14 changes: 5 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,14 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))

from clickhouse_sqlalchemy import __version__, VERSION
# https://github.com/sphinx-toolbox/sphinx-pyproject
from sphinx_pyproject import SphinxConfig
Comment thread
stankudrow marked this conversation as resolved.

# -- Project information -----------------------------------------------------

project = 'clickhouse-sqlalchemy'
copyright = '2017-2022, clickhouse-sqlalchemy authors'
author = 'clickhouse-sqlalchemy authors'

# The short X.Y version
version = '.'.join(str(x) for x in VERSION[:2])
# The full version, including alpha/beta/rc tags
release = __version__
config = SphinxConfig("../pyproject.toml", globalns=globals())
author = config.author
project = config.name


# -- General configuration ---------------------------------------------------
Expand Down
136 changes: 136 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
name = "clickhouse-sqlalchemy"
version = "0.3.2"
description = "SQLAlchemy dialect for ClickHouse"
authors = [
{name = "Konstantin Lebedev", email = "kostyan.lebedev@gmail.com"},
]
readme = "README.md"
license = {text = "MIT"}
requires-python = ">=3.7"
keywords = ["clickhouse", "sqlalchemy", "orm", "dialect"]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: SQL",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
Comment thread
stankudrow marked this conversation as resolved.
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Database",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"asynch>=0.2.2,!=0.2.4,!=0.2.5,<0.4.0",
"clickhouse-driver>=0.2.9",
"requests>=2.31.0",
"sqlalchemy>=1.4",
Comment thread
stankudrow marked this conversation as resolved.
Outdated
]

[project.urls]
Homepage = "https://github.com/xzkostyan/clickhouse-sqlalchemy"
Documentation = "https://clickhouse-sqlalchemy.readthedocs.io/en/latest/"
Repository = "https://github.com/xzkostyan/clickhouse-sqlalchemy"
Issues = "https://github.com/fastapi/fastapi/issues"
Comment thread
stankudrow marked this conversation as resolved.
Outdated
Changelog = "https://github.com/xzkostyan/clickhouse-sqlalchemy/blob/master/CHANGELOG.md"
PyPI = "https://pypi.org/project/clickhouse-sqlalchemy/"

[project.entry-points."sqlalchemy.dialects"]
"clickhouse" = "clickhouse_sqlalchemy.drivers.http.base:ClickHouseDialect_http"
"clickhouse.asynch" = "clickhouse_sqlalchemy.drivers.asynch.base:ClickHouseDialect_asynch"
"clickhouse.http" = "clickhouse_sqlalchemy.drivers.http.base:ClickHouseDialect_http"
"clickhouse.native" = "clickhouse_sqlalchemy.drivers.native.base:ClickHouseDialect_native"
Comment thread
stankudrow marked this conversation as resolved.

[dependency-groups]
docs = [
"sphinx>=5.3.0",
# https://github.com/sphinx-toolbox/sphinx-pyproject
"sphinx-pyproject>=0.3.0",
]
lint = [
"mypy>=1.4.1",
"ruff>=0.11.12",
]
test = [
"alembic>=1.12.1",
"parameterized>=0.9.0",
"pytest>=7.4.4",
"pytest-asyncio>=0.21.2",
"responses>=0.23.3",
]

[tool.setuptools]
include-package-data = false

[tool.setuptools.packages.find]
include = ["clickhouse_sqlalchemy"]

[tool.pytest.ini_options]
minversion = "7.4"
addopts = [
"--maxfail=1",
"--strict-config",
"--strict-markers",
"--ignore=docs",
]
xfail_strict = true
testpaths = ["tests"]
asyncio_mode = "strict"

[tool.ruff]
line-length = 79
Comment thread
stankudrow marked this conversation as resolved.
respect-gitignore = true
target-version = "py37"

[tool.ruff.lint]
select = [
# "A", # flake8-builtins
# "ANN", # flake8-annotations
# "ARG", # flake8-unused-arguments
"ASYNC", # flake8-async
# "B", # flake8-bugbear
# "C4", # flake8-comprehensions
# # "D", # pydocstyle
# "DTZ", # flake8-datetimez
"E", # pycodestyle errors
"F", # pyflakes
# "FBT", # flake8-boolean-trap
# "I", # isort
"ICN", # flake8-import-conventions
# "ISC", # flake8-implicit-str-concat
"PERF", # perflint
# "PIE", # flake8-pie
# "PLE", # pylint errors
# "PLR", # pylint refactor
# "PLW", # pylint warning
# "PT", # flake8-pytest-style
"PYI", # flake8-pyi
# "Q", # flake8-quotes
# "RET", # flake8-return
# "RSE", # flake8-raise
# # "SIM", # flake8-simplify
"T10", # flake8-debugger
"T20", # flake8-print
# "TC", # flake8-type-checking
# "TID", # flake8-tidy-imports
# "TRY", # tryceratops
# "UP", # pyupgrade
"W", # pycodestyle warnings
]
fixable = ["I"]
4 changes: 0 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,3 @@ level=ERROR

[metadata]
license_file = LICENSE

[tool:pytest]
asyncio_mode=strict

Loading