Skip to content

added links to px.data and px.colors in API doc #2493

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

Merged
merged 15 commits into from
May 26, 2020
Merged

Conversation

emmanuelle
Copy link
Contributor

@emmanuelle emmanuelle commented May 22, 2020

This PR add links to px.data and px.colors at the end of the API doc page on plotly.express.

For px.data

Screenshot_2020-05-22 plotly data package — 4 7 0 documentation

For px.colors, the objects which we want to list are not functions but lists, and they are not listed in an __all__ somewhere already so I figured out it would be easier to link to the corresponding doc tutorials.

image

In the main px page:
image

@nicolaskruchten
Copy link
Contributor

In your screenshot it's listed as plotly.data but it's actually plotly.express.data.

@nicolaskruchten
Copy link
Contributor

Re colors, can we list the submodules of plotly.express.colors like qualitative and sequential so at least people know that those are namespaces?

Maybe we could list the px.colors.named_colorscales() function?

@nicolaskruchten
Copy link
Contributor

If I had a function that outputted the color scales and sequences by namespace, could we execute that function and inline the output here?

@emmanuelle
Copy link
Contributor Author

In your screenshot it's listed as plotly.data but it's actually plotly.express.data.

So if you want it to appear as plotly.express.data, data should be a sub-package of plotly.express which it is not at the moment (ie there should be a data directory with an __init__.py). This is what I did with colors but then I had to change some imports which apparently cause problem for py 3.6. Should I create the plotly.express.data package? This would be a cleaner organization of the code.

@emmanuelle
Copy link
Contributor Author

So this CI failure is very frustrating. I created subpackages data and colors in plotly.express in order to be able to document them in the API (and it's also a cleaner way to organize code). Everything works fine locally but on the CI build-doc build all notebooks where px is imported fail at the line 58 of the __init__.py: from . import data, colors. Everything works well on my laptop. I thought it could come from the version of python so I tried py 3.6 and 3.7 locally and both work. Any idea?

@emmanuelle
Copy link
Contributor Author

I removed the re-direction for failed builds of notebooks because the output is full of unicode characters which are hard to read but I'll put this back.

@emmanuelle
Copy link
Contributor Author

ok I can reproduce the error if I try to install the package with python setup.py install instead of python setup.py develop, I'll investigate from here.

@emmanuelle emmanuelle force-pushed the apidoc-px-submodules branch from 4e65c53 to 5776a1f Compare May 23, 2020 17:12
@emmanuelle
Copy link
Contributor Author

ok, silly me, it was just a question of adding the new subpackages to the packages list in setup.py. All green now!

@@ -22,7 +22,7 @@ help:
sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*/*.py
sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*/*/*.py
sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*/*/*/*.py
sphinx-apidoc -o generated ../../packages/python/plotly/plotly ../../packages/python/plotly/plotly/validators ../../packages/python/plotly/plotly/tests ../../packages/python/plotly/plotly/matplotlylib/ ../../packages/python/plotly/plotly/offline ../../packages/python/plotly/plotly/api
sphinx-apidoc -E -M -o generated ../../packages/python/plotly/plotly ../../packages/python/plotly/plotly/validators ../../packages/python/plotly/plotly/tests ../../packages/python/plotly/plotly/matplotlylib/ ../../packages/python/plotly/plotly/offline ../../packages/python/plotly/plotly/api
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These changes:

  • remove titles such as "List of modules" which I deemed to be verbose and not helpful.
  • put the module content before the list of submodules

@emmanuelle
Copy link
Contributor Author

I updated the screenshots above.

@emmanuelle
Copy link
Contributor Author

ok, I hacked the Makefile to get the architecture of colors right but this make me cringe a bit. Since we have generated code in graph_objects maybe we could also generate code in colors subpackages in the future? Anyway here is the screenshot for now
image

@nicolaskruchten
Copy link
Contributor

@jonmmease could you give these package manipulations a once-over plz? They seem fine to me but I’m always wary of breaking something :)

@jonmmease
Copy link
Contributor

It all looks reasonable to me!

@nicolaskruchten
Copy link
Contributor

Should be good to merge tomorrow right before the release... thanks @emmanuelle !

emmanuelle and others added 2 commits May 26, 2020 14:04
@emmanuelle
Copy link
Contributor Author

I made the small requested changes, please tell me if I can merge!

@nicolaskruchten
Copy link
Contributor

💃

@emmanuelle emmanuelle merged commit 4946db6 into master May 26, 2020
@nicolaskruchten nicolaskruchten added this to the 4.8.0 milestone May 26, 2020
@nicolaskruchten nicolaskruchten deleted the apidoc-px-submodules branch June 19, 2020 16:17
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.

3 participants