0.14.0 "Claims & Columns"

This commit is contained in:
Yusur 2026-07-27 20:43:13 +02:00
parent f08af88821
commit 955d2fad48
5 changed files with 16 additions and 21 deletions

View file

@ -1,14 +1,14 @@
# Changelog # Changelog
## 0.14.0 ## 0.14.0 "Claims & Columns"
* Added `ast` module * Added `ast` module
* Deprecate `dei_args()` for problems with the typing system. The function is not going away tho * Deprecate `dei_args()` for problems with the typing system. The function is not going away tho
* Module `sqlalchemy`: * Module `sqlalchemy`:
* added `email_column()`, `ascii_column()`, `i4_column()` * added `email_column()`, `ascii_column()`, `i4_column()`, `now_column()`
* added application level checks for `match_column()` * added application level checks for `match_column()`
* Added common values for snowflake epoch in `SnowflakeEpoch` enum * Added common values for snowflake epoch in `SnowflakeEpoch` enum
* Module `bitś`: added `i4_to_int()`, `int_to_i4()` * Module `bits`: added `i4_to_int()`, `int_to_i4()`
## 0.13.1 and 0.12.7 ## 0.13.1 and 0.12.7

View file

@ -1,14 +0,0 @@
# This file is only used for Sphinx.
# End users should use pyproject.toml instead
itsdangerous==2.2.0
libsass==0.23.0
peewee==3.18.1
pydantic==2.12.0
quart_schema==0.22.0
setuptools==80.9.0
starlette==0.48.0
SQLAlchemy==2.0.40
toml==0.10.2
sphinx_rtd_theme==3.0.2

View file

@ -41,7 +41,7 @@ from .color import OKLabColor, chalk, WebColor, RGBColor, LinearRGBColor, \
from .mat import Matrix from .mat import Matrix
from .argparse import LetterSubparsers from .argparse import LetterSubparsers
__version__ = "0.14.0a5" __version__ = "0.14.0"
__all__ = ( __all__ = (
'ColorFormatter', 'ColorFormatter',

View file

@ -158,7 +158,7 @@ from .asyncio import SQLAlchemy, async_query, SessionWrapper, AsyncSelectPaginat
from .orm import ( from .orm import (
id_column, snowflake_column, match_column, match_constraint, bool_column, declarative_base, parent_children, id_column, snowflake_column, match_column, match_constraint, bool_column, declarative_base, parent_children,
author_pair, age_pair, bound_fk, unbound_fk, want_column, a_relationship, BitSelector, secret_column, username_column, author_pair, age_pair, bound_fk, unbound_fk, want_column, a_relationship, BitSelector, secret_column, username_column,
ascii_column, i4_column ascii_column, i4_column, now_column,
) )
try: try:
@ -173,7 +173,7 @@ __all__ = (
'match_column', 'match_constraint', 'bool_column', 'parent_children', 'match_column', 'match_constraint', 'bool_column', 'parent_children',
'author_pair', 'age_pair', 'bound_fk', 'unbound_fk', 'want_column', 'author_pair', 'age_pair', 'bound_fk', 'unbound_fk', 'want_column',
'a_relationship', 'BitSelector', 'secret_column', 'username_column', 'a_relationship', 'BitSelector', 'secret_column', 'username_column',
'ascii_column', 'i4_column', 'ascii_column', 'i4_column', 'now_column',
# .asyncio # .asyncio
'SQLAlchemy', 'AsyncSelectPagination', 'async_query', 'SessionWrapper' 'SQLAlchemy', 'AsyncSelectPagination', 'async_query', 'SessionWrapper'
) )

View file

@ -22,7 +22,7 @@ import os
import re import re
from typing import Any, Callable, TypeAlias, TypeVar from typing import Any, Callable, TypeAlias, TypeVar
import warnings import warnings
from sqlalchemy import BigInteger, Boolean, CheckConstraint, Column, Date, ForeignKey, Integer, LargeBinary, MetaData, SmallInteger, String, TypeDecorator, text from sqlalchemy import BigInteger, Boolean, CheckConstraint, Column, Date, DateTime, ForeignKey, Integer, LargeBinary, MetaData, SmallInteger, String, TypeDecorator, func, text
from sqlalchemy.orm import DeclarativeBase, InstrumentedAttribute, Relationship, declarative_base as _declarative_base, relationship from sqlalchemy.orm import DeclarativeBase, InstrumentedAttribute, Relationship, declarative_base as _declarative_base, relationship
from sqlalchemy.types import TypeEngine from sqlalchemy.types import TypeEngine
from sqlalchemy.ext.hybrid import Comparator from sqlalchemy.ext.hybrid import Comparator
@ -210,6 +210,15 @@ def bool_column(value: bool = False, nullable: bool = False, **kwargs) -> Column
""" """
def_val = text('true') if value else text('false') def_val = text('true') if value else text('false')
return Column(Boolean, server_default=def_val, nullable=nullable, **kwargs) return Column(Boolean, server_default=def_val, nullable=nullable, **kwargs)
def now_column(*, nullable: bool = False, **kwargs):
"""
Column with default value set as CURRENT_TIMESTAMP.
*New in 0.14.0*
"""
return Column(DateTime, nullable=nullable, server_default=func.current_timestamp(), **kwargs)
def declarative_base(domain_name: str, master_secret: bytes, metadata: dict | None = None, **kwargs) -> type[DeclarativeBase]: def declarative_base(domain_name: str, master_secret: bytes, metadata: dict | None = None, **kwargs) -> type[DeclarativeBase]: