You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Warn that data_files is deprecated in the packaging guide #1089
Hi @cdfarrow, the status of data_filesis complicated ™️.
There are several people that reach for using data_files when they actually should be exploring another approach (e.g. populating $XDG_DATA_HOME/$XDG_CONFIG_HOME/$XDG_STATE_HOME on the first run of the program - see https://github.com/platformdirs/platformdirs), or simply placing the files inside the package directory.
But there is one particular use case that is genuine:
A library/program that allows plugins to specify non-Python packages (e.g. CSS/JS/HTML) AND the number of plugins is so big that it is impossible to use entry-point mechanisms for advertising these files without causing huge performance impairments.
Hi @abravalheri, do you think it's possible to update the docs to include the instructions for data_files? The only mention I can find of how to use this feature is here. And that is within the context of setup.py. For pyproject.toml users, there is no guidance, though you can infer from the package data section that the general form is
Activity
abravalheri commentedon Jun 11, 2022
Hi @cdfarrow, the status of
data_filesis complicated ™️.There are several people that reach for using
data_fileswhen they actually should be exploring another approach (e.g. populating$XDG_DATA_HOME/$XDG_CONFIG_HOME/$XDG_STATE_HOMEon the first run of the program - see https://github.com/platformdirs/platformdirs), or simply placing the files inside the package directory.But there is one particular use case that is genuine:
entry-pointmechanisms for advertising these files without causing huge performance impairments.The only example that I know of is Jupyter.
For this reason, I don't think
data_filesis going to be removed anytime soon.My opinion is that we have to change
setuptoolsto either:cdfarrow commentedon Jun 12, 2022
#1 sounds like a good path forward; but at least updating the docs to explain what you've said and making them consistent would be really helpful.
abravalheri commentedon Jun 12, 2022
I will work on the setuptools docs to explain 2. for the time being.
tdpetrou commentedon Feb 11, 2023
Hi @abravalheri, do you think it's possible to update the docs to include the instructions for
data_files? The only mention I can find of how to use this feature is here. And that is within the context ofsetup.py. Forpyproject.tomlusers, there is no guidance, though you can infer from the package data section that the general form isI have a couple packages that extend jupyter that require this. So, in my particular case, the section would become:
Jupyter documentation also contains a section with how to accomplish this in
setup.py. It would be nice if the official setuptools documentation also showcased this feature.Retire outdated setuptools packaging guide