traits
traits copied to clipboard
Observable typed attributes for Python classes
Bump the release date for 6.4.0 - we're not going to get it in today. This PR should not be merged until 6.4.0 has actually been released, just in case...
A minor feature request: for `String` validation with a regex, `re.fullmatch` is more often going to be what we want to use than `re.match`. It would be nice to provide...
Given an `Instance` trait declaration that uses `allow_none=False`, for example as in: ```python class A(HasTraits): foo = Instance(SomeClass, allow_none=False) ``` it would be useful for typing tools to be able...
[From #1645] `TraitType.clone` needs to know the value of `setattr_original_value` for the associated ctrait, resulting in this awkwardness in the clone method (following merge of #1645) ``` setattr_original_value = new.as_ctrait().setattr_original_value...
[From #1645] Currently, in most cases `TraitType.clone` with a new default value tries to validate that default value using `self.validate(None, None, default_value)`. This can fail for trait types like `This`...
Behaviour-wise, `CArray` is functionally identical to `Array`. The only difference is that there's an attribute `coerce` with value `True` for `CArray` and `False` for `Array`; that value has no effect...
The name of the application is selected by looking at the enclosing directory of the main script: https://github.com/enthought/traits/blob/66b57b7c1f2127fc070fa943773c840f5f44a9ca/traits/etsconfig/etsconfig.py#L361-L383 This is often something generic, like `app`, or when being run in...
The [_TraitType](https://github.com/enthought/traits/blob/3e22388e60acca6bb138f54fee06e6f34009c1f3/traits-stubs/traits-stubs/trait_type.pyi#L34) generic class is a potentially useful helper for others writing type declarations. I'd suggest renaming it (at least to remove the `_` prefix) and moving it to a...
This was reported to me informally by @dgoeries. He measured performance degradation of `HasTraits` instantiation on a large long-lived codebase when upgrading to Traits 6.1.1. I've done my best to...
When running the following code: ``` python from traits.api import AdaptsTo, HasTraits, Instance, Interface, Supports, register_factory class ITestInterface(Interface): pass class MyClass(HasTraits): pass class MyClassTestInterfaceAdapter(HasTraits): object = Instance(MyClass) def __init__(self, object):...