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

Consolidate overlays into "chaco.overlays" #741

Merged
merged 21 commits into from
Jun 2, 2021
Merged

Conversation

aaronayres35
Copy link
Contributor

This PR would close #699

We still need to decide how we plan to deal with chaco.api and chaco.overlays.api (and also chaco.layers.api which will be moved into chaco/overlays/layers)

@aaronayres35 aaronayres35 changed the title Consolidate overlays into "chaco.overlays" [WIP] Consolidate overlays into "chaco.overlays" May 17, 2021
@rahulporuri
Copy link
Contributor

We still need to decide how we plan to deal with chaco.api and chaco.overlays.api

IMO the recommendation will be to prefer chaco.api over chaco.overlays.api

... (and also chaco.layers.api which will be moved into chaco/overlays/layers)

Before we make that move/decision, we need to first know who uses chaco.layers.*. I don't know if there are any active users to that subpackage.

@rahulporuri
Copy link
Contributor

The only additional comment i have regarding this draft PR is that the final PR will also need to search for and move the relevant tests to chaco.overlays.tests

@aaronayres35 aaronayres35 requested a review from rahulporuri May 19, 2021 13:58
# All other metadata is interpreted as a mask on dataspace
else:
ar = numpy.arange(0, len(selection), 1)
runs = arg_find_runs(ar[selection])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this flake8 error makes me suspect this code is actually broken:
chaco/overlays/layers/svg_range_selection_overlay.py:107:20: F821 undefined name 'arg_find_runs'

@aaronayres35
Copy link
Contributor Author

The only additional comment i have regarding this draft PR is that the final PR will also need to search for and move the relevant tests to chaco.overlays.tests

It appears many are untested (at least not explicitly tested). Searching for test files containing Overlay yields only 2 results. I've moved the test_data_label.py file. I did not see others existing currently.

@aaronayres35 aaronayres35 mentioned this pull request Jun 1, 2021
44 tasks
@aaronayres35
Copy link
Contributor Author

I had old files left as stubs in chaco/layers which raise deprecation warnings to preserve backwards compatibility. I also have the layers exposed in chaco.overlays.api, chaco.api, chaco.overlays.layers.api (this one really probably shouldn't exist?) and the now deprecated chaco.layers.api).

Also, currently the svg images in layers/data are duplicated, but perhaps the old set in chaco/layers/data can be removed

@aaronayres35
Copy link
Contributor Author

aaronayres35 commented Jun 1, 2021

Before we make that move/decision, we need to first know who uses chaco.layers.*. I don't know if there are any active users to that subpackage.

I did a github search of chaco.layers and I only saw results in chaco itself. This is far from a guarantee though

@aaronayres35 aaronayres35 changed the title [WIP] Consolidate overlays into "chaco.overlays" Consolidate overlays into "chaco.overlays" Jun 1, 2021
@aaronayres35
Copy link
Contributor Author

I am going to convert this from a draft PR to a real PR now as we do aim to merge this going forward.

@aaronayres35 aaronayres35 marked this pull request as ready for review June 1, 2021 22:17
@aaronayres35
Copy link
Contributor Author

Note SvgRangeSelectionOverlay is not included in api modules as I think it is broken / it was not included in any api previously. See comment #741 (comment)
I am happy to add it if you think it should be exposed @rahulporuri
Maybe, if it is indeed broken / if we search and find it unused, it could be removed or deprecated.

@aaronayres35 aaronayres35 requested a review from rahulporuri June 2, 2021 15:05
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

@rahulporuri
Copy link
Contributor

@aaronayres35 looks like grid and axis aren't included in this refactor - which are mentioned in the issue. I don't remember if we had already discussed why they aren't included.

@aaronayres35
Copy link
Contributor Author

aaronayres35 commented Jun 2, 2021

@aaronayres35 looks like grid and axis aren't included in this refactor - which are mentioned in the issue. I don't remember if we had already discussed why they aren't included.

I don't recall if we discussed it either, all I remember was Corran's comment: #699 (comment)
Perhaps we should bring them in with the scale and tick generation code?

EDIT:
as we mentioned earlier today I think it may be okay to leave axis and grid out. They are a somewhat distinct from other overlays - they are underlays as described here:

#: The order in which various rendering classes on this component are drawn.
#: Note that if this component is placed in a container, in most cases
#: the container's draw order is used, since the container calls
#: each of its contained components for each rendering pass.
#: Typically, the definitions of the layers are:
#:
#: 1. 'background': Background image, shading
#: 2. 'image': A special layer for plots that render as images. This is in
#: a separate layer since these plots must all render before non-image
#: plots.
#: 3. 'underlay': Axes and grids
#: 4. 'plot': The main plot area itself
#: 5. 'selection': Selected content are rendered above normal plot elements
#: to make them stand out
#: 6. 'border': Plot borders
#: 7. 'annotation': Lines and text that are conceptually part of the "plot"
#: but need to be rendered on top of everything else in the plot
#: 8. 'overlay': Legends, selection regions, and other tool-drawn visual
#: elements

@rahulporuri
Copy link
Contributor

as we mentioned earlier today I think it may be okay to leave axis and grid out. They are a somewhat distinct from other overlays - they are underlays as described here:

SGTM. Go ahead with this PR and the rest of the rc process.

@aaronayres35 aaronayres35 merged commit 2899f73 into master Jun 2, 2021
@aaronayres35 aaronayres35 deleted the overlays-reorg branch June 2, 2021 16:02
aaronayres35 added a commit that referenced this pull request Jun 2, 2021
* copy modules into chaco/overlays

* make original modules stubs raising deprecation warnings

* copy layers into overlays

* fully populate chaco.overlays.api and chaco.api

* flake8

* update tox.ini by running flake8 -q

* somehow this is also needed in tox.ini but I did not see this flake8 error locally

* remove bad trailing comma

* move data label test to sit in chaco/overlays/tests

* add stub modules in chaco/layers importing from new location and adding deprecation warnigns.  Also expose layers in the chaco.overlays.api

* add layers to the chaco.api as well

* old files that were moved have since been changed on master and did not get updated in merge of master

* flake8

* typo

* update deprecation warning messages

* remove stub modules from autogenerated api docs

* remove chaco/layers/data

* import from chaco.plots in overlay modules

* import Legend from chaco.overlays.api
aaronayres35 added a commit that referenced this pull request Jun 2, 2021
* FIX: fix scrollbar demo and update docstring (#489)

Co-authored-by: Poruri Sai Rahul <rporuri@enthought.com>

* Add new chaco.plots submodule (#738)

* add new chaco.plots submodule

* move contour_line_plot.py and contour_poly_plot.py into chaco/plots/contour

* import from api in tests

* move relevant tests into chaco/plots/tests

* add stub files at old file locations which raise Deprecation warning and import objects from their new chaco/plots modules

* flake8

* update warning message

* set stacklevel=2 in deprecation warnings

* add a chaco.plots.api

* typo

* update deprecation warning messages, and remove module docstrings

* Apply suggestions from code review

Co-authored-by: Poruri Sai Rahul <rporuri@enthought.com>

* ignore stub modules when generating api docs

* flake8

* update api module docstrings

* reorder imports

* suggestions from code review

Co-authored-by: Poruri Sai Rahul <rporuri@enthought.com>

* add pyproject.toml to MANIFEST.in (#747)

* Consolidate overlays into "chaco.overlays" (#741)

* copy modules into chaco/overlays

* make original modules stubs raising deprecation warnings

* copy layers into overlays

* fully populate chaco.overlays.api and chaco.api

* flake8

* update tox.ini by running flake8 -q

* somehow this is also needed in tox.ini but I did not see this flake8 error locally

* remove bad trailing comma

* move data label test to sit in chaco/overlays/tests

* add stub modules in chaco/layers importing from new location and adding deprecation warnigns.  Also expose layers in the chaco.overlays.api

* add layers to the chaco.api as well

* old files that were moved have since been changed on master and did not get updated in merge of master

* flake8

* typo

* update deprecation warning messages

* remove stub modules from autogenerated api docs

* remove chaco/layers/data

* import from chaco.plots in overlay modules

* import Legend from chaco.overlays.api

Co-authored-by: Xiaoyu Wu <xiaoyu-wu@users.noreply.github.com>
Co-authored-by: Poruri Sai Rahul <rporuri@enthought.com>
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.

Consolidate overlays into "chaco.overlays"?
2 participants