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

Type hinting improvements - mypy conformance #2051

Merged
merged 49 commits into from
Mar 14, 2024

Conversation

ADBond
Copy link
Contributor

@ADBond ADBond commented Mar 12, 2024

Decreasing the number of mypy errors Getting the code to pass mypy, mainly through adjusting type hints and renaming variables.

I have added a github workflow for type-hinting - under the assumption that I probably won't fix all the issues in this PR, I will switch it off before requesting review, and then switch on when doing further work, leaving it on eventually when it's all sorted which is now passing. If it is too prohibitive for the moment, we can always disable it while we get things tightened up.

Have also cut out some of mypy checking, for now, to make it easier to build up to full conformance in pieces (slowly adding in all modules + rules).

More substantial changes:

  • Settings is now always dialected
  • fix some logic in SettingsCreator.from_path_or_dict
  • split out and slightly simplified the logic for getting cluster ids in cluster_studio if not supplied
  • SplinkDataFrame now an abstract base class
  • misc.read_resource has guard for missing file
  • test for tf_adjustment_chart

Note on @final and property/setters - these doesn't really work with mypy, so there is no way (afaict) to properly guard these against being overridden by subclasses. What you can do is @final after @some_att.setter, and mypy will be happy, but it will not complain if subclasses overwrite this. Have left it there as at least a hint to devs that they shouldn't implement these, even if it won't be enforced by mypy.

From 148 errors down to 0.

@ADBond ADBond changed the title [WIP] Type hinting improvements Type hinting improvements - mypy conformance Mar 14, 2024
@ADBond ADBond marked this pull request as ready for review March 14, 2024 10:10
@ADBond ADBond requested a review from RobinL March 14, 2024 10:10
@ADBond ADBond merged commit 50e0008 into splink4_dev Mar 14, 2024
11 checks passed
@ADBond ADBond deleted the type-hinting-improvements branch March 14, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants