You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "BorisQuanLi (via GitHub)" <gi...@apache.org> on 2025/07/14 04:34:27 UTC

[PR] fix(setup.py): modernize packaging and require setuptools>=80.9.0 for Python 3.12 compatibility [beam-starter-python]

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

   ### Problems/Issues Solved
   - Packaging errors in Python 3.12 environments due to outdated `setuptools`.
   - Lack of clarity and constraints in `setup.py` regarding Python version and requirements parsing.
   - Outdated installation instructions in `README.md`.
   
   ### Summary
   This PR modernizes `setup.py` and updates documentation to ensure smooth installation and usage in Python 3.12 environments. It adds a minimum required version for `setuptools`, improves requirements parsing, and aligns the README with the updated workflow.
   
   ### Changes
   1. **setup.py**
      - Added `setuptools>=80.9.0` to `install_requires` to resolve packaging errors in Python 3.12.
      - Improved parsing of `requirements.txt` to filter out comments and empty lines.
      - Updated package name to follow kebab-case convention.
      - Added `python_requires=">=3.8"` constraint.
      - Improved version string format to `1.0.0`.
   
   2. **README.md**
      - Fixed markdown syntax highlighting for installation commands.
      - Updated instructions to reflect the improved Python 3.12 compatibility workflow.
   
   ### Testing
   - Created a virtual environment with Python 3.12.
   - Upgraded `pip` and `setuptools` to the latest versions.
   - Successfully installed the package with `pip install -e .`.
   - Attempted to run `pytest` but encountered a `ModuleNotFoundError` due to the absence of a test setup in the upstream repository (unrelated to this PR).
   
   ### Reproduction Steps
   1. Clone the repository and switch to the `fix/setup-py-improvements` branch:
      ```bash
      git clone https://github.com/apache/beam-starter-python.git
      cd beam-starter-python
      git checkout fix/setup-py-improvements
      ```
   2. Create a Python 3.12 virtual environment:
      ```bash
      python3.12 -m venv venv
      source venv/bin/activate
      ```
   3. Upgrade `pip` and `setuptools`:
      ```bash
      pip install --upgrade pip setuptools
      ```
   4. Install the package:
      ```bash
      pip install -e .
      ```
   5. (Optional) Attempt to run tests:
      ```bash
      pytest
      ```
      Note: Running `pytest` may result in a `ModuleNotFoundError` due to the absence of a test setup in the upstream repository.
   
   ### Notes
   - This PR specifically addresses Python 3.12 compatibility. From what I heard at last week's [Beam Summit 2025](https://beamsummit.org/program/), Python 3.13+ support is being addressed separately by the Apache Beam team.
   - Platform details: WSL2 Ubuntu 22.04, Python 3.12.11, pip 25.1.1, setuptools 80.9.0.
   
   ### Checklist
   - [x] Modernized `setup.py` for Python 3.12 compatibility.
   - [x] Updated `README.md` to reflect the improved installation workflow.
   - [x] Verified installation in a Python 3.12 virtual environment.
   - [x] Documented reproduction steps and


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