Skip to content
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

Warn that data_files is deprecated in the packaging guide #1089

Open
cdfarrow opened this issue Jun 11, 2022 · 4 comments
Open

Warn that data_files is deprecated in the packaging guide #1089

cdfarrow opened this issue Jun 11, 2022 · 4 comments
Labels
component: guides type: enhancement A self-contained enhancement or new feature

Comments

@cdfarrow
Copy link

According to the keywords article data_files has been deprecated. This should be made clear in this section.

@abravalheri
Copy link
Contributor

Hi @cdfarrow, the status of data_files is 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.

The only example that I know of is Jupyter.

For this reason, I don't think data_files is going to be removed anytime soon.
My opinion is that we have to change setuptools to either:

  1. Provide a different (simplified) mechanism with better docs explaining that it is a "last-resort" technique.
  2. OR at least update the existing setuptools docs also explaining it is a "last-resort" technique instead of saying it is deprecated.

@cdfarrow
Copy link
Author

cdfarrow commented Jun 12, 2022

My opinion is that we have to change setuptools to either:

  1. Provide a different (simplified) mechanism with better docs explaining that it is a "last-resort" technique.
  2. OR at least update the existing setuptools docs also explaining it is a "last-resort" technique instead of saying it is deprecated.

#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
Copy link
Contributor

I will work on the setuptools docs to explain 2. for the time being.

@pradyunsg pradyunsg added type: enhancement A self-contained enhancement or new feature component: guides labels Jun 18, 2022
@tdpetrou
Copy link

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

[tool.setuptools.data-files]
"some/location/on/users/machine" = ["location/in/package/directory"]

I have a couple packages that extend jupyter that require this. So, in my particular case, the section would become:

[tool.setuptools.data-files]
"etc/jupyter/nbconfig/notebook.d" = ["jupyter-config/nbconfig/notebook.d/dataframe_image.json"]

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: guides type: enhancement A self-contained enhancement or new feature
Projects
None yet
Development

No branches or pull requests

5 participants
@abravalheri @pradyunsg @tdpetrou @cdfarrow and others