You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/06/04 19:50:33 UTC

[GitHub] [beam] damccorm opened a new issue, #20825: Add pyright to CI

damccorm opened a new issue, #20825:
URL: https://github.com/apache/beam/issues/20825

   Since for Python besides mypy the other big type checker is pyright (used by Visual Studio Code), add it to CI to ensure code appeases both checkers.
   
   Might find things that mypy overlooked.
   
   Imported from Jira [BEAM-12004](https://issues.apache.org/jira/browse/BEAM-12004). Original Jira may contain additional context.
   Reported by: abergmeier.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Add pyright to CI [beam]

Posted by "damccorm (via GitHub)" <gi...@apache.org>.
damccorm commented on issue #20825:
URL: https://github.com/apache/beam/issues/20825#issuecomment-1843057722

   I don't think anyone is looking at this right now, and its unfortunately one of the lower priority items in the issue queue at the moment. Someone may be interested in picking it up, but there is no planned work as of now. Tagging @abergmeier (the original reporter) in case they have any suggestions or workarounds


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Add pyright to CI [beam]

Posted by "lazarillo (via GitHub)" <gi...@apache.org>.
lazarillo commented on issue #20825:
URL: https://github.com/apache/beam/issues/20825#issuecomment-1842726469

   Any update on this?  Or any suggestions on workarounds?  I can just tell pyright (or pylance in my case, but it's built on pyright) to ignore all of the mistakes, but that doesn't seem ideal.
   
   FWIW, I find errors with PValue and PCollection happening a lot.  For example:
   
   
   ```python
   class IngestPubSub(PTransform):
       def expand(self, pcoll: PCollection[bytes]):
           dict_data: PCollection[dict] = pcoll | "parse json strings" >> FlatMap(
               json_load
           ).with_output_types(dict)
           obj_data: PCollection[Person] = dict_data | "create Person objects" >> FlatMap(
               object_load, container=Person
           ).with_output_types(Person)
   ```
   
   where `Person` is a simple dataclass.  This runs fine, and there are no errors if I remove the type hints.  The type hints send the flags.  But I want them for clarity of the code base.
   
   (For those who are curious, I use `FlatMap` instead of `Map` because I am allowing for errors in parsing, which means I am _either_ returning a list of length 1 with the proper object, or an empty list.  If I turn that to `Map`, then I have to allow for returning `None`, which AFAICT breaks the pipeline... it cannot receive a `None` object.)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org