-
I've noticed today that data_files is deprecated in https://setuptools.readthedocs.io/en/latest/references/keywords.html It says:
I've tried to git blame the info to know where did it originate, but apparently it was added with the entire keywords page. When I read https://packaging.python.org/guides/distributing-packages-using-setuptools/#data-files I got no idea it is deprecated and I'd like to know:
Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 24 replies
-
I suppose that the reason is that it's a bad idea to manage files in random locations on the file system... But I'll let @jaraco elaborate on this. Interestingly, this mentions a fix of that (probably) compatibility issue: https://setuptools.readthedocs.io/en/latest/history.html#v38-2-4. @hroncok what is your use case, anyway? Can it be solved by using |
Beta Was this translation helpful? Give feedback.
-
The reason it doesn't work with wheels and it did with eggs is because eggs could run code during installation, so you could operate directly on the filesystem. |
Beta Was this translation helpful? Give feedback.
-
Will data_files work until there's an appropriate replacement? Considering that not even tools such as gettext work without installing data outside of the python packages directory. |
Beta Was this translation helpful? Give feedback.
-
Anderson Bravalheri ***@***.***> writes:
> Will data_files work ...
`data_files` will keep working as they are right now, there is no plan
to remove this configuration parameter in the short-term.
Note however that there is no guarantee that the files you list will
end up in a specific location of your system
(e.g. `/etc/something`). This hasn't been supported in a long time and
there is no plan to add support for that.
I was thinking that go to the path of `sys.prefix` such as those that go
to `/usr/share` or `/usr/lib` (systemd, or default configuration).
What will happen is that setuptools will add the files listed in
`data_files` to the `.whl` archive it produces.
Later the installer tool (most likely `pip`) will extract those files
on a location according to the most appropriate installation
layout. Depending on the layout used by the installation tool, the
files might end up in a different location. Different layouts options
consider virtual environments, OS-specific variants, user's home
directory, etc...
If they are installed into `sys.prefix` the behavior should be
consistent, excluding exotic packaging systems such as Nix of course.
> until there's an appropriate replacement?
The appropriate replacements are well known:
- If you depend on a specific absolute path in the operating system,
the replacement is native packaging solutions for that operating
system (e.g. Debian => `.deb`, Fedora => `.rpm`)\
Of course that's a solution but it would be easier to do it in
setuptools to not have to do it in each package manually.
Besides tools such as setuptools-gettext exist too, maybe we just need a
setuptools extension for each type of data that has to be installed
outside of the python site.
|
Beta Was this translation helpful? Give feedback.
The reason it doesn't work with wheels and it did with eggs is because eggs could run code during installation, so you could operate directly on the filesystem.
Here's a recent discussion about the issue: https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853