Giter VIP home page Giter VIP logo

poetry-publish's Introduction

poetry-publish

Maintenance Latest release

An action to build and publish python package to PyPI, TestPyPI or a private wheels repo using poetry.

Inputs

python_version

The version of python to install (default: latest). Use default for a shorter build time.

poetry_version

The version of poetry to install (default: latest).

pypi_token

Required API token to authenticate when uploading package to PyPI (You can find your token here).

repository_name

The name of a repository where the package will be uploaded. Necessary if you'd like to upload to test PyPi or a private wheels repo. Uploads to official PyPi if not informed.

repository_url

The URL where the package will be uploaded. Necessary if you'd like to upload to test PyPi or a private wheels repo. Uploads to official PyPi if not informed.

repository_username

The Username to log in into a repository where the package will be uploaded if using http-basic authentification instead of api token.

repository_password

The Password to log in into a repository where the package will be uploaded if using http-basic authentification instead of api token.

build_format

By default, poetry's build command outputs two formats: wheel and sdist. If you intend to use only one of them, you may specify that with the build_format parameter.

poetry_install_options

Adds possibility to pass options to "poetry install" command. Examples:

  • --without dev
  • --only-root
  • --sync

Check the full list here.

poetry_publish_options

Adds possibility to pass options to "poetry publish" command. Examples:

  • --dry-run
  • --build

Check the full list here.

allow_poetry_pre_release

Allow poetry pre-release versions to be installed.

extra_build_dependency_packages

An optional space-separated list of debian packages to be installed before building the package

plugins

An optional space-separated list of poetry plugins to be installed before building the package

package_directory

An optional subdirectory path if poetry package doesn't reside in the main workflow directory

Note: ignore_dev_requirements command is deprecated in version 2.0. Use poetry_install_options: "--without dev" instead

Example usage

The following will build and publish the python package to the PyPI using the last version of python and poetry. Specify the python package version and dependencies in pyproject.toml in the root directory of your project.

- name: Build and publish to pypi
  uses: JRubics/[email protected]
  with:
    pypi_token: ${{ secrets.PYPI_TOKEN }}

Python and poetry versions can be specified in inputs as well as the build_format and allow_poetry_pre_release.

- name: Build and publish to pypi
  uses: JRubics/[email protected]
  with:
    python_version: "3.7.1"
    poetry_version: "==1.0.5" # (PIP version specifier syntax)
    pypi_token: ${{ secrets.PYPI_TOKEN }}
    build_format: "sdist"
    allow_poetry_pre_release: "yes"

Poetry options for install and publish commands can be specified through poetry_install_options and poetry_publish_options.

- name: Build and publish to pypi
  uses: JRubics/[email protected]
  with:
    pypi_token: ${{ secrets.PYPI_TOKEN }}
    poetry_install_options: "--sync --no-root"
    poetry_publish_options: "--dry-run"

Repository can be changed to TestPyPI or a private wheels repo by specifying repository_name and repository_url.

- name: Build and publish to pypi
  uses: JRubics/[email protected]
  with:
    pypi_token: ${{ secrets.PYPI_TOKEN }}
    repository_name: "testpypi"
    repository_url: "https://test.pypi.org/legacy/"

Repository authentication can be changed to http-basic authentification by specifying repository_username and repository_password instead of pypi_token.

- name: Build and publish to private Python package repository
  uses: JRubics/[email protected]
  with:
    repository_name: "foo"
    repository_url: "https://foo.bar/simple/"
    repository_username: "username"
    repository_password: "password"

Extra debian packages can be installed before building the python package. This is particularly useful for packages that do not need to be included in the base image for this action.

- name: Build and publish to pypi
  uses: JRubics/[email protected]
  with:
    pypi_token: ${{ secrets.PYPI_TOKEN }}
    extra_build_dependency_packages: "capnproto libzmq3-dev"

Poetry plugins can be added by specifying plugins input

- name: Build and publish to pypi
  uses: JRubics/[email protected]
  with:
    pypi_token: ${{ secrets.PYPI_TOKEN }}
    plugins: "poetry-dynamic-versioning[plugin]"

Poetry package can be built from a subdirectory. It should be specified as package_directory

- name: Build and publish to pypi
  uses: JRubics/[email protected]
  with:
    pypi_token: ${{ secrets.PYPI_TOKEN }}
    package_directory: "subdirectory"

Example workflow

The following will build and publish the python package when project is tagged in the v*.*.* form.

name: Python package
on:
  push:
    tags:
      - "v*.*.*"
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Build and publish to pypi
        uses: JRubics/[email protected]
        with:
          pypi_token: ${{ secrets.PYPI_TOKEN }}

poetry-publish's People

Contributors

0b11001111 avatar agates avatar brianpugh avatar camilamaia avatar jelenadokic avatar jessebot avatar jrubics avatar ms7m avatar sam-writer avatar tbruno25 avatar thehappydinoa avatar tmcclintock avatar vinigfer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

poetry-publish's Issues

Publish to PyPI via OIDC

How can I publish using PyPI trusted publishers / OIDC ?

I tried using a separate action to get a token, that runs without a problem ,
but publishing still fails on auth with HTTP Error 403: Invalid or non-existent authentication information.

name: Python package to pypi via OIDC
on:
  push:
    tags:
      - "v*.*.*-*"
      - "v*.*.*"
  workflow_dispatch:
jobs:
  publish_pypi:
    runs-on: ubuntu-latest
    # environment: release    
    permissions:
      # IMPORTANT: this permission is mandatory for trusted publishing
      id-token: write
      contents: read
    steps:
      - uses: actions/checkout@v3

      - name: Mint token
        id: mint
        uses: tschm/[email protected]

      - name: Build and publish to pypi
        uses: JRubics/[email protected]
        with:
          pypi_token: "${{ steps.mint.outputs.api-token }}"

accoding to the pypi docs
the username is supposed to be "token", but I cannot find how to make this work with this action

          repository_username: "__token__"
          repository_password: "${{ steps.mint.outputs.api-token }}"

also fails

logs >

ModuleNotFoundError: No module named '_distutils_hack.override'

When running v1.15 of the action, it fails with the following error during the poetry install step. Our test workflow is fine, so I suspect there is some problem in the python setup of the docker image

CalledProcessError

  Command '['/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/bin/python', '-m', 'pip', 'install', '--use-pep517', '--disable-pip-version-check', '--isolated', '--no-input', '--prefix', '/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11', '--no-deps', '/github/home/.cache/pypoetry/artifacts/82/cf/a3/28f141a1649242b80fd32ba63019a43b14c962cd53f37d817d2bedcaf4/lazy-object-proxy-1.8.0.tar.gz']' returned non-zero exit status 2.

  at /usr/local/lib/python3.11/subprocess.py:569 in run
       565│             # We don't call process.wait() as .__exit__ does that for us.
       566│             raise
       567│         retcode = process.poll()
       568│         if check and retcode:
    →  569│             raise CalledProcessError(retcode, process.args,
       570│                                      output=stdout, stderr=stderr)
       571│     return CompletedProcess(process.args, retcode, stdout, stderr)
       572│ 
       573│ 

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/bin/python', '-m', 'pip', 'install', '--use-pep517', '--disable-pip-version-check', '--isolated', '--no-input', '--prefix', '/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11', '--no-deps', '/github/home/.cache/pypoetry/artifacts/82/cf/a3/28f141a1649242b80fd32ba63019a43b14c962cd53f37d817d2bedcaf4/lazy-object-proxy-1.8.0.tar.gz'] errored with the following return code 2, and output: 
  Processing /github/home/.cache/pypoetry/artifacts/82/cf/a3/28f141a1649242b80fd32ba63019a43b14c962cd53f37d817d2bedcaf4/lazy-object-proxy-1.8.0.tar.gz
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
    Preparing metadata (pyproject.toml): started
    Preparing metadata (pyproject.toml): finished with status 'done'
  ERROR: Exception:
  Traceback (most recent call last):
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
      status = run_func(*args)
               ^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
      return func(self, options, args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/commands/install.py", line 400, in run
      requirement_set = resolver.resolve(
                        ^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 73, in resolve
      collected = self.factory.collect_root_requirements(root_reqs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 491, in collect_root_requirements
      req = self._make_requirement_from_install_req(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 453, in _make_requirement_from_install_req
      cand = self._make_candidate_from_link(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 206, in _make_candidate_from_link
      self._link_candidate_cache[link] = LinkCandidate(
                                         ^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 297, in __init__
      super().__init__(
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 162, in __init__
      self.dist = self._prepare()
                  ^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 231, in _prepare
      dist = self._prepare_distribution()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 308, in _prepare_distribution
      return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 491, in prepare_linked_requirement
      return self._prepare_linked_requirement(req, parallel_builds)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 577, in _prepare_linked_requirement
      dist = _get_prepared_distribution(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 69, in _get_prepared_distribution
      abstract_dist.prepare_distribution_metadata(
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/distributions/sdist.py", line 61, in prepare_distribution_metadata
      self.req.prepare_metadata()
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/req/req_install.py", line 535, in prepare_metadata
      self.metadata_directory = generate_metadata(
                                ^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/operations/build/metadata.py", line 35, in generate_metadata
      distinfo_dir = backend.prepare_metadata_for_build_wheel(metadata_dir)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_internal/utils/misc.py", line 706, in prepare_metadata_for_build_wheel
      return super().prepare_metadata_for_build_wheel(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_vendor/pep517/wrappers.py", line 189, in prepare_metadata_for_build_wheel
      return self._call_hook('prepare_metadata_for_build_wheel', {
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_vendor/pep517/wrappers.py", line 319, in _call_hook
      raise BackendUnavailable(data.get('traceback', ''))
  pip._vendor.pep517.wrappers.BackendUnavailable: Traceback (most recent call last):
    File "/github/home/.cache/pypoetry/virtualenvs/ephios-cDQ_M3T8-py3.11/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 77, in _build_backend
      obj = import_module(mod_path)
            ^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
    File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1128, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
    File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
    File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
    File "<frozen importlib._bootstrap_external>", line 940, in exec_module
    File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
    File "/tmp/pip-build-env-pw0qfq_6/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 8, in <module>
      import _distutils_hack.override  # noqa: F401
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ModuleNotFoundError: No module named '_distutils_hack.override'
  
  

  at /usr/local/lib/python3.11/site-packages/poetry/utils/env.py:1540 in _run
      1536│                 output = subprocess.check_output(
      1537│                     command, stderr=subprocess.STDOUT, env=env, **kwargs
      1538│                 )
      1539│         except CalledProcessError as e:
    → 1540│             raise EnvCommandError(e, input=input_)
      1541│ 
      1542│         return decode(output)
      1543│ 
      1544│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:


  PoetryException

  Failed to install /github/home/.cache/pypoetry/artifacts/82/cf/a3/28f141a1649242b80fd32ba63019a43b14c962cd53f37d817d2bedcaf4/lazy-object-proxy-1.8.0.tar.gz

  at /usr/local/lib/python3.11/site-packages/poetry/utils/pip.py:58 in pip_install
       54│ 
       55│     try:
       56│         return environment.run_pip(*args)
       57│     except EnvCommandError as e:
    →  58│         raise PoetryException(f"Failed to install {path.as_posix()}") from e
       59│ 

Poetry can't find toml file while running 'poetry init'

Poetry 1.7.0, python 3.10.12

I'm running 'poetry init' in a directory where I have a small project. I enter all the info and when I get to the point about adding dependencies, it can't find a file. Isn't it supposed to be creating the file?

...
Compatible Python versions [^3.10]:

Would you like to define your main dependencies interactively? (yes/no) [yes]
You can specify a package in the following forms:
  - A single name (requests): this will search for matches on PyPI
  - A name and a constraint (requests@^2.23.0)
  - A git url (git+https://github.com/python-poetry/poetry.git)
  - A git url with a revision (git+https://github.com/python-poetry/poetry.git#develop)
  - A file path (../my-package/my-package.whl)
  - A directory (../my-package/)
  - A url (https://example.com/packages/my-package-0.1.0.tar.gz)

Package to add or search for (leave blank to skip): ssl

Poetry could not find a pyproject.toml file in /home/myname/myproject or its parents

If I create an empty file, it tells me the section is there.

dibbj@W11G92LDK3:~/jira_est_scanner$ touch pyproject.toml
dibbj@W11G92LDK3:~/jira_est_scanner$ poetry init

This command will guide you through creating your pyproject.toml config.

Package name [jira_est_scanner]:
Version [0.1.0]:
Description []:
Author [Jim Dibb <[email protected]>, n to skip]:
License []:
Compatible Python versions [^3.10]:

Would you like to define your main dependencies interactively? (yes/no) [yes]
You can specify a package in the following forms:
  - A single name (requests): this will search for matches on PyPI
  - A name and a constraint (requests@^2.23.0)
  - A git url (git+https://github.com/python-poetry/poetry.git)
  - A git url with a revision (git+https://github.com/python-poetry/poetry.git#develop)
  - A file path (../my-package/my-package.whl)
  - A directory (../my-package/)
  - A url (https://example.com/packages/my-package-0.1.0.tar.gz)

Package to add or search for (leave blank to skip): ssl

[tool.poetry] section not found in /home/dibbj/jira_est_scanner/pyproject.toml

'There is no pypi-token.testpypi setting.'

I'm getting the following error when I try to publish:

There is no pypi-token.testpypi setting.

My GitHub action is:

name: Publish to TestPyPi
on:
  push:
    tags:
      - "v*.*.*"
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Build and publish to pypi
        uses: JRubics/[email protected]
        with:
          pypi_token: ${{ secrets.TESTPYPI_TOKEN }}
          repository_name: "testpypi"
          repository_url: "https://test.pypi.org/legacy/"

Am I doing something wrong? I have a secret TESTPYPI_TOKEN in the GitHub environment. I'm new to docker and not sure how to debug or research this further.

Build with poetry-dynamic-versioning-plugin failure

Hello trying this out but running into a problem.

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Build and publish to pypi
        uses: JRubics/[email protected]
        with:
          pypi_token: ${{ secrets.PYPI_TOKEN }}
          plugins: "poetry-dynamic-versioning-plugin"

Is what my yaml looks like but i get this:

Using version ^0.4.0 for poetry-dynamic-versioning-plugin

Updating dependencies
Resolving dependencies...

Package operations: 4 installs, 0 updates, 0 removals

  • Installing markupsafe (2.1.3)
  • Installing dunamai (1.18.0)
  • Installing jinja2 (3.1.2)
  • Installing poetry-dynamic-versioning-plugin (0.4.0)

Writing lock file

No module named 'poetry.core.semver'

Any ideas?

Publish to a Github repo

I have a question about this package. Is it possible to publish a package to a Github repository?

I'm looking for how to do this but I'm not finding an answer about it.

Can anyone help me with this?

Add support for Private PYServers

Let say I have my PyServer, which is hosted somewhere.

Can it be possible to use this GitHub action to push to that server?

I think it may be helpful to add that as features.

I don't have the bandwidth now. I can have a look into this, I am just writing it here for reference.

May be a good issue for #HackOctoberBest

v1.13 has old entrypoint.sh

I just pulled the v1.13 docker image and inspected the contents. entrypoint.sh still has the old poetry plugin add, can you check it out and release a new version? Thank you so much!

File name reuse

Hey! We're using v1.13 for our package and hitting an issue from pypi about file name reuse. I updated the pyproject.toml to have
version = "0.0.8" but in the workflow we have

Installing the current project: package (0.0.7)
Building package (0.0.7)
  - Building sdist
  - Built package-0.0.7.tar.gz
  - Building wheel
  - Built package-0.0.7-py3-none-any.whl
Using a plaintext file to store credentials

Publishing package (0.0.7) to PyPI
 - Uploading package-0.0.7-py3-none-any.whl 0%`
 - Uploading package-0.0.7-py3-none-any.whl 100%
 
HTTP Error 400: File already exists. See https://pypi.org/help/#file-name-reuse for more information. 

Wondering if I'm missing something?

Using https and username/password fails

When creating an action and uploading to a private repo I get a warning:

Warning: Unexpected input(s) 'repository_username', 'repository_password', valid inputs are ['entryPoint', 'args', 'python_version', 'poetry_version', 'pypi_token', 'build_format', 'repository_name', 'repository_url', 'ignore_dev_requirements', 'allow_poetry_pre_release']

and an error:

ValueError

  There is no pypi-token.REPONAME setting.

  at /root/.pyenv/versions/3.9.6/lib/python3.9/site-packages/poetry/console/commands/config.py:153 in handle
      149│                 self.line(str(value))
      150│             else:
      151│                 values = self.unique_config_values
      152│                 if setting_key not in values:
    → 153│                     raise ValueError("There is no {} setting.".format(setting_key))
      154│ 
      155│                 value = config.get(setting_key)
      156│ 
      157│                 if not isinstance(value, str):

The action is defined as:

name: Python package
on:
  push:
jobs:
    build:
      runs-on: ubuntu-20.04
      steps:
         - uses: actions/checkout@v2
         - name: Build and publish to pypi
           uses: JRubics/[email protected]
           with:
             python_version: "3.9"
             build_format: "sdist"
             allow_poetry_pre_release: "yes"
             ignore_dev_requirements: "yes"
             repository_name: "REPONAME"
             repository_url: "REPOURL"
             repository_username: ${{ secrets.USER }}
             repository_password: ${{ secrets.PW }}

My best guess is that it has something to do with the if-statement in the .sh, that controls if a token should be used or the user/pw combo.

if [ -z $9 ] || [ -z ${10} ]; then

pip version is outdated

Hi! pip version should be updated before running poetry!

WARNING: You are using pip version 19.2.3, however version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

error: can't find Rust compiler 257

Description

Installation fails on cryptograpghy

        =============================DEBUG ASSISTANCE=============================
        If you are seeing a compilation error please try the following steps to
        successfully install cryptography:
        1) Upgrade to the latest pip and try again. This will fix errors for most
           users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
        2) Read https://cryptography.io/en/latest/installation.html for specific
           instructions for your platform.
        3) Check our frequently asked questions for more information:
           https://cryptography.io/en/latest/faq.html
        4) Ensure you have a recent Rust toolchain installed:
           https://cryptography.io/en/latest/installation.html#rust
        5) If you are experiencing issues with Rust for *this release only* you may
           set the environment variable `CRYPTOGRAPHY_DONT_BUILD_RUST=1`.
        =============================DEBUG ASSISTANCE=============================
    
    error: can't find Rust compiler
    
    If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
    
    To update pip, run:
    
        pip install --upgrade pip
    
    and then retry package installation.
    
    If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
    
    This package requires Rust >=1.41.0.
    
    ----------------------------------------
Command "/root/.pyenv/versions/3.6.10/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-xjp81yos/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-prs95ot0/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-xjp81yos/cryptography/

You are using pip version 18.1, however version 21.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Example

https://github.com/scanapi/scanapi/pull/358/checks?check_run_id=2393161740

Ralated

python-poetry/poetry#3661

Docker USER is root

using JRubics/[email protected]

Running into problems signing artifacts, finding that my dist directory is root owned
And it looks like the docker file is root based

-rw-r--r-- 1 runner docker 17067 Oct  7 21:59 LICENSE.md
-rw-r--r-- 1 runner docker  256 Oct 7 21:59 README.md
drwxr-xr-x 2 root   root    4096 Oct  7 21:59 dist

Looks like the default user is runner / docker from at least actions/checkout@v3

Suspect it's also the cause of a few other warnings like

WARNING: The directory '/github/home/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Collecting poetry

Issues with python-openssl

My builds for https://github.com/timfi/dotmatrix seem to keep failing due to the docker container not being able to locate the python-openssl package. It tries 3 times and then just dies.

Logs: https://github.com/timfi/dotmatrix/runs/3349910304?check_suite_focus=true
Important snippet: ↓

  Step 1/8 : FROM python:slim
  slim: Pulling from library/python
  99046ad9247f: Pulling fs layer
  dae61f727682: Pulling fs layer
  466485ee6277: Pulling fs layer
  de739b056673: Pulling fs layer
  1374279231a5: Pulling fs layer
  de739b056673: Waiting
  1374279231a5: Waiting
  dae61f727682: Verifying Checksum
  dae61f727682: Download complete
  466485ee6277: Verifying Checksum
  466485ee6277: Download complete
  de739b056673: Verifying Checksum
  de739b056673: Download complete
  1374279231a5: Verifying Checksum
  1374279231a5: Download complete
  99046ad9247f: Download complete
  99046ad9247f: Pull complete
  dae61f727682: Pull complete
  466485ee6277: Pull complete
  de739b056673: Pull complete
  1374279231a5: Pull complete
  Digest: sha256:7bd2c014c1dc07330ebbef41927bfd82668e2322916820cd3ffff5e390bc04fd
  Status: Downloaded newer image for python:slim
   ---> c6e50ab8d425
  Step 2/8 : ENV PYENV_ROOT=/root/.pyenv
   ---> Running in fc8106d596dd
  Removing intermediate container fc8106d596dd
   ---> 6faf77993212
  Step 3/8 : ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
   ---> Running in 0f2b9fa65fb2
  Removing intermediate container 0f2b9fa65fb2
   ---> 22f048c910f8
  Step 4/8 : RUN apt-get update     && apt-get install -y --no-install-recommends       build-essential       curl       git       libbz2-dev       libffi-dev       liblzma-dev       libncurses5-dev       libncursesw5-dev       libreadline-dev       libsqlite3-dev       libssl-dev       llvm       make       python-openssl       tk-dev       wget       xz-utils       zlib1g-dev     && apt-get clean     && rm -rf /var/lib/apt/lists/*
   ---> Running in 7b6d934bd73f
  Get:1 http://deb.debian.org/debian bullseye InRelease [113 kB]
  Get:2 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
  Get:3 http://deb.debian.org/debian bullseye-updates InRelease [36.8 kB]
  Get:4 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [25.4 kB]
  Get:5 http://deb.debian.org/debian bullseye/main amd64 Packages [8178 kB]
  Fetched 8397 kB in 2s (5500 kB/s)
  Reading package lists...
  Reading package lists...
  Building dependency tree...
  Reading state information...
  E: Unable to locate package python-openssl
  The command '/bin/sh -c apt-get update     && apt-get install -y --no-install-recommends       build-essential       curl       git       libbz2-dev       libffi-dev       liblzma-dev       libncurses5-dev       libncursesw5-dev       libreadline-dev       libsqlite3-dev       libssl-dev       llvm       make       python-openssl       tk-dev       wget       xz-utils       zlib1g-dev     && apt-get clean     && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100

Upload files to PyPi show 'SignatureDoesNotMatch' errors

This GH action worked fine in the past (last file published April 5), but current uploads show the 'SignatureDoesNotMatch' for the uploaded files. My PyPi Secrets hasn't changed since the last time I published a release.

Didn't notice any discernable errors in the gh action logs, but here's the tail of the build & publish log.

Installing the current project: metron-tagger (1.2.6)
Building metron-tagger (1.2.6)
  - Building sdist
  - Built metron-tagger-1.2.6.tar.gz
  - Building wheel
  - Built metron_tagger-1.2.6-py3-none-any.whl
No suitable keyring backends were found
Using a plaintext file to store and retrieve credentials

No suitable keyring backends were found
Publishing metron-tagger (1.2.6) to PyPI
Using a plaintext file to store and retrieve credentials
 - Uploading metron-tagger-1.2.6.tar.gz 0%
 - Uploading metron-tagger-1.2.6.tar.gz 21%
 - Uploading metron-tagger-1.2.6.tar.gz 100%

 - Uploading metron-tagger-1.2.6.tar.gz 100% - Uploading metron_tagger-1.2.6-py3-none-any.whl 0%
 - Uploading metron_tagger-1.2.6-py3-none-any.whl 100%

 - Uploading metron_tagger-1.2.6-py3-none-any.whl 100%

Python version not found

I have a workflow that specifies python_version:

name: Project
on:
  push:
    tags:
      - "v*.*.*"
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Build and publish to pypi
        uses: JRubics/[email protected]
        with:
          python_version: "3.9.13"
          repository_name: private-repo
          repository_url: https:///private-pypi-repo/
          repository_username: ${{ secrets.USERNAME }}
          repository_password: ${{ secrets.PASSWORD }}

But the action errors out, saying it cannot find that python version:

usr/bin/docker run --name jrubicspoetrypublishv111_ba7e15 --label 4cd98f --workdir /github/workspace --rm -e INPUT_REPOSITORY_NAME -e INPUT_REPOSITORY_URL -e INPUT_REPOSITORY_USERNAME -e INPUT_REPOSITORY_PASSWORD -e INPUT_PYTHON_VERSION -e INPUT_ALLOW_POETRY_PRE_RELEASE -e INPUT_IGNORE_DEV_REQUIREMENTS -e INPUT_POETRY_VERSION -e INPUT_PYPI_TOKEN -e INPUT_BUILD_FORMAT -e INPUT_EXTRA_BUILD_DEPENDENCY_PACKAGES -e INPUT_PLUGINS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e GITHUB_STEP_SUMMARY -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/project/project":"/github/workspace" jrubics/poetry-publish:v1.11  "3.9.13" "latest" "" "private-repo" "https://private-pypi-repo/" "" "yes" "yes" "***" "***" "" ""
pyenv: Version '3.9.13' is not found.

It looks like 3.9.13 was added in pyenv so perhaps I'm formatting the workflow variables incorrectly?

Issue with File Permissions on dist/ files

I'm working in a GitHub Enterprise environment that uses self-hosted machines to run github actions. The github actions are run under a non-root foo user. Because docker runs as a root / privileged user, the dist/ files this action creates end up on the host machine with root permissions. Then, when the action reruns, the foo user does not have permissions to checkout & cleanup the previously created files.

Some ideas I've had to try to resolve this but figure I'd raise the issue here:

  • Have the action automatically clean up the dist/ files from the shared volume regardless of success / failure status.
  • Add an additional step to delete the docker volume prior to checkout.
  • Add an argument to the action to have it transfer ownership of the dist/ folder to $userArgValue

What do you think would make the most sense given the issue?

Allow publish from subdirectory

Hello!

I wanted to use this action to publish a package residing in a subdirectory, but I couldn't find a way to do this.

Would it be possible to add a like a path variable to the action from where the publish command will be called?

Thanks!

Fail on mismatched version

Poetry will publish to pypi using the version present in pyproject.toml.

If someone creates a github action using the following syntax:

on:
  release:
    types: [published]

Then it's possible that they'll create a github release that doesn't match the version present in pyproject.toml.

Github Actions support if conditions prior to running this github action, however if is tricky because poetry_version isn't in scope. Because poetry is installed in a Docker container, the github runner won't have access to run a command like poetry version -s to access the version.

I'd like to propose the addition of the VERIFY_GITHUB_TAG_VERSION bool argument to short-circuit if the github tag and the poetry version don't match.

ChefBuildError

The build of my programlib library fails with the following

Installing collected packages: trove-classifiers, ptyprocess, fastjsonschema, distlib, urllib3, tomlkit, shellingham, rapidfuzz, pyproject-hooks, pycparser, poetry-core, platformdirs, pkginfo, pexpect, packaging, msgpack, more-itertools, jeepney, installer, idna, filelock, crashtest, charset-normalizer, certifi, virtualenv, requests, jaraco.classes, dulwich, cleo, cffi, build, requests-toolbelt, cryptography, cachecontrol, SecretStorage, keyring, poetry-plugin-export, poetry
Successfully installed SecretStorage-3.3.3 build-1.0.3 cachecontrol-0.13.1 certifi-2024.2.2 cffi-1.16.0 charset-normalizer-3.3.2 cleo-2.1.0 crashtest-0.4.1 cryptography-42.0.2 distlib-0.3.8 dulwich-0.21.7 fastjsonschema-2.19.1 filelock-3.13.1 idna-3.6 installer-0.7.0 jaraco.classes-3.3.1 jeepney-0.8.0 keyring-24.3.0 more-itertools-10.2.0 msgpack-1.0.7 packaging-23.2 pexpect-4.9.0 pkginfo-1.9.6 platformdirs-3.11.0 poetry-1.7.1 poetry-core-1.8.1 poetry-plugin-export-1.6.0 ptyprocess-0.7.0 pycparser-2.21 pyproject-hooks-1.0.0 rapidfuzz-3.6.1 requests-2.31.0 requests-toolbelt-1.0.0 shellingham-1.5.4 tomlkit-0.12.3 trove-classifiers-2024.1.31 urllib3-2.2.0 virtualenv-20.25.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Notice:  A new release of pip is available: 23.2.1 -> 24.0
Notice:  To update, run: pip install --upgrade pip
Creating virtualenv programlib-cDQ_M3T8-py3.12 in /github/home/.cache/pypoetry/virtualenvs
Updating dependencies
Resolving dependencies...

Package operations: 5 installs, 0 updates, 0 removals

  • Installing ptyprocess (0.7.0)
  • Installing wcwidth (0.2.13)
  • Installing numpy (1.24.4)
  • Installing pexpect (4.9.0)
  • Installing pyte (0.8.2)

  ChefBuildError

  Backend 'setuptools.build_meta:__legacy__' is not available.
  
  Traceback (most recent call last):
    File "/usr/local/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
      obj = import_module(mod_path)
            ^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
    File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
    File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
    File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
    File "<frozen importlib._bootstrap_external>", line 994, in exec_module
    File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
    File "/tmp/tmpkolr5chf/.venv/lib/python3.12/site-packages/setuptools/__init__.py", line 10, in <module>
      import distutils.core
  ModuleNotFoundError: No module named 'distutils'
  

  at /usr/local/lib/python3.12/site-packages/poetry/installation/chef.py:164 in _prepare
      160│ 
      161│                 error = ChefBuildError("\n\n".join(message_parts))
      162│ 
      163│             if error is not None:
    → 164│                 raise error from None
      165│ 
      166│             return path
      167│ 
      [168](https://github.com/vadim0x60/programlib/actions/runs/7916527733/job/21610561007#step:4:169)│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with numpy (1.24.4) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "numpy (==1.24.4)"'.

Building and publishing locally with poetry publish --build works just fine

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.