Skip to content

0.6.0

Choose a tag to compare

@binaryDiv binaryDiv released this 15 Apr 13:34
· 4 commits to main since this release
6e9db3a

Full changelog

This is the companion release to validataclass 0.12.0, which improves typing and adds proper support for type checking with mypy using a custom mypy plugin.

Please also read the release notes for validataclass 0.12.0 for further information on potential breaking changes and how to update.

To enable the mypy plugin and configure it for compatibility with validataclass-search-queries, have a look at docs/04-mypy-plugin.md.

This is also the first officially public release of the library. Previously, this project was hosted on our company's internal GitLab (even though publically accessible), because it was originally meant for internal use only. We decided to migrate the project to GitHub and publish official releases on PyPI, though, to allow easier integration into other public projects.

This version drops support for Python 3.8 and 3.9 and adds support for Python 3.13 and 3.14.

Additionally, support for SQLAlchemy 1.4 is deprecated now, you should upgrade to SQLAlchemy 2.0 if you haven't done so already. This version still works with SQLAlchemy 1.4, however, proper typing is not supported, so there might be several type errors in this library if you use that version of SQLAlchemy.

General

  • Migrate project from our company GitLab to GitHub and PyPI. #1

Added

  • Add support for Python 3.13. #6
  • Add support for Python 3.14. #6
  • Add py.typed file to make the package PEP 561 compatible. #6
  • Add support for type checking using the validataclass mypy plugin. #6

Changed

  • Generic-based typing for validator classes. #6
    • Validators have been updated to be compatible with the generic-based typing in validataclass 0.12.0.
    • The MultiSelectValidator is a generic class now where the type parameter specifies the type of list items (similar to the ListValidator). Its subclasses are updated similarly.
    • The PaginationLimitValidator is a Validator[int | None]. This is because it can return None when pagination is optional. The typing might be improved in the future, possibly by splitting up the validator into one that enforces pagination and one where it's optional. If you need more precise typing, you can use a regular IntegerValidator.
  • Restructure files for MultiSelectValidator and subclasses. #4
    • The MultiSelectValidator and its subclasses (MultiSelectEnumValidator, etc.) are now defined in separate files.
    • This implies a small breaking change if the validators are imported directly from the original module, i.e. from validataclass_search_queries.validators.multi_select_validator. It is recommended to import them from the parent package validataclass_search_queries.validators instead.
  • Use DataclassValidatorFieldException in @search_query_dataclass decorator. #5
    • Previously, a different type of exception was used. This was inconsistent with the @validataclass decorator.
    • This shouldn't break any code, because those exceptions are only raised when your search query dataclass definitions are incorrect, so your code isn't valid anyway.
    • Some error messages from the decorator have also been changed for consistency.
  • PaginatedResult.map() always returns another PaginatedResult now, even when subclassed. #6
    • Previously, the method used self.__class__() to instantiate a new object of the same type as self (e.g. a subclass). However, this isn't really compatible with generic typing, since the subclass might not actually be compatible with the mapped type.

Deprecated

  • Deprecate support for SQLAlchemy 1.4. Support may be dropped in the near future, possibly the next release.
    • There should be no problems with SQLAlchemy 1.4 at runtime with this version. However, typing is not supported since SQLAlchemy didn't have good typing prior to 2.0. Type errors in this library related to SQLAlchemy 1.4 are expected.
  • Deprecate reusing TypeVars from the library by removing them from __all__. #6

Removed

  • Drop support for Python 3.8. #3
  • Drop support for Python 3.9. #3

Fixed

  • Fix incorrect short-circuiting of substring search filters. #6
    • Previously, substring search filters like SearchParamContains had a condition to "short-circuit" if the search value was empty. The idea was that a condition like col LIKE "%%" is always true, so the clause could be simplified. However, the functions simply returned the column itself and not a clause. This didn't seem correct and also just unnecessary, so this short-circuiting mechanism was removed.

Dependencies

  • Change required version of validataclass to 0.12.0 or higher, but below 0.13.0. #6

Testing / CI

  • Use GitHub Actions instead of GitLab CI. #1
  • Add more unit tests. #5
  • Enable mypy type checking with strict mode and extra rules. #6
  • Update testing dependencies and pin them to minor versions. #7
  • Fix tox configuration to run unit tests with both SQLAlchemy 1.4 and 2.0. #7

Miscellaneous

  • Various code modernizations after dropping support for Python 3.8 and 3.9. #3
  • Various refactoring, typing improvements and fixes. #6