FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Github Action doesn't find Poetry · Issue #723 · python-semantic-release/python-semantic-release · GitHub

Repository navigation

Github Action doesn't find Poetry #723

Description

The problem

I am trying to use the semantic release GitHub Action. My build step is poetry build, and I am using snok/install-poetry@v1 (via packetcoders/action-setup-cache-python-poetry@main) to install Poetry. This fails with

🛠 Running build command: poetry build
bash: line 1: poetry: command not found

Presumably because semantic-release is running inside a Docker container without access to the previously installed Poetry.

As a side note, my builds are incredibly slow because the two semantic-release actions must be built from dockerfiles each time. Those two build steps take almost a minute each (compared to the cached install of Python and Poetry which takes only 10 seconds total).

Expected behavior

My project is built correctly.

Environment

Ubuntu github runner with Python 3.11 and Poetry 1.6.1, but those are probably not relevant due to containerization.
The workflow looks like this:

      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: "Setup Python, Poetry and Dependencies"
        uses: packetcoders/action-setup-cache-python-poetry@main
        with:
          python-version: 3.11
          poetry-version: 1.6.1
      - name: Python Semantic Release
        id: release
        uses: python-semantic-release/python-semantic-release@v8.0.0
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          prerelease: "true"

      - name: Publish package distributions to GitHub Releases
        uses: python-semantic-release/upload-to-gh-release@main
        if: steps.release.outputs.released == 'true'
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}

Configuration

[build-system]
requires = [ "poetry-core" ]
build-backend = "poetry.core.masonry.api"

[tool.semantic_release]
version_toml = [ "pyproject.toml:tool.poetry.version" ]
build_command = "poetry build"
version_source = "tag"
commit_version_number = true
commit_message = "chore(release): v{version} [skip ci]"

Activity

  1. added
    bugSomething isn't working properly
    on Sep 28, 2023
  2. zckv commented on Oct 3, 2023

    Contributor

    Hello 👋

    You are right, this is not working due to containerization. This should be working fine if PR #692 is merged.

    A possible workaround is to install poetry in the build-command ('pip install poetry; poetry install; poetry build') but it is ugly.

  3. billsioros commented on Nov 25, 2023

    Hello everyone 👋🏽,

    I'm facing a similar issue. More specifically, poetry fails to detect the python version passed to python-semantic-release:

    The currently activated Python version 3.10.13 is not supported by the project (^3.11).
    Trying to find and use a compatible version. 
    
    Poetry was unable to find a compatible version. If you have one, you can explicitly use it via the "env use" command.
    error: Encountered a bad command exit code!
    error: 
    error: Command: 'pip install poetry && poetry build'
    

    even though setup python installs the appropriate version of python:

    2023-11-25T08:18:28.1280144Z Run relekang/python-semantic-release@v7.34.6
    2023-11-25T08:18:28.1280994Z with:
    2023-11-25T08:18:28.1282057Z   github_token: ***
    2023-11-25T08:18:28.1282575Z   directory: .
    2023-11-25T08:18:28.1283193Z env:
    2023-11-25T08:18:28.1284066Z   pythonLocation: /home/github/actions-runner/_work/_tool/Python/3.11.6/x64
    2023-11-25T08:18:28.1285513Z   PKG_CONFIG_PATH: /home/github/actions-runner/_work/_tool/Python/3.11.6/x64/lib/pkgconfig
    2023-11-25T08:18:28.1286955Z   Python_ROOT_DIR: /home/github/actions-runner/_work/_tool/Python/3.11.6/x64
    2023-11-25T08:18:28.1288182Z   Python2_ROOT_DIR: /home/github/actions-runner/_work/_tool/Python/3.11.6/x64
    2023-11-25T08:18:28.1289495Z   Python3_ROOT_DIR: /home/github/actions-runner/_work/_tool/Python/3.11.6/x64
    2023-11-25T08:18:28.1290870Z   LD_LIBRARY_PATH: /home/github/actions-runner/_work/_tool/Python/3.11.6/x64/lib
    

    Edit: I have already tried instralling poetry using python -m pip install poetry instead of simply running pip install poetry

    Could you please assist me ? Thanks!

  4. zckv commented on Nov 27, 2023

    Contributor

    Hello @billsioros 👋

    I think your configuration don't work because the Python interpreter used in the action is python3.10, the default in debian based environment. I think the simplest fix is to allow python3.10 in your pyproject.toml.

    Else you may use the specific version 8.3.0 of python-semantic-release that don't work with a docker action but with a composite action. You should still need to install python3.11 in the job step environment.

    I hope this help !

  5. billsioros commented on Nov 28, 2023

    Hello @zckv 👋🏽

    Thank you for the prompt response! I resolved the issues by editing pyproject.toml for the time being and I'll consider migrating to v8 in the near future.

    Thanks!

  6. Yelinz commented on Jan 8, 2024

    You are right, this is not working due to containerization. This should be working fine if PR #692 is merged.

    So after following the discussion rabbit hole it seems that this is still not fixed (#741)?
    Or did I miss something and there is a way to use poetry without having to do the install hack

  7. zckv commented on Jan 9, 2024

    Contributor

    Hello @Yelinz 👋

    This issue is still not fixed in the master branch. However, the specific tag v8.3.0 use the change in PR #692. Personally I use

        - uses: python-semantic-release/python-semantic-release@v8.3.0
    

    to have access to the environment.

    I am too lazy (for now) to make a script compatible for every gitlab-runner available and complete #741. To use the PSR master branch, the hack should still work, I think.

  8. added
    confirmedPrevent from becoming stale
    and removed on Jun 29, 2024
  9. 9 remaining items

  10. github-actions commented on Dec 30, 2024

    It has been 60 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue?

  11. codejedi365 commented on Dec 30, 2024

    Contributor

    Still in backlog

  12. github-actions commented on Mar 2, 2025

    It has been 60 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue?

  13. codejedi365 commented on Mar 2, 2025

    Contributor

    Still in backlog

    Link #685

  14. github-actions commented on May 2, 2025

    It has been 60 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue?

  15. codejedi365 commented on May 2, 2025

    Contributor

    Still in backlog

  16. github-actions commented on Aug 1, 2025

    It has been 90 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working properlyconfirmedPrevent from becoming staleneeds-updateNeeds status update from maintainers

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL