-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pyface imports from non api modules #1424
Comments
The question of exposing |
Also ref: enthought/ets#51 (this issue may be a bit redundant from the ideas of that issue, but this issue does add an explicit list of imports at least) |
I'd recommend not doing this: that code is really just a convenience for Traits itself, and it could easily change without reference to external packages. |
I don't think it makes sense to expose the |
Just to clarify pyface should be importing traits and then using |
Yeah. I would probably do |
So as a general principle, I don't want Traits to become a dumping ground (any more than it already is) for utilities that aren't explicitly Traits related. If there's a string-handling utility that's actually related to the way that Traits does something in particular, and that Traits-using libraries need to know about, then that's fine (though in that case you'd expect it to have a name that also makes it clear what Traits role is), but general utilities shouldn't be in Traits. Also, anything that is newly exposed in the Traits api should have tests - we shouldn't expose it without those tests.
This uses evil magic and its use should be avoided if at all possible. Pyface should find a better way of doing whatever it's doing. It's not used within Traits anywhere, and it's not tested anywhere.
Not Traits-related, not used within Traits, not tested. Should not be moved into any of the api modules.
What's Pyface using this for? There isn't really a meaningful "Traits home directory".
Yep, that one's problematic - we want to make that
I'd recommend that packages check
Not used within Traits, not tested. Possibly redundant with post-Python-3.6 path handling capabilities. What's Pyface using this one for? If it is a cross-ETS need, we could potentially make it available, but it would need tests and a clear use-case.
These ones may need to be exposed (but not without thought and an understanding of the use-case - if we're going to expose them, we should also take the opportunity to decide whether there's a better API).
Urgh. Not obviously Traits-related, not used in Traits, not tested. Would need a clear Traits-related use-case to be considered for addition to *.api.
Ditto. |
Re: TraitList
|
Well, first you should back up a step. Why does Pyface need the Traits version? |
I've opened enthought/pyface#869
https://github.com/enthought/pyface/blob/2974f580c4c10ec4142641ca67b15ec27593c5ae/pyface/dock/dock_window.py#L974-L986
It's using it in a data_view test for serializing to json:
https://github.com/enthought/pyface/blob/2974f580c4c10ec4142641ca67b15ec27593c5ae/pyface/resource/resource_manager.py#L244-L258
These are used in the |
With some of these, a driver from me is that we don't want multiple, subtly different ways of doing some basic things - the xgetattr/xsetattr thing is one of these, but there are likely others (eg. code for getting "human-friendly" versions of Python names, code for working out where to import a name from, etc.). Maybe they don't belong in Traits, but it's a bad experience for a library if things are not consistent across similar places that they are used. |
Ref: enthought/pyface#866
With traits 6.2 we are explicitly stating in documentation that imports should come from api modules. Because of this I decided to run through pyface for any non api imports and this is the list I found:
From
traits.trait_base
there are imports of:[ ](see Expose xgetattr and xsetattr in traits API #1239)xgetattr
[ ](see Expose xgetattr and xsetattr in traits API #1239)xsetattr
get_resource_path
user_name_for
traits_home
Additionally we import optional dependencies from(pyface shouldn't do this)traits.testing.optional_dependencies
From
traits.trait_list_object
we importTraitsList
but this is a differentTraitList
from the one exposed intraits.api
Fromtraits.version
we importversion
From
traits.util.resource
we importget_path
From
traitst.trait_notifiers
we importset_ui_handler
andui_handler
From
traitss.util.clean_strings
we importpython_name
and from
traits.util.camel_case
we importcamel_case_to_words
Some of these we may want to expose in an api module since they are being used? Others we may want to discourage their use in
pyface
since traits isn't meant to be a storage place for miscellaneous utilities. Or we may want to just leave them alone and break our own suggestion.The text was updated successfully, but these errors were encountered: