Skip to content

PDFCLOUD-5416 Use basedpyright#3

Merged
datalogics-cgreen merged 18 commits intopdfrest:mainfrom
datalogics-kam:pdfcloud-5416-use-basedpyright
Dec 11, 2025
Merged

PDFCLOUD-5416 Use basedpyright#3
datalogics-cgreen merged 18 commits intopdfrest:mainfrom
datalogics-kam:pdfcloud-5416-use-basedpyright

Conversation

@datalogics-kam
Copy link
Copy Markdown
Contributor

Use basedpyright, it's the easiest to use type checker at the moment. It also allows us to up some strictness, and baseline known warnings to clean up later.

  • Remove mypy; it's annoying to have more than one type checker.
  • basedpyright has some advantages over pyright in terms of installation and operation.

See: https://docs.basedpyright.com/v1.31.4/
Integrate basedpyright with your IDE: https://docs.basedpyright.com/v1.31.4/installation/ides/

@datalogics-kam datalogics-kam force-pushed the pdfcloud-5416-use-basedpyright branch 2 times, most recently from fad2758 to 79972f5 Compare November 25, 2025 22:38
@datalogics-kam datalogics-kam force-pushed the pdfcloud-5416-use-basedpyright branch from 212217c to 5286be8 Compare November 26, 2025 21:35
@datalogics-cgreen datalogics-cgreen self-requested a review December 1, 2025 15:46
@datalogics-kam datalogics-kam force-pushed the pdfcloud-5416-use-basedpyright branch from 5286be8 to 37b6245 Compare December 1, 2025 22:09
- Going to replace pyright with basedpyright and use strict checking
  there.
- But not from pre-commit
- Not used in the base class anyway.
- This is a convention.
- Ensures that all ignored return values are explicit, helping to avoid
  bugs.
- Imported from typing_extensions for compatibility
Pydantic before validators deal with semi-unstructured data that will
get fully validated when they reach the model, so ignore Pyright's
complaints about unknown types.
...in fixture-like objects
- Only consume prebuilt wheels when building this package
@datalogics-kam datalogics-kam force-pushed the pdfcloud-5416-use-basedpyright branch from 37b6245 to ed5d9cb Compare December 3, 2025 22:22
Copy link
Copy Markdown
Contributor

@datalogics-cgreen datalogics-cgreen left a comment

Choose a reason for hiding this comment

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

I successfully installed basedpyright and observed it run with pre-commit.

There were no errors, but several warnings:

basedpyright.............................................................Failed
- hook id: basedpyright
- exit code: 1

<my-path>noxfile.py
  <my-path>/noxfile.py:14:5 - warning: Result of call expression is of type "Action" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
  <my-path>/noxfile.py:15:5 - warning: Result of call expression is of type "Action" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
  <my-path>/noxfile.py:30:5 - warning: Result of call expression is of type "Any | None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
  <my-path>/noxfile.py:39:5 - warning: Result of call expression is of type "Any | None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
0 errors, 4 warnings, 0 notes

none of which I regard as red flags, but it would be nice to knock 'em out if possible, while basedpyright is in the spotlight here.

@datalogics-kam
Copy link
Copy Markdown
Contributor Author

noxfile.py wasn't in the list of included files for pyright, but since pre-commit does each file by name, basedpyright obeys and looks at the file.

I added noxfile.py to the include list and fixed the issues.

(pre-commit isn't recommended for pyright, you'll notice it doesn't run basedpyright in pre-commit in CI, it has its own job. The recommendation is to install it in your IDE, and have the IDE warn you and CI as a backup, but since it's new, I'm helping do a transition)

@datalogics-cgreen datalogics-cgreen merged commit 0e28699 into pdfrest:main Dec 11, 2025
9 checks passed
@datalogics-kam datalogics-kam deleted the pdfcloud-5416-use-basedpyright branch December 11, 2025 16:25
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