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

Introduces Linting (pylint) and Static Checking (mypy) for the SDK #411

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

davidvonthenen
Copy link
Contributor

@davidvonthenen davidvonthenen commented Jun 10, 2024

Proposed changes

Implements: #390

This PR is pretty large, to say the least, because it introduces linting (using pylint) and static checking (using mypy - previously, I was going to use pyright). To introduce linting and static checking for PRs, you need to fix all of the issues that it flags. This happened to be a lot issues because during the development of v3 of this SDK, style (aka linting) and certain type checks (aka mypy) was lacking intentionally in order to meet the timeline for release. Since python is pretty forgiving in the type check department, we deferred that until now.

The user can test their compliance with pylint and mypy locally by invoking the same process used in the GitHub actions as follows:

  • make lint
  • make static

GitHub actions run for this PR:

Other notable changes:

  • this introduces 2 new GitHub actions to check for pylint and mypy issues for new PRs and on main
  • observes python best practices to use _ for class scoping
  • (THIS HAPPENED TO BE A LARGE PART OF THE CHANGES IN THIS PR) had to change @dataclass_json annotations (now just extends the DataClassJsonMixin class in dataclass_json because the project doesn't implement a pylint plugin for linting
  • for all the Latest classes, these just needed to be alias definitions instead of extending the class since the linter through that was better (agreed because we weren't introducing any new variables, functions, etc)

NOTES:

  • These changes should NOT be breaking changes.
  • Ran all examples in order to verify nothing, in fact, has changed.
  • Will refactor a little in a subsequent PR for functions that duplicate a lot of code. Currently, there are some disable pylint and mypy checks for certain functions to make sure the functionality/behavior of the SDK doesn't change.

Types of changes

What types of changes does your code introduce to the community Python SDK?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update or tests (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • I have lint'ed all of my code using repo standards
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

NA

@davidvonthenen davidvonthenen changed the title PyLint Introduces Linting (pylint) and Static Checking (mypy) for the SDK Jun 10, 2024
@davidvonthenen davidvonthenen force-pushed the implement-pylint branch 4 times, most recently from 18ea338 to db4c991 Compare June 11, 2024 14:35
@davidvonthenen davidvonthenen merged commit 3177017 into deepgram:main Jun 11, 2024
6 checks passed
@davidvonthenen davidvonthenen deleted the implement-pylint branch July 12, 2024 00:12
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