-
Notifications
You must be signed in to change notification settings - Fork 89
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
Fix kedro-telemetry
dependency breaking packaged projects without pyproject.toml
#84
Conversation
…m dependencies Signed-off-by: Jannic Holzer <jannic.holzer@quantumblack.com>
kedro-telemetry
dependency breaking packaged projects without pyproject.toml
Signed-off-by: Jannic Holzer <jannic.holzer@quantumblack.com>
def _get_project_properties( | ||
hashed_username: str, project_metadata: ProjectMetadata | ||
hashed_username: str, project_metadata: Optional[ProjectMetadata] = None | ||
) -> Dict: | ||
|
||
hashed_package_name = _hash(project_metadata.package_name) | ||
hashed_project_name = _hash(project_metadata.project_name) | ||
project_version = project_metadata.project_version | ||
if project_metadata: | ||
hashed_package_name = _hash(project_metadata.package_name) | ||
hashed_project_name = _hash(project_metadata.project_name) | ||
project_version = project_metadata.project_version | ||
else: | ||
hashed_package_name = hashed_project_name = project_version = "undefined" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As Ivan mentioned yesterday, it may be possible to get these metadata via kedro.framework.project
. package_name
and project_name
are almost always the same.
Another out-of-scope question is, does the KedroCLITelemetry
work with the packaged project then?
…roject_name Signed-off-by: Jannic Holzer <jannic.holzer@quantumblack.com>
Signed-off-by: Jannic Holzer <jannic.holzer@quantumblack.com>
…e imported Signed-off-by: Jannic Holzer <jannic.holzer@quantumblack.com>
To be more precise, this is supposed to be the version of the "starter" used. This is a good point though maybe the version of |
You're right about this, @yetudada it would be great to hear your thoughts on whether we should upload either:
to Heap. The context for this question is that currently option 1 is implemented, though option 2. is easier and safer and is currently what this PR will do. |
The version used to create the project and the version of Kedro being used to run the project are the same. If you used an older version of Kedro to create the project e.g. |
Hmm, what about the case where the starter is e.g. 0.18.2 and the version of Kedro that is installed is 0.18.3? This is the case locally in one of my projects and I think it is valid. |
Ah my bad! I thought the check was more strict and checking for a full version match. In that case I agree with you that we should just send the version of Kedro that's being used to run the project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this. I think using the Kedro version is fine!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes a lot of sense thanks for looking into this. 🌟
Don't forget to update the release notes with this fix! ✍️ |
Signed-off-by: Jannic Holzer <jannic.holzer@quantumblack.com>
* Update RELEASE.md for changes in #84 Signed-off-by: Jannic Holzer <jannic.holzer@quantumblack.com> * Fix tense Signed-off-by: Jannic Holzer <jannic.holzer@quantumblack.com> * Update version to 0.2.3 Signed-off-by: Jannic Holzer <jannic.holzer@quantumblack.com> Signed-off-by: Jannic Holzer <jannic.holzer@quantumblack.com>
Description
Resolves #83.
Development notes
Currently, when
kedro-telemetry
is installed in a packaged project that is deployed without apyproject.toml
file, aRuntimeError
is thrown which prevents Kedro from being used at all in this way. It is currently necessary to readpyproject.toml
to get three pieces of information about the project, which are then sent to heap:In the case that nopyproject.toml
is present, I believe there is no other guaranteed 'source of truth' for these values. Therefore, my approach is to set these values to the stringundefined
in this case.Instead of using
pyproject.toml
to find these values, this PR makes the following changes:from kedro.framework.project import PACKAGE_NAME
.from kedro import __version__
. This is the version of Kedro being used to run the project, which I feel is more important than the version of Kedro used to create the project. Feedback would be appreciated on this point.pyproject.toml
is therefore no longer read at all.Note: in the case that
kedro.framework.project.PACKAGE_NAME
isNone
,hashed_package_name
will be set toundefined
. I am not sure when this would ever happen, but I think it would be better to have some value here that will at least stop the plugin from breaking the project if this case ever occurs.Checklist
RELEASE.md
file