mozilla / mozanalysis

A library for Mozilla experiments analysis
https://mozilla.github.io/mozanalysis/
Mozilla Public License 2.0
10 stars 13 forks source link

add deprecation warning for metric helper imports #208

Closed jaredsnyder closed 6 months ago

jaredsnyder commented 7 months ago

This PR fixes #171 . Deprecation warnings were added to all the helper variables in metrics. When one tries to import, the output looks like this:

>>> from mozanalysis.metrics.desktop import clients_daily
/Users/jsnyder/code/mozanalysis/src/mozanalysis/metrics/desktop.py:13: DeprecationWarning: 
    metrics and data sources created in mozanalysis are deprecated
    please create directly from metric-hub with ConfigLoader like

    from mozanalysis.config import ConfigLoader
    metric=ConfigLoader.get_metric(metric_slug="active_hours",app_name="firefox_desktop")

    and data sources like
    data_source=ConfigLoader.get_data_source(data_source_slug="active_hours",
                                                app_name="firefox_desktop")

  warnings.warn(
codecov-commenter commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.51%. Comparing base (6470ca1) to head (4cb4b40). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #208 +/- ## ========================================== + Coverage 79.45% 79.51% +0.05% ========================================== Files 23 23 Lines 1027 1030 +3 ========================================== + Hits 816 819 +3 Misses 211 211 ``` | [Flag](https://app.codecov.io/gh/mozilla/mozanalysis/pull/208/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mozilla) | Coverage Δ | | |---|---|---| | [project](https://app.codecov.io/gh/mozilla/mozanalysis/pull/208/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mozilla) | `79.51% <100.00%> (+0.05%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mozilla#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

jaredsnyder commented 7 months ago

@danielkberry Should we also add a deprecation warning to segements ?

m-d-bowerman commented 7 months ago

@danielkberry Should we also add a deprecation warning to segements ?

Yeah, a deprecation warning should be added for Segment and SegmentDataSource, too

jaredsnyder commented 7 months ago

@danielkberry Should we also add a deprecation warning to segements ?

Yeah, a deprecation warning should be added for Segment and SegmentDataSource, too

Just pushed this