enthought / enthought/traits

Add support to exclude internal traits from being reported

Open
#1,098 2 comments 0 reactions 0 assignees View on GitHub
type: enhancement
Dominant language
Python
Stars
462
Forks
90
PR merge metrics
No merged PRs in 30d

Description

Currently `trait_added` and `trait_modified` are reported by public methods `HasTraits.traits` and `HasTraits.class_traits`. Both of these traits are defined by `traits` for internal use and are typically not useful for downstream projects.

Since there are no other ways to exclude these two internal traits, when projects try to get a list of traits for their classes, they are typically filtered by hard-coding, like this:
```
traits = instance.class_traits()
traits.pop("trait_added")
traits.pop("trait_modified")
```

This makes it difficult to add more internal traits (e.g. for solving #1047) without breaking user code.

Possible solution is to add a specific metadata on these internal traits such that there is a documented and supported way to exclude them via the public interface. In addition to this, maybe a helper method that does this filter by default, similar to `editable_traits` and `visible_traits`, would be useful.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.