question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

setup.py generated by `poetry build` does not have included file in package_data

See original GitHub issue
  • 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 the include directive in my pyproject.toml works correctly in that the file is included in the sdist tar, HOWEVER, it’s missing from the package_data entry in the generated setup.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:

web/static
|-- app.js
|-- utils.js

Then in .gitignore this line:

web/static/app.js

In pyproject.toml:

packages = [
    {include = "web"}
]

include = ["web/static/app.js"]

Running poetry build -f sdist succeeds. But then setup.py looks like this:

packages = \
['web']

package_data = \
{'': ['*'],
 'web': ['static/utils.js']}

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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:31
  • Comments:28 (8 by maintainers)

github_iconTop GitHub Comments

13reactions
fcomabellacommented, Apr 27, 2020

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.

I’m having the same issue.

7reactions
bdomscommented, Jul 22, 2020

@abn just wanted say a big THANK YOU! I really appreciate the well thought out responses. Poetry is in good hands.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Including non-Python files with setup.py - Stack Overflow
Probably the best way to do this is to use the setuptools package_data directive. This does mean using setuptools (or distribute ) instead...
Read more >
setuptools-scm - PyPI
setuptools_scm extracts Python package versions from git or hg metadata instead of declaring them as the version argument or in a SCM managed...
Read more >
Knowledge Bits — Common Python Packaging Mistakes
An overview of common mistakes made in creating & building a Python ... Exactly what files should and should not be included in...
Read more >
Packaging - Scikit-HEP
The libraries in Scikit-HEP have a variety of different packaging styles, ... This does not contain a setup.py, but rather a PKG_INFO file...
Read more >
5. Creating Built Distributions — Python 3.11.1 documentation
It's not necessarily binary, though, because it might contain only Python ... the setup script and the bdist command family to generate built...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found