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

Add progress bar support for fetching and drawing HiPS tiles #105

Merged
merged 5 commits into from
Aug 17, 2017

Conversation

adl1995
Copy link
Member

@adl1995 adl1995 commented Aug 11, 2017

As mentioned in #80, I have added a progress bar support for fetching and drawing HiPS tiles. The progress bar is off by default, the result can be seen in this notebook: https://github.com/adl1995/HIPS-to-Py/blob/master/examples/Precise%20drawing-ICRS.ipynb

To achieve this, I had to make use of the tqdm module.

@adl1995
Copy link
Member Author

adl1995 commented Aug 11, 2017

@cdeil The test fails with this error:

ModuleNotFoundError: No module named 'tqdm'

Do we have to manually specify the required packages on Travis CI?

@cdeil
Copy link
Contributor

cdeil commented Aug 16, 2017

Do we have to manually specify the required packages on Travis CI?

Yes, you have to add a new dependency like tqdm to .travis.yml as well as to setup.py. A similar example is mypy:

.travis.yml
77:               PIP_DEPENDENCIES='mypy pycodestyle'

setup.py
114:        'mypy>=0.501',

One question I have is whether we should make this a required or optional dependency!?

I think I would prefer if it's an optional dependency, but that would mean that the implementation has to be changed to remove the import tqdm at the top of the file and instead only import it when the user wants it:

def get_progress_bar

and then use it like this:

if self.progress_bar:
    from tqmd import tqmd
    tiles = tqmd(self.draw_tiles, desc='Drawing tiles')
else:
    tiles = self.draw_tiles

# Then the same as before
for tile in tiles:
    # process the tile

I'm also worried a bit about adding complex stuff like progress bars without any tests that show that it works. But I think the complexity of testing the progress bar functionality is probably unreasonably high that we don't attempt this, but instead just test it ourselves and rely on users to report issues if there are any now or in the future as the code changes.

@adl1995
Copy link
Member Author

adl1995 commented Aug 16, 2017

@cdeil I have made tqdm an optional dependency now, please check. I verified it on this notebook: https://github.com/adl1995/HIPS-to-Py/blob/master/examples/Precise%20drawing-ICRS.ipynb

@cdeil cdeil self-assigned this Aug 16, 2017
@cdeil cdeil added this to the 0.2 milestone Aug 16, 2017
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.6%) to 96.118% when pulling e2c9c69 on adl1995:progress_bar into a90e5fe on hipspy:master.

@adl1995
Copy link
Member Author

adl1995 commented Aug 16, 2017

@cdeil I made the changes. The tests are passing locally with the progress bar turned on. Let's see if Travis CI build passes.

@cdeil
Copy link
Contributor

cdeil commented Aug 16, 2017

@adl1995 - See the fails on travis-ci. Can you fix or should I explain how?

@adl1995
Copy link
Member Author

adl1995 commented Aug 16, 2017

Okay, the test fails because it can't find the tqdm module. As this is an optional dependency, should I still update the .travis.yml file?

@cdeil
Copy link
Contributor

cdeil commented Aug 16, 2017

As this is an optional dependency, should I still update the .travis.yml file?

I only had a very quick look, but yes, I think you need updates to .travis.yml and also to mark the tests as requires_dependency('tqdm') or to change the tests so that they run with progress_bar=False, no?

@adl1995
Copy link
Member Author

adl1995 commented Aug 16, 2017

I added tqdm as a dependency, however, I haven't marked the tests with requires_dependency('tqdm') as I don't know where to import this marker from.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 96.429% when pulling fcb26cf on adl1995:progress_bar into a90e5fe on hipspy:master.

@@ -79,5 +79,6 @@ The ``hips`` package has the following requirements:
In addition, the following packages are needed for optional functionality:

* `Matplotlib`_ 2.0 or later. Used for plotting in examples.
* `tqdm`_ 4.15 or later. Used for showing progress bar either on terminal or in Jupyter notebook.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would remove the "4.15 or later" here. Probably any tqdm version for years back will work with the basic functionality we use.

setup.py Outdated
@@ -105,6 +105,7 @@
extras_require = dict(
recommended=[
'matplotlib>=2.0',
'tqdm>=4.15',
Copy link
Contributor

Choose a reason for hiding this comment

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

Again: I would suggest to remove the version requirement on tqdm here, because what we use is just simple functionality that probably has been there for a long time.

@cdeil cdeil merged commit 3c394e1 into hipspy:master Aug 17, 2017
@cdeil
Copy link
Contributor

cdeil commented Aug 17, 2017

Thanks!

@cdeil
Copy link
Contributor

cdeil commented Aug 17, 2017

Small follow-up commit in master: 3d06423

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

Successfully merging this pull request may close these issues.

3 participants