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

poetry build wheel file. not found top_level.txt #3093

Closed
3 tasks done
juyoung-yoo opened this issue Oct 6, 2020 · 4 comments
Closed
3 tasks done

poetry build wheel file. not found top_level.txt #3093

juyoung-yoo opened this issue Oct 6, 2020 · 4 comments
Labels
kind/bug Something isn't working as expected

Comments

@juyoung-yoo
Copy link

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: MacOs 10.15.6

  • Poetry version: 1.1.0b2

  • Link of a Gist with the contents of your pyproject.toml file:

[tool.poetry]
name = "test-common"
version = "0.1.1"
description = ""
authors = ["[email protected]"]
packages = [
    { include = "test-common", from = "src" },
]

[tool.poetry.dependencies]
python = "3.7.9"
pycryptodome = "^3.9.8"
twine = "^3.2.0"
poetry-setup = "^0.3.6"

[tool.poetry.dev-dependencies]
pytz = "2019.3"
mysqlclient = "^2.0.1"
pex = "^2.1.16"
pytest = "^6.0.2"
pyspark = "^3.0.1"
pyspark-stubs = "^3.0.0"
wheel = "^0.35.1"

[build-system]
requires = ["poetry-core>=1.0.0a5"]
build-backend = "poetry.core.masonry.api"
my-dir
.
├── README.md
├── dist
│   ├── testcommon-0.1.1-py3-none-any.whl
│   └── testcommon-0.1.1.tar.gz
├── poetry.lock
├── pyproject.toml
├── requirements.txt
├── setup.py
├── src
│   ├── __init__.py
│   ├── __pycache__
│   └── testcommon
│       ├── __init__.py
│       ├── common.py
├── tests
│   ├── __init__.py
│   └── test_common.py

Issue

Hi
I build using poetry.
and testcommon-0.1.1-py3-none-any.whl file unpack.
I didn't found 'top_level.txt` file

**poetry build **

.
├── testcommon
│   ├── __init__.py
│   ├── common.py
└── testcommon-0.1.1.dist-info
    ├── METADATA
    ├── RECORD
    └── WHEEL

**setup.py build **

...
packages=setuptools.find_packages("src"),
package_dir={"": "src"},
... 

$ python3 setup.py sdist bdist_wheel

.
├── testcommon
│   ├── __init__.py
│   ├── common.py
└── testcommon-0.0.1.dist-info
    ├── METADATA
    ├── RECORD
    ├── WHEEL
    └── **top_level.txt**

I think, poetry can't find the package from pyproject.toml file.
How can i found packages.

The reason why I need a file is Pex.

@juyoung-yoo juyoung-yoo added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 6, 2020
@finswimmer
Copy link
Member

Hello @juyoung-yoo,

what is this top_level.txt? I cannot found anything about in PEP 491 which poetry follows when creating a wheel. I found some reference with google, but I'm not sure what is this file for and where it comes from.

fin swimmer

@brechtm
Copy link

brechtm commented Feb 3, 2021

I was also wondering why poetry-produced wheels don't include a top_level.txt. I couldn't find anything official on it either but I did find this mention in A dive into packaging native python extensions:

top_level.txt: Setuptools also add this file which contains only the name of your package. This is part of the (PEP-less) egg format, the predecessor of wheels, as described in The Internal Structure of Python Eggs. This file is not documented and not needed for wheels and therefore not added by other packagers such as poetry. (Interestingly enough, the wheel repository, which adds the bdist_whl command to setuptools, does not even contain the string top_level.txt.)

@jvllmr
Copy link

jvllmr commented Jan 19, 2022

There is a workaround:

  1. Create a folder named <your_package_name>.egg-info
  2. Create your top_level.txt in it
  3. Add the folder to your package by using this in your pyproject.toml:
[tool.poetry]
...
include = ["<your_package_name>.egg-info/*"]
...

@abn abn removed the status/triage This issue needs to be triaged label Mar 3, 2022
dairiki added a commit to dairiki/lektor that referenced this issue Sep 20, 2022
This fixes at least one subtle bug: Some distributions do
not include a `top_level.txt` in their `.dist-info`, however
`importlib.metadata.packages_distributions` more-or-less relies
on it to work properly.

See python-poetry/poetry#3093
and https://github.com/python/cpython/blob/6cc6b13308b3202270ea7ac0ee776762a66f6a2f/Lib/importlib/metadata/__init__.py#L1043
dairiki added a commit to dairiki/lektor that referenced this issue Apr 16, 2023
This fixes at least one subtle bug: Some distributions do
not include a `top_level.txt` in their `.dist-info`, however
`importlib.metadata.packages_distributions` more-or-less relies
on it to work properly.

See python-poetry/poetry#3093
and https://github.com/python/cpython/blob/6cc6b13308b3202270ea7ac0ee776762a66f6a2f/Lib/importlib/metadata/__init__.py#L1043
dairiki added a commit to dairiki/lektor that referenced this issue Sep 11, 2023
This fixes at least one subtle bug: Some distributions do
not include a `top_level.txt` in their `.dist-info`, however
`importlib.metadata.packages_distributions` more-or-less relies
on it to work properly.

See python-poetry/poetry#3093
and https://github.com/python/cpython/blob/6cc6b13308b3202270ea7ac0ee776762a66f6a2f/Lib/importlib/metadata/__init__.py#L1043
Copy link

github-actions bot commented Mar 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

5 participants