Skip to content

remove plotly/colors.py in favour of utils #1279

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

Closed
wants to merge 23 commits into from

Conversation

Kully
Copy link
Contributor

@Kully Kully commented Nov 20, 2018

Since figure_factory is 100% of the code that is using colors.py, it makes more sense to move the colors.py that are not in plotly.figure_factory/utils.py in there.

In favour of PR: #878

TODOs for this PR:

  • moved all colors.py functions to figure_factory.utils.py
  • redirect all reference to colors over to utils
  • add tests for all utils.py functions

For another PR:

  • fix how _scatter, _gantt, _bullet (and maybe others) use the plotly color scales. Right now, the modules are built such that if a user inputs Viridis for instance, the color functions will return just a list of the colors found in the Viridis colorscale, but without the appropriate colorscale numbers to indicate how the interpolation works between each color (i.e. these modules linearly interpolate between the colors of the Plotly colorscales)

@Kully
Copy link
Contributor Author

Kully commented Nov 23, 2018

ready for a review @jonmmease

Copy link
Contributor

@jonmmease jonmmease left a comment

Choose a reason for hiding this comment

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

Thanks for working on this cleanup @Kully, I'll look it over in more detail soon.

In the meantime, I'm a little worried about deleting plotly/colors.py in case people have found it and are relying on functions in there. Can you add a plotly/colors.py file back in that just imports all of the public functions/variables from their new locations?

@jonmmease jonmmease added this to the v3.5.0 milestone Nov 29, 2018
@Kully
Copy link
Contributor Author

Kully commented Nov 29, 2018

Can you add a plotly/colors.py file back in that just imports all of the public functions/variables from their new locations?

Sure!

@Kully
Copy link
Contributor Author

Kully commented Dec 4, 2018

Can you add a plotly/colors.py file back in that just imports all of the public functions/variables from their new locations?

The issue I'm running into is that figure_factory relies on a numpy import, but none of the functions that colors.py is using does.

I haven't found a way to slickly import only the figure_factory.utils without grabbing the rest of the modules in the tree. And I don't want to change the hierarchy structure of the repo.

Any suggestions on how to proceed? Perhaps a 1-liner of python code in colors.py with a comment saying that colors is being depreciated in the next plotly version.

@jonmmease
Copy link
Contributor

@Kully, I see what you mean about the numpy dependency. Let's leave the plotly/colors.py where it is then for now. Also, I don't see any fundamental reason why we wouldn't use these functions from the core (non figure factory) code at some point.

If we leave colors.py where it is, are there other things from the PR that you want to keep?

@Kully
Copy link
Contributor Author

Kully commented Dec 10, 2018

Let's leave the plotly/colors.py where it is then for now.

By this I understand you mean to leave functions defined directly from plotly/colors.py rather than importing from figure_factory

I don't see any fundamental reason why we wouldn't use these functions from the core

I agree with this too.

If we leave colors.py where it is, are there other things from the PR that you want to keep?

There are duplicate functions in here that I removed a few commits above. I think we should for sure keep the duplicate functions removed.

… done on PR is removing duplicate functions and putting appropriate functions in a suitable module (colors.py or uitls.py) and changing variable method calls to the correct functions
@Kully
Copy link
Contributor Author

Kully commented Dec 11, 2018

closing in favor of #1301

@Kully Kully closed this Dec 11, 2018
@Kully Kully deleted the colors-functions-organized branch December 11, 2018 20:26
@Kully Kully removed this from the v3.5.0 milestone Dec 11, 2018
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