Skip to content

Action fails when setupotools.setup values are parsed from text file #85

@mspronesti

Description

@mspronesti

I'm playing around with a dummy python package to understand how to properly use this action. This is my workflow file:

name: Upload Python Package

on:
  release:
    types: [published]

jobs:
  deploy:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: '3.x'
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install build
    - name: Build package
      run: python -m build
    - name: Publish package
      uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
      with:
        user: __token__
        password: ${{ secrets.PYPI_API_TOKEN }}

It fails giving

FileNotFoundError: [Errno 2] No such file or directory: '<my_pkg_name>/VERSION.txt'
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools >= 40.8.0, wheel)
* Getting dependencies for sdist...
* Building sdist...
* Building wheel from sdist
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools >= 40.8.0, wheel)
* Getting dependencies for wheel...

ERROR Backend subproccess exited when trying to invoke get_requires_for_build_wheel
Error: Process completed with exit code 1.

whenever I try to do something like this:

import setuptools
import os

# loading version number from path
VERSION_PATH = os.path.join(os.path.dirname(__file__), "<my_pkg_name>", "VERSION.txt")
with open(VERSION_PATH, "r") as version_file:
    version = version_file.read().strip()

setuptools.setup(
    ...
    version=version,
    ...

If I specify the version number by hand it works as expected.
The very same error appears if I try to parse the description from the README.
Am I doing anything wrong ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem rightquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions