Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f931ed2
chore: bump version to 1.0.0.dev14
vistart May 16, 2026
9f117b5
feat: split returning support into DML-specific flags for PostgreSQL …
vistart May 16, 2026
5b05ec7
feat(dialect): require version adaptation before using Postgres diale…
vistart May 17, 2026
d6d796b
refactor(cli): rename named-query to named-expression, add procedure-…
vistart May 22, 2026
fdb7fb3
fix(postgres): fix test file indentation and add format_identifier se…
vistart May 23, 2026
835c468
fix(postgres): remove dead _quote_identifier, fix _format_partition_v…
vistart May 23, 2026
4b19847
fix(postgres): apply security fixes and dialect improvements
vistart May 23, 2026
e338aa9
ci: upgrade actions/checkout from v4 to v6
vistart May 23, 2026
d871e85
chore: add .gitattributes to enforce LF line endings
vistart May 23, 2026
13bbe70
test(query): add bridge for unicode/emoji/injection round-trip tests
vistart May 24, 2026
caa363f
ci: upgrade testsuite source to git+https at release/v1.0.0.dev14
vistart May 24, 2026
0fe59cb
fix(backend): preserve exception chain and add credential warning
vistart May 24, 2026
acbf067
fix(test): register PostgresJSONBAdapter for JsonUser JSON fields
vistart May 24, 2026
08e7e9f
fix(adapters): inherit BaseSQLTypeAdapter to properly handle Optional…
vistart May 24, 2026
5668112
test: add Pydantic native validation coverage
vistart May 28, 2026
3c51b2c
ci: fix PostgreSQL benchmark coverage
vistart May 28, 2026
a314c49
test: update PostgreSQL benchmarks and testsuite dependency
vistart May 29, 2026
f000cf7
ci: install core package from PyPI
vistart May 29, 2026
e7029d2
test: improve CLI and backend initialization coverage
vistart May 29, 2026
a824b41
docs: update CHANGELOG for v1.0.0.dev14
vistart May 29, 2026
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
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* text=auto eol=lf
*.py text eol=lf
*.md text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
*.toml text eol=lf
*.cfg text eol=lf
*.ini text eol=lf
*.sh text eol=lf
*.bat text eol=crlf
*.ps1 text eol=lf
2 changes: 1 addition & 1 deletion .github/workflows/changelog-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
check-fragment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
with:
fetch-depth: 0

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ jobs:

steps:
- name: Check out the repository
uses: actions/checkout@v3
uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: "3.13"

Expand Down Expand Up @@ -78,10 +78,10 @@ jobs:

steps:
- name: Check out the repository
uses: actions/checkout@v3
uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: "3.13"

Expand Down
194 changes: 187 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,181 @@ permissions:
contents: read

jobs:
benchmark-python-314-postgres-18:
name: Run benchmarks with Python 3.14 / postgres 18
runs-on: ubuntu-latest
permissions:
contents: read

services:
postgres:
image: postgres:18
env:
POSTGRES_DB: test_db
POSTGRES_USER: root
POSTGRES_PASSWORD: password
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres-exts:
image: vistart/postgres-exts:18
env:
POSTGRES_DB: test_db
POSTGRES_USER: root
POSTGRES_PASSWORD: password
ports:
- 5433:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Check out the repository
uses: actions/checkout@v6

- name: Set up Python 3.14
uses: actions/setup-python@v6
with:
python-version: "3.14"

- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt

- name: Install activerecord and testsuite
run: |
pip install rhosocial-activerecord==1.0.0.dev27
pip install rhosocial-activerecord-testsuite==1.0.0.dev14

- name: Create postgres scenario config
run: |
cat > postgres_scenarios.yaml << EOF
scenarios:
postgres_default:
host: 127.0.0.1
port: 5432
database: test_db
username: root
password: password
postgres_exts:
host: 127.0.0.1
port: 5433
database: test_db
username: root
password: password
EOF
echo "POSTGRES_SCENARIOS_CONFIG_PATH=$(pwd)/postgres_scenarios.yaml" >> $GITHUB_ENV

- name: Install postgres client for health check
run: |
sudo apt-get update
sudo apt-get install --yes postgresql-client

- name: Wait for postgres service
run: |
until pg_isready -h 127.0.0.1 -p 5432 -U root; do
echo "Waiting for postgres..."
sleep 2
done
echo "postgres is ready!"
until pg_isready -h 127.0.0.1 -p 5433 -U root; do
echo "Waiting for postgres-exts..."
sleep 2
done
echo "postgres-exts is ready!"

- name: Run benchmark suite
run: |
set -o pipefail
export PYTHONPATH=src:tests
TESTSUITE_DIR=$(python - <<'PY'
import pathlib
import rhosocial.activerecord.testsuite as testsuite

print(pathlib.Path(testsuite.__file__).parent)
PY
)
python -m pytest \
--rootdir=. \
--confcutdir=. \
"$TESTSUITE_DIR/benchmark/crud" \
"$TESTSUITE_DIR/benchmark/query" \
"$TESTSUITE_DIR/benchmark/transaction" \
"$TESTSUITE_DIR/benchmark/mixin" \
-m benchmark \
--benchmark-size=small \
--benchmark-sort=mean \
--tb=short | tee benchmark-output.txt
python -m pytest \
--rootdir=. \
--confcutdir=. \
tests/benchmark/backend \
-m benchmark \
--benchmark-size=small \
--benchmark-sort=mean \
--tb=short | tee -a benchmark-output.txt

- name: Run FastAPI benchmark suite
run: |
set -o pipefail
export PYTHONPATH=src:tests
TESTSUITE_DIR=$(python - <<'PY'
import pathlib
import rhosocial.activerecord.testsuite as testsuite

print(pathlib.Path(testsuite.__file__).parent)
PY
)
python -m pytest \
--rootdir=. \
--confcutdir=. \
"$TESTSUITE_DIR/benchmark/fastapi" \
-m benchmark_fastapi \
--benchmark-size=small \
--benchmark-sort=mean \
--tb=short | tee fastapi-benchmark-output.txt

- name: Write benchmark conclusion
if: always()
run: |
{
echo "## Python 3.14 / postgres 18 Benchmark Conclusion"
echo
echo "- Python: 3.14"
echo "- postgres: 18"
echo "- Scope: testsuite generic benchmarks + PostgreSQL backend direct benchmarks"
echo "- Size: small"
echo "- Result: benchmark job fails only when benchmark execution or correctness checks fail."
echo
echo '```text'
grep -A 120 "benchmark:" benchmark-output.txt || cat benchmark-output.txt
echo '```'
} >> "$GITHUB_STEP_SUMMARY"

- name: Write FastAPI benchmark conclusion
if: always()
run: |
{
echo "## Python 3.14 / postgres 18 FastAPI Benchmark Conclusion"
echo
echo "- Python: 3.14"
echo "- postgres: 18"
echo "- Scope: testsuite FastAPI database benchmarks"
echo "- Size: small"
echo "- Result: benchmark job fails only when FastAPI benchmark execution or correctness checks fail."
echo
echo '```text'
grep -A 120 "benchmark:" fastapi-benchmark-output.txt || cat fastapi-benchmark-output.txt
echo '```'
} >> "$GITHUB_STEP_SUMMARY"

test:
name: Python ${{ matrix.python-version }} / postgres ${{ matrix.postgres-version }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -65,22 +240,27 @@ jobs:

steps:
- name: Check out the repository
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
if [ "${{ matrix.python-version }}" == "3.8" ]; then
pip install -r requirements-3.8.txt
pip install -r requirements-dev-3.8.txt
else
pip install -r requirements.txt
pip install -r requirements-dev.txt
fi

- name: Install activerecord and testsuite from PyPI
- name: Install activerecord and testsuite
run: |
pip install rhosocial-activerecord==1.0.0.dev26
pip install rhosocial-activerecord-testsuite==1.0.0.dev13
pip install rhosocial-activerecord==1.0.0.dev27
pip install rhosocial-activerecord-testsuite==1.0.0.dev14

- name: Create postgres scenario config
run: |
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [v1.0.0.dev14] - 2026-05-30

### Changed

- Changed PostgresDialect to default to version=None instead of fixed version, requiring introspect_and_adapt() or explicit version before version-dependent features can be used. ([#37](https://github.com/rhosocial/python-activerecord-postgres/issues/37))


## [v1.0.0.dev13] - 2026-05-15

### Security
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/chapter_12_named_procedure/diagram_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
2. 执行过程后生成实例图
3. 将图嵌入文档
"""
from rhosocial.activerecord.backend.named_query import (
from rhosocial.activerecord.backend.named_expression import (
Procedure,
ProcedureContext,
ProcedureRunner,
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/chapter_12_named_procedure/order_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- 静态图和实例图生成
- PostgreSQL 特有的 NOWAIT, RETURNING 等特性
"""
from rhosocial.activerecord.backend.named_query import (
from rhosocial.activerecord.backend.named_expression import (
Procedure,
ProcedureContext,
ParallelStep,
Expand Down Expand Up @@ -192,7 +192,7 @@ async def run(self, ctx: ProcedureContext) -> None:


if __name__ == "__main__":
from rhosocial.activerecord.backend.named_query import ProcedureDiagram
from rhosocial.activerecord.backend.named_expression import ProcedureDiagram

print("=== 静态流程图 ===")
print(OrderProcessingProcedure.static_diagram("flowchart"))
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "rhosocial-activerecord-postgres"
version = "1.0.0.dev13"
version = "1.0.0.dev14"
description = "postgres backend implementation for rhosocial-activerecord, providing a robust and optimized postgres database support."
readme = "README.md"
license = { file = "LICENSE" }
Expand Down Expand Up @@ -49,6 +49,8 @@ test = [
"pytest>=7.0.0",
"coverage>=7.0.0",
"pytest-mock>=3.0.0",
"fastapi>=0.110",
"httpx>=0.27",
]
dev = [
"black>=23.0.0",
Expand Down Expand Up @@ -86,6 +88,7 @@ markers = [
"requires_protocol: marks tests requiring specific backend protocol support",
"requires_functions: marks tests requiring specific database functions",
"requires_inner_join: marks tests requiring INNER JOIN support",
"benchmark_fastapi: marks FastAPI benchmark tests",
]

[tool.coverage.run]
Expand Down
2 changes: 2 additions & 0 deletions requirements-3.8.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
psycopg[binary]
rhosocial-activerecord
35 changes: 35 additions & 0 deletions requirements-dev-3.8.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# requirements-dev-3.8.txt
# Testing framework for unit and integration tests
# Version ~=8.3.5 is the latest pytest version compatible with Python 3.8
pytest~=8.3.5
pytest-asyncio

# Pytest plugin for performance benchmarking
# Provides benchmark fixtures and marker registration used during collection
pytest-benchmark

# Pytest plugin for mocking
pytest-mock

# Async SQLite support and async file operations for tests
aiosqlite>=0.19.0
aiofiles>=23.0.0

# Parallel test execution plugin for pytest
pytest-xdist

# Code coverage measurement tool and pytest integration
coverage
pytest-cov>=4.0.0

# Pydantic with email validation support
pydantic[email]

# YAML file processing library
pyyaml

# Rich terminal output library
rich

# Test timeout plugin for long-running database integration tests
pytest-timeout
Loading
Loading