Skip to content

Cleaner import checking#317

Closed
theengineear wants to merge 21 commits into
untangle-importsfrom
cleaner-import-checking
Closed

Cleaner import checking#317
theengineear wants to merge 21 commits into
untangle-importsfrom
cleaner-import-checking

Conversation

@theengineear

Copy link
Copy Markdown
Contributor

PR 2: Use a single, central place to check whether optional deps are imported and get them from a central source.

(WIP still based off another cleanup branch #316)

This attempts to de-uglify how we do protected imports. One module to rule them all 💍

Todo:

  • definitely need some 🐅s on the new module

* line too long
* bad line breaking at operators (e.g., `*`)
* continuation line over-intented
Note that default arguments are used in all function calls. This means
that you can get some unexpected storage of previous defaults! It’s best
practice not to do this.
IDEs hate this… besides, this is internal code. The important part is
that we eventually validate our work by instantiating a `Figure`.

We can use the publicly hidden `GraphObjectFactory` for this purpose.
This is a stand-alone module to the following:

* Don’t import things until we need them
* Keep all the information centralized
* No possibility of circular imports by using this module
@theengineear

Copy link
Copy Markdown
Contributor Author

@chriddyp @cldougl @etpinard does this seem reasonable? I'm just using importlib to do some dynamic importing.

This is the important commit if you feel like checking this out 7cbd355

Chris, I'm trying to follow your momentum with untangling plot_options logic. I think there's a lot more work to be done 😅

@theengineear theengineear mentioned this pull request Nov 26, 2015
@theengineear

Copy link
Copy Markdown
Contributor Author

I'm going to try and revisit this one if I end up with some quiet weekends. The way we currently do optional imports is sorta frustrating. 7cbd355 introduces a new way to tap into the import pathways in Python that allows a cleaner way to handle optional deps in our code.

@theengineear theengineear mentioned this pull request Dec 29, 2016
10 tasks
@theengineear

Copy link
Copy Markdown
Contributor Author

Woo. Done in a different PR.

@theengineear
theengineear deleted the cleaner-import-checking branch February 2, 2017 17:40
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.

1 participant