Skip to content

poetry-core 2.0.0 and 2.0.1 wheels include .pyc files #10160

@richardxia

Description

@richardxia

Description

Just to be clear, I am talking about the releases to the poetry-core package on PyPI (i.e. https://pypi.org/project/poetry-core/2.0.1/#files), and not wheels for other packages built by poetry.

It looks like between poetry-core 1.9.1 and 2.0.0, .pyc files started appearing in the wheel files. You can verify this with the following commands:

# Download wheels
$ pip download poetry-core==1.9.1
$ pip download poetry-core==2.0.0
$ pip download poetry-core==2.0.1

# No results, as expected
$ unzip -l poetry_core-1.9.1-py3-none-any.whl | grep \.pyc | head

$ unzip -l poetry_core-2.0.1-py3-none-any.whl | grep \.pyc | head
      413  01-01-2016 00:00   poetry/core/__pycache__/__init__.cpython-310.pyc
    17875  01-01-2016 00:00   poetry/core/__pycache__/factory.cpython-310.pyc
     2042  01-01-2016 00:00   poetry/core/__pycache__/poetry.cpython-310.pyc
     9483  01-01-2016 00:00   poetry/core/_vendor/fastjsonschema/__pycache__/__init__.cpython-310.pyc
    25327  01-01-2016 00:00   poetry/core/_vendor/fastjsonschema/__pycache__/draft04.cpython-310.pyc
     7571  01-01-2016 00:00   poetry/core/_vendor/fastjsonschema/__pycache__/draft06.cpython-310.pyc
     4325  01-01-2016 00:00   poetry/core/_vendor/fastjsonschema/__pycache__/draft07.cpython-310.pyc
     2421  01-01-2016 00:00   poetry/core/_vendor/fastjsonschema/__pycache__/exceptions.cpython-310.pyc
    11642  01-01-2016 00:00   poetry/core/_vendor/fastjsonschema/__pycache__/generator.cpython-310.pyc
     1351  01-01-2016 00:00   poetry/core/_vendor/fastjsonschema/__pycache__/indent.cpython-310.pyc

$ unzip -l poetry_core-2.0.1-py3-none-any.whl | grep \.pyc | head
      413  01-01-2016 00:00   poetry/core/__pycache__/__init__.cpython-310.pyc
    18447  01-01-2016 00:00   poetry/core/__pycache__/factory.cpython-310.pyc
     2042  01-01-2016 00:00   poetry/core/__pycache__/poetry.cpython-310.pyc
     9483  01-01-2016 00:00   poetry/core/_vendor/fastjsonschema/__pycache__/__init__.cpython-310.pyc
    25327  01-01-2016 00:00   poetry/core/_vendor/fastjsonschema/__pycache__/draft04.cpython-310.pyc
     7571  01-01-2016 00:00   poetry/core/_vendor/fastjsonschema/__pycache__/draft06.cpython-310.pyc
     4325  01-01-2016 00:00   poetry/core/_vendor/fastjsonschema/__pycache__/draft07.cpython-310.pyc
     2421  01-01-2016 00:00   poetry/core/_vendor/fastjsonschema/__pycache__/exceptions.cpython-310.pyc
    11642  01-01-2016 00:00   poetry/core/_vendor/fastjsonschema/__pycache__/generator.cpython-310.pyc
     1351  01-01-2016 00:00   poetry/core/_vendor/fastjsonschema/__pycache__/indent.cpython-310.pyc

It's generally not recommended to put .pyc files in wheels, especially in pure Python wheels (i.e. py3-none-any), since .pyc files are specific to each (major?) version of Python.

This doesn't seem to be harmful in most cases, since it looks like the Python interpreter will just rebuild the .pyc files when needed. However, I am currently working in a proprietary build system that puts an emphasis on hermetic builds and reproducibility at the byte level, and for reasons that are too complex and out of scope to explain here, the fact that my Python 3.10 interpreter will rewrite these .pyc files causes issues.

I know my personal situation is unusual, but I believe that it's not useful to be including these bytecode files in the first place, and if you could stop including them in the built wheel, that would be very useful to me.

Workarounds

My personal workaround is to patch the wheel files to strip out the .pyc files before installing them, but that does cause complexity in other areas in terms of not using the official wheels unmodified.

Poetry Installation Method

other

Operating System

RHEL 8

Poetry Version

N/A

Poetry Configuration

N/A, since this is not a problem with using poetry but rather with the poetry-core wheel that has been uploaded to PyPI.

Python Sysconfig

sysconfig.log
Paste the output of 'python -m sysconfig', over this line.

Example pyproject.toml

Poetry Runtime Logs

No runtime logs because this is about the official wheels for poetry-core.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/build-systemRelated to PEP 517 packaging (see poetry-core)area/distributionRelated to the distribution and installation of Poetry itselfkind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions