# Should there be a new standard for installing arbitrary data files?

**URL:** <https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853>\
**Category:** Packaging\
**Created:** [March 23, 2021, 3:53pm UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853 "2021-03-23T15:53:59Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![AWhetter](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/awhetter/32/3777_2.png) [@AWhetter](https://discuss.python.org/u/AWhetter)\
**Post date:** [March 23, 2021, 3:53pm UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/1 "2021-03-23T15:53:59Z")

</div>

In setuptools, the data\_files keyword to `setup()` can be used to install files outside of the Python package. These files get installed to a user specified location relative to sys.prefix (or relative to `site.USER_BASE` for a user install). This keyword is considered deprecated.  
I’m hoping to discuss whether there are use cases that justify a replacement of this functionality, and if so what that replacement might look like. If not then I hope that this discussion will at least provide clarification for users (and maybe maintainers!) about what the future of this functionality is, if there is indeed a future at all!

_Note that as a new user I can only post two links so I have had to split links into follow up comments._

## Why data\_files is deprecated

I am no authority on why the data\_files keyword is deprecated, I can only interpret what I’ve seen posted about them in the past. So that’s what I’ll attempt to do here, but anyone who expressed opinions in the sources that I use may have since changed their opinions.

- It exposes platform specific behaviour ([#1]): data\_files are installed unconditionally when the package as a whole is installed. But the locations of these sorts of files, as well as the files themselves, are usually platform specific.
- It goes outside the bounds of what a Python package is supposed to be ([#2]): Nothing in the Python ecosystem should make use of arbitrarily installed files because anything interacting with packages this way can be using some other mechanism within the bounds of the ecosystem. For example a file usually read from `/etc/foo.conf.d` could also be installed to and read from `$VIRTUAL_ENV/foo.conf.d` so that it can be overridden in a virtualenv.
- It encourages usage of `sudo pip` ([#3]): A user seeing an absolute Unix-filesystem-like path might therefore conclude that a package can be installable directly onto the system.

## Use cases

- I’ll describe my use case first but it’s arguably a weak one. I work in visual effects (VFX). We use third party programs like Maya [#4] and Houdini [#5]. These programs have their own scripting languages that we make use of. However, given that the vast majority of code that we produce is Python, we distribute our code via pip and develop code with virtualenvs. The way that the third party programs we use find the source files written in their proprietary languages is via `*_PATH` variables. For example Maya finds `*.mel` files on `MAYA_SCRIPT_PATH` ([#6]) and Houdini finds `*.vex` files on `HOUDINI_PATH` ([#7]).

- .desktop files (Mentioned in the comments of [#8]): These are platform specific. They only make sense when installed onto the system (or the user). They cannot be used from a virtualenv because they must exist in /usr/share/applications or ~/.local/share/applications ([#9]).

- Man pages ([#10]): Similarly to .desktop file, these are platform specific. They only make sense when either installed to the system, or when installed into a virtualenv and the location included in `$MANPATH` though this is an usual case.

- Files in `/etc` such as configuration files and systemd units ([#11] and [#12]): These are platform specific. They only make sense when installed to the system. This would be installing both to an absolute location and one outside of sys.prefix. This shouldn’t be getting installed on the system via pip so I don’t know how to justify that these files could be the responsibility of setuptools and not a distro’s package manager, other than it makes the distro packager’s job easier because they can pip install into the rpm/pacman/etc package without any extra steps or digging for supplementary files.

- Binaries ([#13]): These only make sense when installed to the system or the user. They do not work in a virtualenv because they must exist on PATH to work, but this is only the case when a virtualenv is activated and a virtualenv does not have to be activated to be valid. Console scripts are valid in a package because they expose a function that is importable as a script. So other packages should be importing that function and using it directly. The equivalent for a binary is to do the same and expose that functionality through a library, even if it is a compiled one, even if there needs to be a layer on top of the compiled library to allow for the same import location if the name/location of the library itself is different on different platforms.

## Other notes

- setuptools documents that it does not pass data\_files values to wheel, but from testing, it does for relative values. Both through pip and through `python setup.py bdist_wheel`. Absolute locations are not included however.
  - Therefore the only way that these can be getting installed at the moment is if someone is doing `python setup.py install`.
  - As can be deduced from the above, the wheel format does already support data files installed to a location relative to `sys.prefix`.

- I wonder if the desire to package .desktop files, man pages, and similar files is a distribution problem. If a package provides extra functionality through these sorts of files, how should a package maintainer advertise that to the packagers of the package on a Linux distro for example? It’s up to the distro packagers to read documentation and make sure that they’ve packaged the complete package properly. It’s not a problem for setuptools to solve. But I think that there’s the expectation from a packager that if it’s a Python package then there will be nothing else to install outside of doing a pip install and doing anything specific to the distro like moving license files to the correct place.
- I’ll admit that as I started writing this I was thinking “how are these files not supported properly? It would be so simple!”. After compiling this post, I see why. But as I said in the beginning, even if I can provide clarity for future direction then this long post has been worthwhile! I now think of data\_files more of a left over feature from a time when pip was supposed to be a full blown package manager. They are, however, a useful backdoor for private use.
  - The fact that the wheel format supports already data files places anywhere relative to sys.prefix is, I think, what made me and others wonder why these files are not properly supported. setuptools/pip would basically be doing a (possibly platform-specific conditional) pass-through of the file. Everything else “just works”. But just because it’s easy, doesn’t mean we should do it.

- setuptools still has a reference to usage of an absolute path in data\_files [#14] so that’s something that possibly needs removing.

---

<div class="post-metadata">

**Author:** ![AWhetter](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/awhetter/32/3777_2.png) [@AWhetter](https://discuss.python.org/u/AWhetter)\
**Post date:** [March 23, 2021, 4:01pm UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/4 "2021-03-23T16:01:56Z")

</div>

_Apparently I’ve run out of links that I’m allowed to post so I’ll have to describe where to find the links_ 😅  
[#1] setuptools issue #2341  
[#2] wheel issue #92  
[#3] setuptools issue #1387  
[#4] search for “autodesk Maya”  
[#5] Search for “sidefx houdini”  
[#6] Search for “Maya 2020 environment variables”  
[#7] Search for “list of environment variables in Houdini”.  
[#8] Poetry issue #890  
[#9] Search for “gnome desktop files putting your application in the desktop menus”  
[#10] Poetry issue #890  
[#11] Poetry issue #890  
[#12] Search for “Is there an idiomatic way to install systemd units with setuptools” on stackoverflow  
[#13] setuptools issue #1728  
[#14] In `docs/userguide/declarative_config.rst` of the setuptools repo

---

<div class="post-metadata">

**Author:** ![encukou](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/encukou/32/2461_2.png) [@encukou](https://discuss.python.org/u/encukou)\
**Post date:** [March 23, 2021, 4:16pm UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/5 "2021-03-23T16:16:07Z")

</div>

I’ve been asked similar questions by people develop system (or internal) libraries for Fedora/Red Hat, and my answer always was to use RPM rather than pip for things that aren’t vierualenv-friendly.

With that, I guess the relevant question becomes:

> [@AWhetter](#):
>
> If a package provides extra functionality through these sorts of files, how should a package maintainer advertise that to the packagers of the package on a Linux distro for example?

I’ve used a [`Makefile`](https://github.com/encukou/py3c/blob/master/Makefile#L48) with a [note in the docs](https://py3c.readthedocs.io/en/latest/contributing.html#packaging). I got a few pull requests (and learned stuff about writing cross-\*nix Makefiles), so I guess it worked for communication at least partially.

---

<div class="post-metadata">

**Author:** ![encukou](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/encukou/32/2461_2.png) [@encukou](https://discuss.python.org/u/encukou)\
**Post date:** [March 23, 2021, 7:05pm UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/6 "2021-03-23T19:05:07Z")

</div>

_To get around the anti-spam limitation, Ashley sent me the links by mail. Here they are:_  
[#1]: [Can I choose where data files are installed? · Issue #2341 · pypa/setuptools · GitHub](https://github.com/pypa/setuptools/issues/2341#issuecomment-683462694)  
[#2]: [https://github.com/pypa/wheel/issues/92#issuecomment-421078938](https://github.com/pypa/wheel/issues/92#issuecomment-421078938)  
[#3]: [Docs for data\_files differ from the general practice · Issue #1387 · pypa/setuptools · GitHub](https://github.com/pypa/setuptools/issues/1387#issue-331310672)  
[#4]: [Maya Software | Computer Animation & Modeling Software | Autodesk](https://www.autodesk.ca/en/products/maya/overview)  
[#5]: [https://www.sidefx.com/products/houdini/](https://www.sidefx.com/products/houdini/)  
[#6]: [File path variables | Maya 2020 | Autodesk Knowledge Network](https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2020/ENU/Maya-EnvVar/files/GUID-228CCA33-4AFE-4380-8C3D-18D23F7EAC72-htm.html?v=2020&st=MAYA_SCRIPT_PATH)  
[#7]: [Environment variables](https://www.sidefx.com/docs/houdini/ref/env.html)  
[#8]: [Support for data\_files · Issue #890 · python-poetry/poetry · GitHub](https://github.com/python-poetry/poetry/issues/890)  
[#9]: [Desktop files: putting your application in the desktop menus](https://developer.gnome.org/integration-guide/stable/desktop-files.html.en)  
[#10]: [Support for data\_files · Issue #890 · python-poetry/poetry · GitHub](https://github.com/python-poetry/poetry/issues/890#issuecomment-696776312)  
[#11]: [Support for data\_files · Issue #890 · python-poetry/poetry · GitHub](https://github.com/python-poetry/poetry/issues/890#issuecomment-724508381)  
[#12]: [https://stackoverflow.com/q/61865481](https://stackoverflow.com/q/61865481)  
[#13]: [Support for environment markers for data\_files · Issue #1728 · pypa/setuptools · GitHub](https://github.com/pypa/setuptools/issues/1728)  
[#14]: [setuptools/declarative\_config.rst at a4dbe3457d89cf67ee3aa571fdb149e6eb544e88 · pypa/setuptools · GitHub](https://github.com/pypa/setuptools/blob/a4dbe3457d89cf67ee3aa571fdb149e6eb544e88/docs/userguide/declarative_config.rst)

---

<div class="post-metadata">

**Author:** ![dholth](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/dholth/32/952_2.png) [@dholth](https://discuss.python.org/u/dholth)\
**Post date:** [March 24, 2021, 2:19am UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/7 "2021-03-24T02:19:10Z")

</div>

This is a feature that has been requested periodically. I think it would be a great idea to replace the feature.

Long ago virtualenv and/or setuptools/pkg\_resources broke `data_files` more or less by accident. Maybe it wasn’t supported very well in the `.egg` format. And with `virtualenv` putting your files in different environments there’s no longer a consistent root directory for your `data_files`, so your program can’t find them at runtime. Eventually you can be tempted to make the argument that this thing we broke on accident was a bad idea.

One version of packaging proposed that every file in a distribution could be relocatable. A manifest would map each individual file to its install location. In wheel we compromise by relocating categories of files but we don’t record where each category was installed.

Suppose we allow the packager to define their own wheel categories with variable substitution, we made something like the `automake` [standard directory variables](https://www.gnu.org/software/automake/manual/html_node/Standard-Directory-Variables.html) available, then

`"a" : "${docdir}/x"` in a categories definition  
+  
`package-1.0.data/a/README.txt` in the wheel  
could be installed to  
`<root of environment>/share/doc/package-1.0/x/README.txt`

The packager has a way to express intent, and the person doing the installing still controls exactly where the files are installed.

The usual objection is that the limited feature set of post-virtualenv Python packaging makes it easier to use free libraries. I think you’d get new kinds of software that would make up for it.

---

<div class="post-metadata">

**Author:** ![uranusjr](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/uranusjr/32/103_2.png) [@uranusjr](https://discuss.python.org/u/uranusjr)\
**Post date:** [March 24, 2021, 7:25am UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/8 "2021-03-24T07:25:23Z")

</div>

Allowing installing things relative to `sys.prefix` and `sys.exec_prefix` (and maybe even allow some variable replacement in some limited ways) sounds fine to me, but the top post is talking about _arbitrary_ locations, as in anywhere on the user’s machine. That should definitely not be possible IMO.

Python packaging is expected (at least these days, and increasingly so) to only modify the current Python installation (e.g. for reproducibility), so anything that has side effect outside of the Python prefix should not be supported.

---

<div class="post-metadata">

**Author:** ![pf\_moore](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/pf_moore/32/35_2.png) [@pf\_moore](https://discuss.python.org/u/pf_moore)\
**Post date:** [March 24, 2021, 8:49am UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/9 "2021-03-24T08:49:36Z")

</div>

> [@uranusjr](#):
>
> That should definitely not be possible IMO.

Agreed. If you want to install files in machine-wide locations, you should be using an OS-level installer (which is designed to manage for this use case) not a Python-specific one.

There’s a need for better ways to build OS-level packages from Python code, but that’s a separate question, and not what wheel and existing packaging tools are focused on.

---

<div class="post-metadata">

**Author:** ![dholth](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/dholth/32/952_2.png) [@dholth](https://discuss.python.org/u/dholth)\
**Post date:** [March 24, 2021, 4:07pm UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/10 "2021-03-24T16:07:20Z")

</div>

We’re not talking about having the installer automatically modify paths outside the virtual environment. The person doing the installation would retain complete control.

Instead, give the package a better way to install, and later find, packages installed outside of the `site-packages` location, where all `*.py` is found - but still inside the virtualenv. Give the package a way to say “by the way, here is a configuration file”.

Then you can offer a gentler transition for something like a lightweight utility, that would benefit from being distributed on pypi but is also useful standalone, compared to asking them to build a separate Python-focused application packaging system. You could support a more automatic translation between the Python “relocatable categories of files” model into RPM or another system level installer.

---

<div class="post-metadata">

**Author:** ![AWhetter](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/awhetter/32/3777_2.png) [@AWhetter](https://discuss.python.org/u/AWhetter)\
**Post date:** [March 26, 2021, 12:09am UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/11 "2021-03-26T00:09:36Z")

</div>

> [@uranusjr](#):
>
> but the top post is talking about _arbitrary_ locations, as in anywhere on the user’s machine.

I think there’s two set of “arbitrary locations”. One is those files under `sys.prefix`, and the other is absolutely anywhere on the machine. Despite the fact that I don’t think that it makes sense to support installation outside of `sys.prefix` either, I was posing the question about those two sets of files separately because I wanted to discuss all potential use cases.

---

<div class="post-metadata">

**Author:** ![AWhetter](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/awhetter/32/3777_2.png) [@AWhetter](https://discuss.python.org/u/AWhetter)\
**Post date:** [March 28, 2021, 5:30pm UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/12 "2021-03-28T17:30:59Z")

</div>

I don’t understand what the categories are used for. Are you saying that setuptools (or some standard) would support a set of valid categories and anything outside of these categories would not be allowed? What would that give us or users?

---

<div class="post-metadata">

**Author:** ![FFY00](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/ffy00/32/4007_2.png) [@FFY00](https://discuss.python.org/u/FFY00)\
**Post date:** [March 29, 2021, 3:16am UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/13 "2021-03-29T03:16:35Z")

</div>

> [@uranusjr](#):
>
> Allowing installing things relative to `sys.prefix` and `sys.exec_prefix` (and maybe even allow some variable replacement in some limited ways) sounds fine to me, but the top post is talking about _arbitrary_ locations, as in anywhere on the user’s machine. That should definitely not be possible IMO.
> 
> Python packaging is expected (at least these days, and increasingly so) to only modify the current Python installation (e.g. for reproducibility), so anything that has side effect outside of the Python prefix should not be supported.

This.

We already have a bunch of issues with file conflicts as is, introducing a way to install files outside the Python installation will result in even nastier ones. Not only that but different systems work in different ways and have different behaviors in subtle, and not so subtle, ways. Coming up with a good standard would be extremely hard. As a Linux distro packager I would highly recommend against this.

For specific things like .desktop files and systemd services, we could add an option for the Python interpreter to explicitly opt-in into supporting installing these. The Python distributors would opt-in and correctly configure the paths, or installation mechanism, for the system and then installers like pip could use this if supported. Though even this is tricky.

---

<div class="post-metadata">

**Author:** ![dholth](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/dholth/32/952_2.png) [@dholth](https://discuss.python.org/u/dholth)\
**Post date:** [March 29, 2021, 6:06pm UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/14 "2021-03-29T18:06:01Z")

</div>

Here a category is nothing more than a directory of files that can be moved together, in the same way that the scripts currently go into the `bin` or the `Scripts` directory depending on the platform, and the Python files go into a different directory depending on the interpreter version.

e.g. the source:

```auto
src/myprogram.py
assets/photo.png

```

`setup.py` replacement would say: `./assets` is in the `assets` category. install `assets` into `${datadir}/myspecialsubdir`

The variables would have platform-appropriate values. UNIX platforms probably have stronger opinions on where these should go, while sane platforms install everything into per-application folders.

One of the variables e.g. `${root}` would be `sys.prefix` or the root of the virtualenv, so you could install files relative to that directory. But if you start from e.g. `${docsdir}` your files are more likely to go into a platform appropriate destination like `$docsdir = ${root}/share/docs`

The benefit is only to have a way to install, and then locate, files under `sys.prefix` but outside of `site-packages`. If the categories are done nicely then it is convenient for a repackager to say "the assets should go `here`".

---

<div class="post-metadata">

**Author:** ![AWhetter](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/awhetter/32/3777_2.png) [@AWhetter](https://discuss.python.org/u/AWhetter)\
**Post date:** [April 11, 2021, 5:41pm UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/15 "2021-04-11T17:41:00Z")

</div>

From the discussion so far it seems like there’s some interest in trying to replace the functionality that data\_files provides. What’s the best way of moving this forwards? I feel like there’s a lot to figure out still before jumping to implementation.

> [@dholth](#):
>
> The benefit is only to have a way to install, and then locate, files under `sys.prefix` but outside of `site-packages` . If the categories are done nicely then it is convenient for a repackager to say "the assets should go `here` ".

I see. That makes sense. Presumably a repackager would need a way of overriding these variables? If a the default values provided by setuptools don’t match where a repackager wants them to go then do we need to provide a way to override them?

In terms of how this all gets output to wheels, if we were representing it with the current wheel specification then I think that packages that could otherwise use universal wheels would need to produce platform specific wheels because you would be producing a wheel for each possible platform-dependent location of `${root}`. Repackagers would be using sdists so there’s no need to override the destinations of category variables at this point and setuptools will have backed the final destination of files into the wheel already.

With the above, I think that also means that a user’s selection of which files are installed and where ultimately hinge on the list of available platform tags for wheels. Environment markers seem like the natural choice for platform selection because users already know them. I think it would be a case of evaluating the markers at the time of building the wheel but I don’t know if that gets messy when cross compiling (if that’s even possible)?

---

<div class="post-metadata">

**Author:** ![uranusjr](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/uranusjr/32/103_2.png) [@uranusjr](https://discuss.python.org/u/uranusjr)\
**Post date:** [April 11, 2021, 6:32pm UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/16 "2021-04-11T18:32:45Z")

</div>

> [@AWhetter](#):
>
> In terms of how this all gets output to wheels, if we were representing it with the current wheel specification then I think that packages that could otherwise use universal wheels would need to produce platform specific wheels because you would be producing a wheel for each possible platform-dependent location of `${root}` .

No, the root value is provided by Python stdlib. Paths in wheel metadata are relative to it, and the wheel installer performs substitution to get the actual target location. All these are already in the wheel specification.

---

<div class="post-metadata">

**Author:** ![AWhetter](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/awhetter/32/3777_2.png) [@AWhetter](https://discuss.python.org/u/AWhetter)\
**Post date:** [April 12, 2021, 10:47pm UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/17 "2021-04-12T22:47:07Z")

</div>

You’re right. I think I was thinking more about the contents of `${root}`. For example if a user wants something installed to `${root}` but only on Linux, I don’t think that the wheel specification can represent that in a single wheel file.  
Similarly for any other category variables we decide to add. If `${docsdir}` is a category variable with platform dependent install locations, currently that would have to be represented by a wheel file per platform.

---

<div class="post-metadata">

**Author:** ![uranusjr](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/uranusjr/32/103_2.png) [@uranusjr](https://discuss.python.org/u/uranusjr)\
**Post date:** [April 13, 2021, 10:10am UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/18 "2021-04-13T10:10:23Z")

</div>

> [@AWhetter](#):
>
> For example if a user wants something installed to `${root}` but only on Linux, I don’t think that the wheel specification can represent that in a single wheel file.

The same restriction applies to source code in a wheel as well, there’s no way to “partially install” a wheel, which (from my understanding) is a feature.

> [@AWhetter](#):
>
> Similarly for any other category variables we decide to add. If `${docsdir}` is a category variable with platform dependent install locations, currently that would have to be represented by a wheel file per platform.

I don’t understand. Why are docs not supposed to be installed on all platforms?

---

<div class="post-metadata">

**Author:** ![fdrake](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/fdrake/32/19_2.png) [@fdrake](https://discuss.python.org/u/fdrake)\
**Post date:** [April 13, 2021, 2:18pm UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/19 "2021-04-13T14:18:37Z")

</div>

> [@uranusjr](#):
>
> Why are docs not supposed to be installed on all platforms?

It’s not that docs (in the abstract) should not be installed on all platforms, but that each platform might prefer docs in different places. For instance, the Ubuntu-provided package for `dateutil` installs docs in a directory **/usr/share/doc/python3-dateutil/** , which might not be appropriate on RHEL / CentOS, and isn’t going to make sense on Windows.

Another interesting example would be Unix “man pages”, which are still useful. Installation may require compression on some platforms, and there’s often a utility that needs to be run to update a database. (Though that’s usually an application concern, so less relevant to wheel installation per se.)

Doc formats might also vary a lot; a package might want to provide a **.chm** file (or whatever modern equivalent there is) on Windows, and something else on Unix.

Lately, I’ve wanted to include three different groups of documentation, where a process that assembles an application package knows how to deal with them. It’s not unusual to have more than one of Python API docs, web API docs, and user-facing docs, all from one package. I don’t think there’s currently a “right way” to get them into a wheel, and it’s even less clear how to get them installed from a wheel in a way that can be driven by a tool generating a system package (such as a **.deb** or **.rpm** ).

-Fred

---

<div class="post-metadata">

**Author:** ![pf\_moore](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/pf_moore/32/35_2.png) [@pf\_moore](https://discuss.python.org/u/pf_moore)\
**Post date:** [April 13, 2021, 2:28pm UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/20 "2021-04-13T14:28:24Z")

</div>

> [@fdrake](#):
>
> It’s not that docs (in the abstract) should not be installed on all platforms, but that each platform might prefer docs in different places.

Looking at this from a different perspective, why would you want the docs installed in every virtualenv you use the package in? I’d have expected documentation to be installed globally (if at all - most packages seem to have documentation on the web, these days) so it’s not suitable for inclusion in a wheel.

> [@AWhetter](#):
>
> I think there’s two set of “arbitrary locations”. One is those files under `sys.prefix` , and the other is absolutely anywhere on the machine.

Precisely. Under `sys.prefix` is certainly possible (and support for more flexibility here is something that could be added). Outside of the environment is not a use case that wheels are intended to support.

---

<div class="post-metadata">

**Author:** ![fdrake](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/fdrake/32/19_2.png) [@fdrake](https://discuss.python.org/u/fdrake)\
**Post date:** [April 13, 2021, 5:12pm UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/21 "2021-04-13T17:12:04Z")

</div>

> [@pf\_moore](#):
>
> Looking at this from a different perspective, why would you want the docs installed in every virtualenv you use the package in? I’d have expected documentation to be installed globally (if at all - most packages seem to have documentation on the web, these days) so it’s not suitable for inclusion in a wheel.

_My_ expectation is that I’d like whatever is using the wheel to decide whether & where to install any particular set of additional files. Docs are just one example.

A package that provides a web API might provide resources that represent the API in various ways (OpenAPI definitions, JSON Schemas, documentation for client developers, etc.). Some application that incorporates the package will determine (probably via a packaging tool of some sort), which sets of resources are needed and where they should land in an installation.

I’m running into this issue for an application that supports extensions which can register additional routes for a web framework, but I don’t think that’s particularly unusual way to structure things. And yes, this is really about allowing packages to provide additional resources for something that builds “an application”; it’s not really about typical wheel installs.

-Fred

---

<div class="post-metadata">

**Author:** ![pradyunsg](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/pradyunsg/32/206_2.png) [@pradyunsg](https://discuss.python.org/u/pradyunsg)\
**Post date:** [April 15, 2021, 7:58am UTC](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/23 "2021-04-15T07:58:37Z")

</div>

The emphasis on correctness here is for similar reasons to why using a screwdriver on a nail is not going to work well. You could make it work in some weird ways, but that’s far from optimal. It might even introduce faults that’ll cause a failure later. 🙂

* * *

@nhatkhai Welcome to the this forum. I’d encourage you to not be dismissive of the efforts of volunteers who maintain Python packaging tooling. By being dismissive of their approach, you’re very directly contributing to more frustration that’ll lead to fewer maintainers of these tools. 🙂

Take into account that while most users are just looking to solve their problems with the tooling, the maintainers of these tools are outnumbered by a ratio of 1:millions, and have to think about usecases beyond the ones of those specific users.

[Next page](https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853.md?page=2)
