Skip to content

Fix failing lint checks and update broken typings - #105

Merged
michael-linnane-lrn merged 5 commits into
masterfrom
Learnosity/fix/fix-failing-lint-checks
Aug 4, 2026
Merged

Fix failing lint checks and update broken typings#105
michael-linnane-lrn merged 5 commits into
masterfrom
Learnosity/fix/fix-failing-lint-checks

Conversation

@michael-linnane-lrn

@michael-linnane-lrn michael-linnane-lrn commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

This pull request introduces several improvements and fixes across the codebase, primarily focusing on enhanced type safety, expanded Data API support, and improved CI reliability. The most notable changes include stricter type checks for request handling, the addition of Data API configuration and demo, and fixes for mypy lint errors and missing type imports.

Type Safety and Request Handling Improvements

  • Updated all checks for self.request in learnosity_sdk/request/init.py to use isinstance(self.request, dict) for safer type handling, preventing runtime errors and making the code more robust. [1] [2] [3] [4]

Data API Enhancements

  • Added Data API configuration to request signatures and introduced a Data API demo to the standalone demos, expanding the SDK's capabilities.

CI and Linting Reliability

  • Fixed mypy errors that were causing lint check failures during CI builds, ensuring smoother and more reliable automated testing.
  • Added missing import for types-setuptools in setup.py to resolve type checking issues during testing.

Setup Script Improvements

  • Explicitly typed the version dictionary in setup.py for better clarity and compatibility with type checkers.

Checklist

  • Feature

  • Bug

  • Security

  • Documentation

  • ChangeLog.md updated

  • Tests added

  • All testsuites passed

  • make dist completed successfully

  • Bump package version if release coming

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR resolves type-checking issues by enhancing type safety throughout the SDK, particularly in request handling and configuration. The changes primarily address mypy lint failures that were affecting CI builds and add Data API support to expand the SDK's functionality.

Key changes include:

  • Replaced is not None checks with isinstance(self.request, dict) throughout request handling code for stricter type safety
  • Added explicit type annotations and missing type stub imports to resolve mypy errors
  • Updated ChangeLog.md to document the Data API additions and lint fixes

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
setup.py Added type annotation for version dictionary and types-setuptools dependency to resolve type checking issues
learnosity_sdk/request/init.py Replaced null checks with isinstance() checks for safer dictionary type handling across multiple service methods
ChangeLog.md Documented Data API additions and mypy error fixes for this release

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ChangeLog.md Outdated
Comment thread learnosity_sdk/request/init.py
@jack-oconnor-lrn

Copy link
Copy Markdown

Looks good to me 💪.

I had to make this fix during the hackathon for the Data API demo. Might be worth fixing here in this PR as well if updating the docs to mention Data API is added to the demos

@jack-oconnor-lrn jack-oconnor-lrn left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Agreed to address the signature hashing bug in a separate PR

@michael-linnane-lrn
michael-linnane-lrn force-pushed the Learnosity/fix/fix-failing-lint-checks branch from ddea1f8 to 376ae69 Compare August 4, 2026 15:14
Codacy flags 'assert' statements since they are stripped under
Python's -O optimization flag. The removed asserts existed only to
narrow Optional/union types for mypy, not to verify behaviour, so
replace them with a small as_dict() helper: a real isinstance() check
that raises AssertionError with a useful message on mismatch, and
narrows the type for mypy without resorting to typing.cast (which
performs no runtime check and can silently hide type errors).
@michael-linnane-lrn
michael-linnane-lrn merged commit a187c69 into master Aug 4, 2026
8 checks passed
@michael-linnane-lrn
michael-linnane-lrn deleted the Learnosity/fix/fix-failing-lint-checks branch August 4, 2026 15:51
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.

3 participants