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

Build config and Debug mode #796

Merged
merged 3 commits into from
Jul 30, 2024
Merged

Build config and Debug mode #796

merged 3 commits into from
Jul 30, 2024

Conversation

Jolanrensen
Copy link
Collaborator

This PR adds the buildconfig plugin to the project.

This achieves two things:

  • It allows us to access the gradle project version via BuildConfig.VERSION. We can use this well in the Jupyter integration where we're often interested which dataframe version is pulled into the notebook when doing a %use dataframe.
  • It helps with type: KType in DataColumnImpl mismatches actual values sometimes #713.
    By simply adding -Pkotlin.dataframe.debug=true to the build on TC, we can run the extra checks from the issue. By default this check should be off, as it costs performance, but it's very valuable for catches bugs. We can use BuildConfig.DEBUG in other places in the future as well.

See each commit for more info.

We should add the flag to TC only after #713 is solved completely, otherwise all builds will fail.

* This only runs with `kotlin.dataframe.debug=true` in gradle.properties
*/
if (BuildConfig.DEBUG) {
require(values.all { it matches type }) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It checks all values, right? Is it worth to check random 10-20 numbers from the column?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we only check a handful of values there's a chance we won't catch the outlier and get flaky tests.

# Enables debug mode for dataframe.
# This can make certain tests run that should not be run in production.
# It can also be turned on from the command line with `-Pkotlin.dataframe.debug=true`
kotlin.dataframe.debug=false
Copy link
Collaborator

Choose a reason for hiding this comment

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

does it mean, that we could add more modes, with different names, it's not a strongly-defined schema?

Copy link
Collaborator Author

@Jolanrensen Jolanrensen Jul 30, 2024

Choose a reason for hiding this comment

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

indeed, just an argument I came up with. Similar to the add.ksp argument.
It's not strongly typed, but when read it tries to parse the argument as Boolean and if failed it defaults to false

…enabled. Updated contribution guide too. TC will have to be updated manually
@Jolanrensen Jolanrensen merged commit aea1e14 into master Jul 30, 2024
3 checks passed
@Jolanrensen
Copy link
Collaborator Author

Thanks!

Copy link
Contributor

Generated sources will be updated after merging this PR.
Please inspect the changes in here.

@Jolanrensen Jolanrensen deleted the buildConfig branch July 30, 2024 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants