- Fixed invariants leak between related classes (#297)
This is a critical bugfix patch version. We introduced a bug in 2.7.0 (#292) where invariants defined on derived classes leaked up to parent classes. This bug is fixed in this version.
Allowed to enforce invariants on attribute setting (#292)
Originally, we had enforced invariants only at calls to "normal" methods, and excluded
__setattr__
since it is usually too expensive to verify invariants whenever setting an attribute.However, there are use cases where the users prefer to incur to computational overhead for correctness. To that end, we introduced the feature to steer when the invariants are enforced (at method calls, on setting attributes, or in both situations).
Updated typeguard and deal to latest versions (#284)
This change is needed so that distributions can successfully run the necessary tests with the development dependencies. Previously, the dependencies were outdated, and the old versions were already deprecated in distributions (notably, typegard and deal).
Added Python 3.11 to the list of supported Pythons (#280)
Fixed deal dependency marker (#279)
This patch is important as we silently broke
setup.py
, which was tolerated by older versions of setuptools, but not any more by the newer ones. With this patch, icontract'ssetup.py
is made valid again.
Restored Python 3.6 support (#274)
The support for Python 3.6 has been dropped in #257 as GitHub removed its support in the CI pipeline. With this patch, we restored the support of Python 3.6. Notably, we had to add the package
contextvars
conditioned on Python 3.6.
- Removed meta data files from setup.py (#262)
- Added support for python 3.11 (#260)
- Fixed in-progress set for async (#256)
- Added wheels to releases (#251)
- Fixed mypy error on missing
asttokens.ASTTokens
(#252)
- Excluded all tests from package (#240)
- Added support for Python 3.9 and 3.10 (#236)
- Added representation of subscripts (#237)
- Fixed representation of numpy arrays (#232)
- Removed tag for Python 3.5 (#231)
- Made type annotation for
invariant
decorator more specific (#227)
- Fixed reporting all arguments on violation (#219)
- Propagated placeholders in re-computation (#218)
- Fixed docstring for
collect_variable_lookup
(#217)
- Fixed handling of
self
when passed as kwarg (#213) - Added reporting of all arguments on violation (#214)
- Added tracing of
all
on generator expressions (#215)
- Allowed
__new__
to tighten pre-conditions (#211) - Fixed recomputation of calls in generator expr (#210)
- Added better reporting on recompute failure (#207)
- Encapsulated adding contracts for integrators (#202)
- Added support for error-as-instance (#201)
- Added support for coroutine (#197)
- Added support for async (#196)
- Removed automatic registration with Hypothesis and replaced it with a hook that downstream libraries such as icontract-hypothesis can use (#181)
- Refactored and added tests for integrators (#182)
- Integrated with icontract-hypothesis (#179)
- Refactored for icontract-hypothesis (#178)
- Added special arguments _ARGS and _KWARGS (#176)
- Tested with typeguard (#175)
- Tested with dataclasses.dataclass (#173)
- Added invariants to namedtuple (#172)
- Added support for recomputation of f-strings (#170)
- Exempted __new__ from invariant checks (#168)
- Added support for named expressions in contracts (#166)
- Acted upon deprecation warning ins
ast
module when generating the violation error message.
- Denormalized icontract_meta so that icontract can be installed on readthedocs.
- Disabled invariant checks during the construction to avoid attribute errors on uninitialized attributes
- Added
icontract_meta
tosetup.py
- Noted that contracts on
*args
and**kwargs
are known issues
- Fixed performance regression due to state
- Fixed bug related to threading.local and mutables
- Fixed race conditions in endless recursion blockers
- Disabled recursion in the contracts
- Upgraded min version of asttokens to 2
- Made compatible with Python 3.8
- Made snapshot accept multiple arguments
- Fixed mypy complaints in clients due to import aliases
- Made compliant to mypy 0.750 --strict
- Added location to errors on calls with missing arguments
- Improved error message on unexpected arguments in a call
- Distinguished between optional and mandatory arguments in conditions. Default argument values in conditions are accepted instead of raising a misleading "missing argument" exception.
- Added a boolyness check to detect if the condition evaluation can be negated. If the condition evaluation lacks boolyness, a more informative exception is now raised. For example, this is important for all the code operating with numpy arrays where boolyness is not given.
- Added contract location to
require
,ensure
andsnapshot
. This feature had been erroneously omitted in 2.0.4.
- Added contract location to the message of the violation error
- Fixed representation of numpy conditions
- Updated pylint to 2.3.1
- Specified
require
andensure
to use generics in order to fix typing erasure of the decorated functions
- Fixed forgotten renamings in the Readme left from icontract 1.x
- Removed
repr_args
argument to contracts since it is superseded by more versatileerror
argument - Renamed contracts to follow naming used in other languages and libraries (
require
,ensure
andinvariant
) - Improved error messages on missing arguments in the call
- Demarcated decorator and lambda inspection in
_represent
submodule
- Refactored implementation and tests into smaller modules
- Added
snapshot
decorator to capture "old" values (prior to function invocation) for postconditions that verify state transitions
- Replaced
typing.Type
withtype
so that icontract works with Python 3.5.2
- Added
error
argument to the contracts
- Removed
ast_graph
module which was only used for debugging - Prefixed internal modules with an underscore (
_represent
and_recompute
)
recompute
propagates to children of generator expressions and comprehensions- Optimized parsing of condition lambdas by considering only lines local to the decorator
- Exempted
__init__
from inheritance of preconditions and postconditions if defined in the concrete class.
- Contracts are observed and inherited with property getters, setters and deleters.
- Weakining of preconditions of a base function without any preconditions raises
TypeError
. __getattribute__
,__setattr__` and ``__delattr__
are exempted from invariants.- Slot wrappers are properly handled.
- Fixed representation of conditions with attributes in generator expressions
- Added reference to sphinx-contract
- Added reference to
pyicontract-lint
in the README - Made
inv
a class
- Added support for class and static methods
- Fixed different signatures of
DBCMeta
depending on Python version (<=3.5 and >3.5) due to differing signatures of__new__
inabc.ABCMeta
- Removed dependency on
meta
package and replaced it with re-parsing the file containing the condition to represent the comprehensions
- Quoted ellipsis in
icontract._unwind_decorator_stack
to comply with a bug in Python 3.5.2 (see python/typing#259)
- Added inheritance of contracts
- Contract's constructor immediately returns if the contract is disabled.
- Added invariants as icontract.inv
- Added
icontract.SLOW
to mark contracts which are slow and should only be enabled during development - Added
enabled
flag to toggle contracts for development, production __etc.__
- Removed
version.txt
that caused problems withsetup.py
- Fixed: the
result
is passed to the postcondition only if necessary
- Fixed a bug that fetched the unexpected frame when conditions were stacked
- Fixed a bug that prevented default function values propagating to the condition function
- Added reprlib.Repr as an additional parameter to customize representation
- Fixed unit tests to set actual and expected arguments correctly
- Made ViolationError an AssertionError
- Added representation of values by re-executing the abstract syntax tree of the function
pre
andpost
decorators usefunctools.update_wrapper
to allow for doctests
- Moved icontract.py to a module directory
- Added py.typed to comply with mypy
- Fixed links in the README and setup.py
- Initial version