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/09 19:55:34 UTC

[GitHub] [beam-starter-python] davidcavazos opened a new pull request, #1: Initial commit

davidcavazos opened a new pull request, #1:
URL: https://github.com/apache/beam-starter-python/pull/1

   Initial commit on Python starter project.
   
   R: @pcoet @aaltay @kennknowles 


-- 
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


[GitHub] [beam-starter-python] davidcavazos commented on pull request #1: Initial commit

Posted by GitBox <gi...@apache.org>.
davidcavazos commented on PR #1:
URL: https://github.com/apache/beam-starter-python/pull/1#issuecomment-1151580480

   Tests are passing on my fork. https://github.com/davidcavazos/beam-starter-python/actions/runs/2470953410


-- 
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


[GitHub] [beam-starter-python] pcoet commented on a diff in pull request #1: Initial commit

Posted by GitBox <gi...@apache.org>.
pcoet commented on code in PR #1:
URL: https://github.com/apache/beam-starter-python/pull/1#discussion_r897106461


##########
CONTRIBUTING.md:
##########
@@ -0,0 +1,69 @@
+# Contributing
+
+🎉🎊 Thanks for taking the time to contribute! 🎉🎊
+
+There are many ways to contribute, here are some.
+
+## Filing an issue
+
+If there's any issue you encounter or anything that needs to be fixed, feel free to [create JIRA issue](https://issues.apache.org/jira/secure/CreateIssue!default.jspa).
+
+## Contributing to this starter project
+
+If this is your first time contributing to a GitHub repo,
+we recommmend going through the
+[GitHub quickstart](https://docs.github.com/en/get-started/quickstart/hello-world).
+
+It's a good idea to discuss your plans with the Beam community through the dev@beam.apache.org mailing list before doing any changes.
+
+Here's a small overview of the process.
+
+1. [Fork the repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo).
+
+1. Clone the repo.
+
+    ```sh
+    export GITHUB_USERNAME="my-github-username"
+
+    git clone git@github.com:$GITHUB_USERNAME/beam-starter-python.git
+    ```
+
+1. Set the [upstream remote branch](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/configuring-a-remote-for-a-fork).
+
+    ```sh
+    cd beam-starter-python
+    git remote add upstream git@github.com:apache/beam-starter-python.git
+    ```
+
+1. Create and change to a new branch.
+
+    ```sh
+    git checkout -B my-branch-name
+    ```
+
+1. Modify the code! 😱
+
+1. Run the tests. For steps on how to run them see the [`README.md`](README.md).
+
+1. Commit and push your changes to your branch in `origin`.
+
+    ```sh
+    git commit -m "one line description of your changes"
+    git push
+    ```
+
+1. [Create a Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
+
+1. Add reviewers, and [address review comments](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests).
+
+1. Once it's approved, we can merge the Pull Request.
+
+For more information about proposing changes to a GitHub repository, see the
+[Propose changes](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches)
+page in the GitHub docs.
+
+## Contributing to Apache Beam
+
+For information on how to contribute to
+[Apache Beam](https://github.com/apache/beam), see to the

Review Comment:
   "see to the" -> "see the"



##########
README.md:
##########
@@ -0,0 +1,78 @@
+# Apache Beam starter for Python
+
+If you want to clone this repository to start your own project,
+you can choose the license you prefer and feel free to delete anything related to the license you are dropping.
+
+## Before you begin
+
+Make sure you have a [Python 3](https://www.python.org/) development environment ready.
+If you don't, you can follow the instructions in the
+[Python 3 Installation & Setup Guide](https://realpython.com/installing-python/).

Review Comment:
   You might consider linking to the official Python docs, instead of RealPython. Or at least use link text that indicates it's RealPython.



##########
.github/PULL_REQUEST_TEMPLATE.md:
##########
@@ -0,0 +1,12 @@
+**Please** add a meaningful description for your change here
+
+------------------------
+
+Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
+
+ - [ ] I agree that my contributions are licensed with both [Apache ASL2](../../LICENSE-APACHE) and [MIT](../../LICENSE-MIT).
+ - [ ] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`).
+ - [ ] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.

Review Comment:
   +1 to enabling GitHub issues on these.



-- 
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


[GitHub] [beam-starter-python] aaltay commented on pull request #1: Initial commit

Posted by GitBox <gi...@apache.org>.
aaltay commented on PR #1:
URL: https://github.com/apache/beam-starter-python/pull/1#issuecomment-1151568022

   R: @tvalentyn - could one of the python folks review this?
   
   @davidcavazos - how did you verify this?


-- 
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


[GitHub] [beam-starter-python] davidcavazos commented on a diff in pull request #1: Initial commit

Posted by GitBox <gi...@apache.org>.
davidcavazos commented on code in PR #1:
URL: https://github.com/apache/beam-starter-python/pull/1#discussion_r897127951


##########
README.md:
##########
@@ -0,0 +1,78 @@
+# Apache Beam starter for Python
+
+If you want to clone this repository to start your own project,
+you can choose the license you prefer and feel free to delete anything related to the license you are dropping.
+
+## Before you begin
+
+Make sure you have a [Python 3](https://www.python.org/) development environment ready.
+If you don't, you can follow the instructions in the
+[Python 3 Installation & Setup Guide](https://realpython.com/installing-python/).

Review Comment:
   Changed it to the Python downloads page



-- 
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


[GitHub] [beam-starter-python] aaltay commented on pull request #1: Initial commit

Posted by GitBox <gi...@apache.org>.
aaltay commented on PR #1:
URL: https://github.com/apache/beam-starter-python/pull/1#issuecomment-1151617179

   @davidcavazos - please ping if we do not complete review in a week or so.


-- 
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


[GitHub] [beam-starter-python] davidcavazos commented on a diff in pull request #1: Initial commit

Posted by GitBox <gi...@apache.org>.
davidcavazos commented on code in PR #1:
URL: https://github.com/apache/beam-starter-python/pull/1#discussion_r897067226


##########
.github/PULL_REQUEST_TEMPLATE.md:
##########
@@ -0,0 +1,12 @@
+**Please** add a meaningful description for your change here
+
+------------------------
+
+Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
+
+ - [ ] I agree that my contributions are licensed with both [Apache ASL2](../../LICENSE-APACHE) and [MIT](../../LICENSE-MIT).
+ - [ ] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`).
+ - [ ] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.

Review Comment:
   That's good to know, I'll update the Java starter project with this as well. Can we enable GitHub issues on all the starter project repos? That way we can have their own issues on their own repo rather than pointing to the core Beam issues.



-- 
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


[GitHub] [beam-starter-python] tvalentyn commented on a diff in pull request #1: Initial commit

Posted by GitBox <gi...@apache.org>.
tvalentyn commented on code in PR #1:
URL: https://github.com/apache/beam-starter-python/pull/1#discussion_r896890208


##########
.github/PULL_REQUEST_TEMPLATE.md:
##########
@@ -0,0 +1,12 @@
+**Please** add a meaningful description for your change here
+
+------------------------
+
+Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
+
+ - [ ] I agree that my contributions are licensed with both [Apache ASL2](../../LICENSE-APACHE) and [MIT](../../LICENSE-MIT).
+ - [ ] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`).
+ - [ ] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.

Review Comment:
   Beam now uses github issues tracker.



##########
my_app/app.py:
##########
@@ -0,0 +1,27 @@
+# Copyright 2022 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+# https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+# <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+# option. This file may not be copied, modified, or distributed
+# except according to those terms.
+
+from typing import Callable, Optional
+import apache_beam as beam
+from apache_beam.options.pipeline_options import PipelineOptions
+
+
+def run(
+    input_text: str,
+    beam_options: Optional[PipelineOptions] = None,
+    test: Callable[[beam.PCollection], None] = lambda _: None,
+) -> None:
+    with beam.Pipeline(options=beam_options) as pipeline:
+        elements = (
+            pipeline
+            | "Create elements" >> beam.Create(["Hello", "World!", input_text])
+            | "Print elements" >> beam.Map(lambda x: print(x) or x)

Review Comment:
   this a little hacky. maybe add a helper that prints+returns/yields a value?



##########
README.md:
##########
@@ -0,0 +1,78 @@
+# Apache Beam starter for Python
+
+If you want to clone this repository to start your own project,
+you can choose the license you prefer and feel free to delete anything related to the license you are dropping.
+
+## Before you begin
+
+Make sure you have a [Python 3](https://www.python.org/) development environment ready.
+If you don't, you can follow the instructions in the
+[Python 3 Installation & Setup Guide](https://realpython.com/installing-python/).
+
+We recommend using a virtual environment to isolate your project's dependencies.
+
+```sh
+# Create a new Python virtual environment.
+python -m venv env
+
+# Activate the virtual environment.
+source env/bin/activate
+```
+
+While activated, your `python` and `pip` commands will point to the virtual environment,
+so any changes or install dependencies are self-contained.
+
+As a one time setup, let's install the project's dependencies from the [`requirements.tx`](requirements.txt) file.

Review Comment:
   ```suggestion
   As a one time setup, let's install the project's dependencies from the [`requirements.txt`](requirements.txt) file.
   ```



##########
CONTRIBUTING.md:
##########
@@ -0,0 +1,69 @@
+# Contributing
+
+🎉🎊 Thanks for taking the time to contribute! 🎉🎊
+
+There are many ways to contribute, here are some.
+
+## Filing an issue
+
+If there's any issue you encounter or anything that needs to be fixed, feel free to [create JIRA issue](https://issues.apache.org/jira/secure/CreateIssue!default.jspa).

Review Comment:
   ditto



-- 
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


[GitHub] [beam-starter-python] kennknowles merged pull request #1: Initial commit

Posted by GitBox <gi...@apache.org>.
kennknowles merged PR #1:
URL: https://github.com/apache/beam-starter-python/pull/1


-- 
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


[GitHub] [beam-starter-python] davidcavazos commented on pull request #1: Initial commit

Posted by GitBox <gi...@apache.org>.
davidcavazos commented on PR #1:
URL: https://github.com/apache/beam-starter-python/pull/1#issuecomment-1151573661

   I ran the tests locally `python -m unittest -v`, but it looks like GitHub Actions is not enabled in this repo so the tests aren't running automatically.


-- 
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


[GitHub] [beam-starter-python] davidcavazos commented on a diff in pull request #1: Initial commit

Posted by GitBox <gi...@apache.org>.
davidcavazos commented on code in PR #1:
URL: https://github.com/apache/beam-starter-python/pull/1#discussion_r897068572


##########
my_app/app.py:
##########
@@ -0,0 +1,27 @@
+# Copyright 2022 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+# https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+# <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+# option. This file may not be copied, modified, or distributed
+# except according to those terms.
+
+from typing import Callable, Optional
+import apache_beam as beam
+from apache_beam.options.pipeline_options import PipelineOptions
+
+
+def run(
+    input_text: str,
+    beam_options: Optional[PipelineOptions] = None,
+    test: Callable[[beam.PCollection], None] = lambda _: None,
+) -> None:
+    with beam.Pipeline(options=beam_options) as pipeline:
+        elements = (
+            pipeline
+            | "Create elements" >> beam.Create(["Hello", "World!", input_text])
+            | "Print elements" >> beam.Map(lambda x: print(x) or x)

Review Comment:
   You're right, actually we can just mock the print function to the identity function in the tests, so we can call print directly from here.



-- 
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