Skip to content

Add monitoring missing dependency: pandas - #5100

Closed
kabute wants to merge 5 commits into
googleapis:masterfrom
kabute:monitoring-pandas-dep
Closed

Add monitoring missing dependency: pandas#5100
kabute wants to merge 5 commits into
googleapis:masterfrom
kabute:monitoring-pandas-dep

Conversation

@kabute

Copy link
Copy Markdown

Add missing pandas dependency as per:

google/cloud/monitoring/_dataframe.py
google/cloud/monitoring/client.py
google/cloud/monitoring/query.py

@kabute
kabute requested a review from waprin as a code ownerMarch 23, 2018 13:29
@googlebotgooglebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 23, 2018
@kabute

Copy link
Copy Markdown
Author

(Fixed unit testing for pandas)

@tswast

Copy link
Copy Markdown
Contributor

Pandas should probably be an "extras" as was done here: #4354

@kabute

Copy link
Copy Markdown
Author

Given that client query will break (Pandas seems to be a hard dependency), can I suggest changes to?

  • Add the dependency to the README (indicate users this fact).
  • Fix unit testing (won't pass, including coverage) and put pandas tests on its own file.

@tswast
tswast requested a review from theacodesMarch 26, 2018 16:25
@theacodes

Copy link
Copy Markdown
Contributor

It's fine with me if this needs to directly depend on Pandas. Is the query method the most commonly used method here?

@tseaver

Copy link
Copy Markdown
Contributor

@jonparrott It looks like pandas should only be a conditional dependency: folks who want to use the rest of the package, but not use query.as_dataframe, shouldn't need to install that rather large dependency.

@theacodes

Copy link
Copy Markdown
Contributor

Okay so it's not needed to query, just need to do query.as_dataframe. In which case, yeah, this should just be optional.

@kabute

Copy link
Copy Markdown
Author

Then extras is probably the best way to go (and add the conditional back on the unit testing). What do you think?

@kabute

Copy link
Copy Markdown
Author

Added pandas as optional (and documented how to install it).

Comment threadmonitoring/setup.py Outdated
'google-api-core<2.0.0dev,>=0.1.1',
]
extras = {
'optional': ['pandas>=0.22.0'],

This comment was marked as spam.

This comment was marked as spam.

Comment threadmonitoring/README.rst

**Pandas:**

Pandas is an optional dependency that is needed if *query.as_dataframe* is used.

This comment was marked as spam.

Comment threadmonitoring/README.rst

To install pandas package run:

$ pip install --upgrade .[pandas]

This comment was marked as spam.

try:
import pandas
except ImportError:
except ImportError: # pragma: NO COVER

This comment was marked as spam.

HAVE_PANDAS = False
else:
HAVE_PANDAS = True # pragma: NO COVER
else: # pragma: NO COVER

This comment was marked as spam.



class Test__sorted_resource_labels(unittest.TestCase):
class Test__sorted_resource_labels(unittest.TestCase): # pragma: NO COVER

This comment was marked as spam.

@tseavertseaver added packaging api: monitoring Issues related to the Cloud Monitoring API. labels Apr 18, 2018
@theacodes

Copy link
Copy Markdown
Contributor

superseded by #5212

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: monitoringIssues related to the Cloud Monitoring API.cla: yesThis human has signed the Contributor License Agreement.packaging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@kabute@tswast@theacodes@tseaver@googlebot