Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] PyPI workflow in actions does not work #35

Closed
hmasdev opened this issue Aug 6, 2021 · 2 comments · Fixed by #44
Closed

[BUG] PyPI workflow in actions does not work #35

hmasdev opened this issue Aug 6, 2021 · 2 comments · Fixed by #44
Assignees
Labels
bug Something isn't working

Comments

@hmasdev
Copy link
Owner

hmasdev commented Aug 6, 2021

Describe the bug

PyPI workflow in actions, which runs when released, returns exit code 1 during uploading .whl and .tar.gz with twine.

https://github.com/hmasdev/pyjpboatrace/actions/runs/1103843756

Environment

  • OS: Ubuntu 20.04.2 LTS
  • Python Version: 3.7.11 (actions/setup-python@v1)

To Reproduce (Probabily)

Steps to reproduce the behavior:

  1. Go to https://github.com/hmasdev/pyjpboatrace/releases
  2. Click on "Draft a new release"
  3. Input tag version, title and description.
  4. Click on "Publish release", which triggers PyPI workflow.
  5. Error during PyPI workflow in Upload step as follows:
    Traceback (most recent call last):
       File "/home/runner/.local/share/virtualenvs/pyjpboatrace-cg8vEFYy/bin/twine", line 5, in <module>
         from twine.__main__ import main
       File "/home/runner/.local/share/virtualenvs/pyjpboatrace-cg8vEFYy/lib/python3.8/site-packages/twine/__init__.py", line 27, in <module>
         import importlib_metadata
    ModuleNotFoundError: No module named 'importlib_metadata'
    Error: Process completed with exit code 1.

Expected behavior

Twine succeeds in uploading .whl and .tar.gz to pypi server.

Uploading distributions to https://upload.pypi.org/legacy/
Uploading pyjpboatrace-0.2.0-py3-none-any.whl
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 63.5k/63.5k [00:02<00:00, 24.2kB/s]
Uploading pyjpboatrace-0.2.0.tar.gz
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 50.3k/50.3k [00:01<00:00, 31.2kB/s] 

View at:
https://pypi.org/project/pyjpboatrace/0.2.0/

Problems

If this bug is not fixed, we can not upload this package to pypi automatically, that is, manual operation is required when uploading.

Reasons (Optional)

Checking the log, I found pipenv uses python 3.8.10 as follows:

Creating a virtualenv for this project...
Pipfile: /home/runner/work/pyjpboatrace/pyjpboatrace/Pipfile
Using /usr/bin/python3.8 (3.8.10) to create virtualenv...
created virtual environment CPython3.8.10.final.0-64 in 694ms

This is probably a reason for this bug.

See https://stackoverflow.com/a/59734959/16567832

@hmasdev hmasdev added the bug Something isn't working label Aug 6, 2021
@hmasdev
Copy link
Owner Author

hmasdev commented Aug 11, 2021

The reason why Python 3.8 is used when creating a virtual environment even though Python 3.7 is specified in https://github.com/hmasdev/pyjpboatrace/blob/main/.github/workflows/pypi.yaml is probably because the default python version is 3.8 and any version is not specified in Pipfile or Pipfile.lock.

@hmasdev hmasdev self-assigned this Aug 11, 2021
@hmasdev
Copy link
Owner Author

hmasdev commented Aug 12, 2021

The document of pipenv recommends not to keep Pipfile.lock in version control if multiple versions of Python are being targeted.

This project is a package for python 3.7, 3.8 and 3.9. So the version of Pipfile.lock should not to be maintained in this project.

@hmasdev hmasdev linked a pull request Aug 12, 2021 that will close this issue
@hmasdev hmasdev closed this as completed Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant