Skip to content

Version 1.5.0 release

Compare
Choose a tag to compare
@daveraja daveraja released this 19 Feb 11:09
· 32 commits to master since this release

This release add support for Python postponed type annotations.

  • Postponed type annotations are configured by specifying from __future__ import annotations at the top of module files.

  • It causes all type annotations to be returned as plain strings, rather than processed Python class objects. This feature is being increasingly used with user code, and will eventually become the default behavior for Python.

  • Using Python type annotations is now the preferred mechanism to specify Clorm Predicate sub-classes. For example:

     from clorm import Predicate, ConstantStr
    
     class MyPredicate(Predicate, name="my_predicate"):
         field1: int
         field2: str
         field3: ConstantStr
    
     p = MyPredicate(field1=10, field2="Hello", `field3="friend")
    
     # resulting ASP fact: `my_predicate(10, "Hello", friend).` 
    
  • The documentation has been updated to reflect the new preferred syntax.