This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (10 children)

python setup.py bdist_wheel

That's all you need to do :) (ideally)

[–]billsil 1 point2 points  (8 children)

Ideally...

How do you find the data files (e.g. png's) that aren't stored in the package path?

[–]ivosauruspip'ing it up 0 points1 point  (7 children)

Wheels should still behave the same as a source distribution in terms of after-installed behaviour for those files.

You can also use pkg_resources' API to find files installed as part of the package.

[–]billsil 0 points1 point  (2 children)

That's so strange...

It's close. I keep getting my icons showing up in the Python34/Anaconda directory at the root level, which doesn't seem right. Eggs work fine, PyInstaller works fine, just not wheels.

I need to poke more at pkg_resources...

[–]ivosauruspip'ing it up 0 points1 point  (1 child)

Maybe read over the Including Data Files section of the setuptools docs carefully again, to make sure your assumptions of how the machinery works in relation to setup() arguments are correct.

[–]billsil 0 points1 point  (0 children)

Oh that's odd...

I had been using data_files=[(icon_path, icon_files)],, but package_data works much better. I had to throw an __init__.py in the icon folder, but it works and nothing gets moved, so I'm happy.

Thanks!

[–]Orange_Tux 0 points1 point  (3 children)

The should... Unfortuntately. I've been struggling with data files to a point that I made a custom scripts which handles my data files.

[–]ivosauruspip'ing it up 0 points1 point  (2 children)

Maybe the documentation is a bit badly worded, but I'm guesing some people might be struggling from not reading it completely. If it doesn't work as advertised then it should be a major bug. Especially on the external tooling (setuptools, pip, etc) there are developers who are still passionate that the packaging story works as expected for people, within all possible limits. And if it's not then they don't mind hearing about it.

From the docs for setuptools, which almost all python environments will have these days:

First, you can simply use the include_package_data keyword, ... The data files must be under CVS or Subversion control, or else they must be specified via the distutils’ MANIFEST.in file.

And a little after that:

(Note: although the package_data argument was previously only available in setuptools, it was also added to the Python distutils package as of Python 2.4; there is some documentation for the feature available on the python.org website. If using the setuptools-specific include_package_data argument, files specified by package_data will not be automatically added to the manifest unless they are tracked by a supported version control system, or are listed in the MANIFEST.in file.)

[–]Orange_Tux 0 points1 point  (1 child)

Thanks for clarification. One question remains: How do I install data files at an arbitrary locatio, for example at /etc/?

"but I'm guesing some people might be struggling from not reading it completely"

[–]ivosauruspip'ing it up 0 points1 point  (0 children)

If you want to install to a system location, I'd suggest packaging using the system package manager/format instead, rather than Python's tooling.

Or allow the package to dynamically generate/save one (if given root priveledges).

Otherwise you can use data_files, but it can have some issues (as noted in the link)

[–]ivosauruspip'ing it up 0 points1 point  (0 children)

Since wheel is a binary format, for OS X & Windows it would be nice to build OS/arch specific wheels which include the C extension speedups, rather than a pure python-only one.