Skip to content
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

Import from traits apis #866

Merged
merged 2 commits into from
Jan 25, 2021
Merged

Import from traits apis #866

merged 2 commits into from
Jan 25, 2021

Conversation

aaronayres35
Copy link
Contributor

With the release of traits 6.2 a section was added to the documentation explicitly requesting users to import from the .api modules in traits. See PR enthought/traits#1387

Motivated by this I decided to run through pyface looking for any non api imports from traits. This PR updates a couple (namely it always imports UnittestTools from the traits.testing.api and ETSConfig from traitst.etsconfig.api.

However, I ran into many more examples of traits imports of things not exposed in traits apis. It is known that this is done but I figured it couldn't hurt to compile a list. It may be fine to leave them as is, some of these we may want to expose in some traits api, some of them we may not want to be pulling from traits (traits isn't meant to be a storage place for miscellaneous utilities). This list probably warrants being in a separate or multiple separate issues which I can gladly open eventually. For now these are the imports I found:

From traits.trait_base there are imports of:

  • xgetattr
  • xsetattr
  • get_resource_path
  • user_name_for
  • traits_home

Additionally we import optional dependencies from traits.testing.optional_dependencies

From traits.trait_list_object we import TraitsList but this is a different TraitList from the one exposed in traits.api

from traits.version we import version

from traits.util.resource we import get_path

form traitst.trait_notifiers we import set_ui_handler and ui_handler

from traitss.util.clean_strings we import python_name

and from traits.util.camel_case we import camel_case_to_words

@rahulporuri
Copy link
Contributor

This list probably warrants being in a separate or multiple separate issues which I can gladly open eventually. For now these are the imports I found:

I think this warrants an issue on traits - and we can leave it to the traits maintainer to decide which will be exposed via the api module and which won't.

Copy link
Contributor

@rahulporuri rahulporuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aaronayres35 aaronayres35 merged commit 9d165a9 into master Jan 25, 2021
@aaronayres35 aaronayres35 deleted the import-from-traits-apis branch January 25, 2021 13:47
@aaronayres35
Copy link
Contributor Author

This list probably warrants being in a separate or multiple separate issues which I can gladly open eventually. For now these are the imports I found:

I think this warrants an issue on traits - and we can leave it to the traits maintainer to decide which will be exposed via the api module and which won't.

SGTM, I opened enthought/traits#1424

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants