-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
setup.py generated by poetry build
does not have included file in package_data
#1338
Comments
Wanted to throw out a potential fix. I don't have time to test this myself right now, but I believe that putting something in the builder around https://github.com/sdispater/poetry/blob/master/poetry/masonry/builders/builder.py#L63 like this would correct the issue: for included_glob in self._package.include:
for included in glob(
os.path.join(self._path.as_posix(), str(included_glob)), recursive=True
):
vcs_ignored_files.discard(
Path(included).relative_to(self._path).as_posix()
) |
see: pypa/setuptools#1650 |
i hit the same when i try to include a marker according to PEP561: [tool.poetry]
# …
include = ["mypackage/py.typed"]
# … which results in # …
package_data = \
{'': ['*']}
# … but the file is not excluded in any vcs-related context. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Thanks for the warning stale bot. I just tried this again after a |
@bdoms Can you try with the latest beta version of the |
This seems to work correctly for version |
@sdispater thanks for checking in! I upgraded to The code has moved around a bit since I last checked, but looking at it now the problem appears to be this line: https://github.com/sdispater/poetry/blob/master/poetry/masonry/builders/sdist.py#L137 It's the |
I'm not sure how related my problem is to this issue and if it warrants a separate issue, but .gitignore:
pyproject.toml: [tool.poetry]
include = ["package/file.py"]
... $ pip install .
(installs successfully)
$ ls .../site-packages/package/
...
(no file.py) Removing the entry from Running I'm working on it in ActivityWatch/aw-qt#51 Edit: I made a dirty workaround that temporarily comments out the file from |
I'm having the same issue. |
I am on Poetry version 1.0.0b4 and having the exact same issue |
Trying to include some API definitions like so
Am I having problems due to this issue; or are relative paths outside the pyproject.toml directory not supported? |
same here with version 1.0.9 |
Is this still an issue with the current preview release Going forward poetry will by default stop generating |
How can sdists be built and installed then? |
You do not necessarily need a |
I like Poetry a lot because it has generally made my life easier, but removing As for whether it's still happening, I just ran |
@bdoms We already know it's in 1.0.9 (#1338 (comment)). FWIW, my particular variant of the issue (as described in #1338 (comment)) appears to have been resolved in 1.1.0a3. |
Still present in 1.1.0a3. Although, I don't even get how the supposed change by @abn should work, as a setup.py is generated even if I include
@funkyfuture @fcomabella Have you found a workaround to use PEP 561 with poetry? |
@bdoms Yes, we understand that in rare cases where the project maintainer wants to remain compatible with downstream build scenarios that rely on older build toolchain, this might require user intervention. However, supporting a feature like this in perpetuity is not a good idea for a few reason. Maintaining All this said, it is also important to note that this is not happening overnight. The following steps need to happen prior to this being removed.
|
@atollk As I mentioned in my original comment (apparently unclearly), the current configuration handling has a bug, it does the inverse of the configuration, which is resolved with python-poetry/poetry-core#26 but that change has not yet made it into a [build-system]
requires = ["poetry-core>=1.0.0a3"]
build-backend = "poetry.core.masonry.api" Specific to the reported issue, if this is still an issue and the generated |
@abn I see. I added a PR which should fix the issue. The code in question is what was described above: #1338 (comment) . |
@abn Regarding the point of deprecating |
@atollk I would not call the use of As for PEP 561, by the time the setup file generation is removed, we anticipate the required features to be supported. For example see #2000. This needs to be ported to core, but I do expect to see the |
@abn just wanted say a big THANK YOU! I really appreciate the well thought out responses. Poetry is in good hands. |
https://www.python.org/dev/peps/pep-0561/ https://mypy.readthedocs.io/en/latest/installed_packages.html python-poetry/poetry#1338 The py.typed file indicates that this package supplies type information. py.typed is not yet supported by Poetry (python-poetry/poetry#1338), so it may not show up in the built package yet.
https://www.python.org/dev/peps/pep-0561/ https://mypy.readthedocs.io/en/latest/installed_packages.html python-poetry/poetry#1338 The py.typed file indicates that this package supplies type information. py.typed is not yet supported by Poetry (python-poetry/poetry#1338), so it may not show up in the built package yet.
https://www.python.org/dev/peps/pep-0561/ https://mypy.readthedocs.io/en/latest/installed_packages.html python-poetry/poetry#1338 The py.typed file indicates that this package supplies type information. py.typed is not yet supported by Poetry (python-poetry/poetry#1338), so it may not show up in the built package yet.
# pyproject.toml
[tool.poetry]
include = ["mypackage/py.typed"]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api" To verify without affecting your PyPI package, you can publish to Test PyPI as described in the PyPA tutorial. Thank you to @abn and the other maintainers and contributors 🎉 👏 |
@bdoms safe to say original issue is resolved? |
From [Hypermodern Python Cookiecutter](https://cookiecutter-hypermodern-python.readthedocs.io/en/2020.6.15/guide.html?highlight=py.typed#the-initial-package): "`py.typed` is an empty marker file, which declares that your package supports typing and is distributed with its own type information (PEP 561). This allows people using your package to type-check their Python code against it." See: - [PEP-561](https://www.python.org/dev/peps/pep-0561/) - [Reference implementation: `aws-lambda-powertools-python`](aws-powertools/powertools-lambda-python#237) - [Implementation Explanation](python-poetry/poetry#1338 (comment))
Apologies for not responding earlier - I had checked for this bug last October after that release, and found that it was still happening. However, I did just check again after an update and can confirm that at least as of Poetry version 1.1.6 this is finally fixed! THANK YOU!!! |
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. |
I am on the latest Poetry version.
I have searched the issues of this repo and believe that this is not a duplicate.
OS version and name: Ubuntu 19.04
Poetry version: 0.12.17
Issue
I have a web project that builds a static JS file, which I have explicitly ignored in my
.gitignore
file, but that I do want to include in builds of my project. Adding that file to theinclude
directive in mypyproject.toml
works correctly in that the file is included in the sdist tar, HOWEVER, it's missing from thepackage_data
entry in the generatedsetup.py
, so when I install the package, the file is not included and the installed package is broken.Here's the setup. I have two files in a package sub-directory:
Then in
.gitignore
this line:In
pyproject.toml
:Running
poetry build -f sdist
succeeds. But thensetup.py
looks like this:I would expect that a file specified in
include
would have an entry there, or be covered by another rule, but that's not the case and it breaks things for me.Let me know if you need more info or how I can help. Poetry is awesome.
The text was updated successfully, but these errors were encountered: