kedro-org / kedro-plugins

First-party plugins maintained by the Kedro team.
Apache License 2.0
91 stars 84 forks source link

`kedro-telemetry`: Implement telemetry message notification #727

Closed DimedS closed 2 months ago

DimedS commented 3 months ago

Description

Part of https://github.com/kedro-org/kedro-plugins/issues/715:

Implement a new telemetry message to inform users about anonymous usage data collection:

Kedro is sending anonymous usage data with the sole purpose of improving the product. No personal data or IP addresses are stored on our side. 
If you want to opt out, set the `KEDRO_DISABLE_TELEMETRY` or `DO_NOT_TRACK` environment variables, or create a  `.telemetry` file in the current working directory with the contents `consent: false`.
Read more at https://docs.kedro.org/en/latest/configuration/telemetry.html

Display that message after:

  1. Kedro installation with pip install kedro command.
  2. Each kedro command: once per kedro command execution when the kedro-telemetry plugin was used to send telemetry (consent wasn't disabled).

QUESTION PLEASE COMMENT: Should we message something If consent was disabled Currently, the message displayed when consent is disabled is:

Kedro-Telemetry is installed, but you have opted out of
sharing usage analytics so none will be collected.
DimedS commented 2 months ago

Regarding point 1, I tried several approaches to print a message after the pip installcommand. The best result I achieved was printing something in verbose mode (-v) during the pip install . command (or during the package build stage) using the setup.pyfile. Based on my investigation, it appears there is currently no way to print a message after installing from a .whl file. Therefore, I propose removing this requirement and focusing solely on point 2. I also checked that other packages with opt-out telemetry do not print anything after pip install. @astrojuanlu

astrojuanlu commented 2 months ago

I think it will be difficult or outright impossible to display it after pip install. Precompiled wheels are just unzip && cp, no chance to give any message.

astrojuanlu commented 2 months ago

Oh I see how my phrasing led you into investigating this. Yeah, enough with Kedro commands.

DimedS commented 2 months ago

Oh I see how my phrasing led you into investigating this. Yeah, enough with Kedro commands.

I reread your phrase and understand that it seems you mean installing Kedro and then executing kedro run and then printing. I interpreted it slightly differently)) However, it would actually be great to print it after running pip install kedro, before the user executes any command, but it looks like there really is no way to do that.