sebastian-correa opened a new issue, #33437:
URL: https://github.com/apache/beam/issues/33437

   ### What happened?
   
   When doing
   
   ```
   from apache_beam import Pipeline
   ```
   
   Pylance complains about:
   
   > "Pipeline" is not exported from module "apache_beam". Import from 
"apache_beam.pipeline" insteadPylance[reportPrivateImportUsage 
(https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportPrivateImportUsage)
   
   <img width="688" alt="image" 
src="https://github.com/user-attachments/assets/193fcfd2-4fbf-446a-af5d-76a134d5a2df";
 />
   
   I think that that (and other symbols) imported in the packages `__init__.py` 
are meant to be part of the public interface. However,  Pyalnce requires the 
following semantics to detect them as such:
   
   > Imported symbols are considered private by default. If they use the 
“import A as A” (a redundant module alias), “from X import A as A” (a redundant 
symbol alias), or “from . import A” forms, symbol “A” is not private unless the 
name begins with an underscore (...).
   > A module can expose an `__all__` symbol at the module level that provides 
a list of names that are considered part of the interface. The `__all__` symbol 
indicates which symbols are included in a wildcard import. All symbols included 
in the `__all__` list are considered public even if the other rules above would 
otherwise indicate that they were private.
   
   
[[source](https://github.com/microsoft/pyright/blob/main/docs/typed-libraries.md#library-interface)]
   
   I propose that either redundant aliases or an `__all__` be added to 
`apache_beam`'s `__init__.py` to prevent this.
   
   Probably the `transforms` module, which is `*` imported will need this done 
to it as well (and, well, recursively as `transforms` also imports other 
modules).
   
   ### Issue Priority
   
   Priority: 3 (minor)
   
   ### Issue Components
   
   - [X] Component: Python SDK
   - [ ] Component: Java SDK
   - [ ] Component: Go SDK
   - [ ] Component: Typescript SDK
   - [ ] Component: IO connector
   - [ ] Component: Beam YAML
   - [ ] Component: Beam examples
   - [ ] Component: Beam playground
   - [ ] Component: Beam katas
   - [ ] Component: Website
   - [ ] Component: Infrastructure
   - [ ] Component: Spark Runner
   - [ ] Component: Flink Runner
   - [ ] Component: Samza Runner
   - [ ] Component: Twister2 Runner
   - [ ] Component: Hazelcast Jet Runner
   - [ ] Component: Google Cloud Dataflow Runner


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to