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

Ignore Pyright error in create_dagster_package.py #21688

Merged

Conversation

maximearmstrong
Copy link
Contributor

@maximearmstrong maximearmstrong commented May 7, 2024

Summary & Motivation

This PR adds a #type: ignore to 2 lines in scripts/create_dagster_package.py so that Pyright stops yelling. No changes were made to the script in one year, so this is most likely coming from a new Pyright version.

Also, disables the Pyright rule reportUnnecessaryTypeIgnoreComment for the same reasons as in #21525

Local error:

python scripts/run-pyright.py --all
Creating temporary pyright config file at pyrightconfig-alt-1.json
Running pyright for environment `alt-1`...
  pyright --project=pyrightconfig-alt-1.json --outputjson --level=warning --warnings
Creating temporary pyright config file at pyrightconfig-master.json
Running pyright for environment `master`...
  pyright --project=pyrightconfig-master.json --outputjson --level=warning --warnings

/Users/maximearmstrong/Documents/Repositories/dagster-io/dagster/scripts/create_dagster_package.py:
  102:56: Argument of type "TextIOWrapper" cannot be assigned to parameter "fp" of type "str | IO[bytes]" in function "dump"
  Type "TextIOWrapper" cannot be assigned to type "str | IO[bytes]"
    "TextIOWrapper" is incompatible with "str"
    "TextIOWrapper" is incompatible with "IO[bytes]"
      Type parameter "AnyStr@IO" is invariant, but "str" is not the same as "bytes" (reportArgumentType)

  127:15: Argument of type "TextIOWrapper" cannot be assigned to parameter "fp" of type "str | IO[bytes]" in function "dump"
  Type "TextIOWrapper" cannot be assigned to type "str | IO[bytes]"
    "TextIOWrapper" is incompatible with "str"
    "TextIOWrapper" is incompatible with "IO[bytes]"
      Type parameter "AnyStr@IO" is invariant, but "str" is not the same as "bytes" (reportArgumentType)

pyright 1.1.356
Finished in 49.03 seconds
Analyzed 3440 files
Found 2 errors
Found 0 warnings
make: *** [pyright] Error 1

BK error

How I Tested These Changes

make rebuild_pyright_pins
make pyright

BK

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @maximearmstrong and the rest of your teammates on Graphite Graphite

@maximearmstrong maximearmstrong self-assigned this May 7, 2024
@maximearmstrong maximearmstrong marked this pull request as ready for review May 7, 2024 16:07
@maximearmstrong maximearmstrong merged commit 4e0719c into master May 9, 2024
1 check passed
@maximearmstrong maximearmstrong deleted the maxime/ignore-pyright-error-in-create-dagster-package branch May 9, 2024 20:02
danielgafni pushed a commit to danielgafni/dagster that referenced this pull request Jun 18, 2024
## Summary & Motivation

This PR adds a `#type: ignore` to 2 lines in
`scripts/create_dagster_package.py` so that Pyright stops yelling. No
changes were made to the script in one year, so this is most likely
coming from a new Pyright version.

Also, disables the Pyright rule `reportUnnecessaryTypeIgnoreComment` for
the same reasons as in dagster-io#21525

Local error:

```
python scripts/run-pyright.py --all
Creating temporary pyright config file at pyrightconfig-alt-1.json
Running pyright for environment `alt-1`...
  pyright --project=pyrightconfig-alt-1.json --outputjson --level=warning --warnings
Creating temporary pyright config file at pyrightconfig-master.json
Running pyright for environment `master`...
  pyright --project=pyrightconfig-master.json --outputjson --level=warning --warnings

/Users/maximearmstrong/Documents/Repositories/dagster-io/dagster/scripts/create_dagster_package.py:
  102:56: Argument of type "TextIOWrapper" cannot be assigned to parameter "fp" of type "str | IO[bytes]" in function "dump"
  Type "TextIOWrapper" cannot be assigned to type "str | IO[bytes]"
    "TextIOWrapper" is incompatible with "str"
    "TextIOWrapper" is incompatible with "IO[bytes]"
      Type parameter "AnyStr@IO" is invariant, but "str" is not the same as "bytes" (reportArgumentType)

  127:15: Argument of type "TextIOWrapper" cannot be assigned to parameter "fp" of type "str | IO[bytes]" in function "dump"
  Type "TextIOWrapper" cannot be assigned to type "str | IO[bytes]"
    "TextIOWrapper" is incompatible with "str"
    "TextIOWrapper" is incompatible with "IO[bytes]"
      Type parameter "AnyStr@IO" is invariant, but "str" is not the same as "bytes" (reportArgumentType)

pyright 1.1.356
Finished in 49.03 seconds
Analyzed 3440 files
Found 2 errors
Found 0 warnings
make: *** [pyright] Error 1
```

[BK
error](https://buildkite.com/dagster/dagster-dagster/builds/82305#018f4f19-b9a3-4d04-9525-40678bb5ede0)

## How I Tested These Changes

```
make rebuild_pyright_pins
make pyright
```
BK
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.

None yet

2 participants