Skip to content

Allow populating (purelib|platlib|headers|scripts) #741

@lordmauve

Description

@lordmauve

With

[tool.flit.external-data]
directory = "data"

configured, files in the source "data" directory appear in {package}-{version}.data/data/ inside the wheel, and are written to the root of the venv on installation, alongside pyvenv.cfg.

According to the PyPA specification the {package}-{ver}.data directory can contain other directories: (purelib|platlib|headers|scripts|data)

I have use cases for writing to both the purelib and scripts directories too, in various projects:

  • purelib - I have a .pth file I'd like to write here to install a monkey patch
  • scripts - I have shell scripts to write here, as well as some legacy Python scripts that use if __name__ == '__main__' or no guard at all.

In both cases I'm having to fall back to setuptools, which is awkward because it drops all of the convenience and good opinions of flit (I'm providing technology in a corporate environment and less divergence is good.)

The structure of the config keys is a bit awkward because ideally it would be

[tool.flit.external-data]
data = "data"
purelib = "purelib"
scripts = "purelib"

but the current schema is tool.flit.external-data.directory not tool.flit.external-data.data. It would be possible just to add other keys, or add data as an alias for directory (but disallow both).

For comparison, uv_build supports this feature already, it's

[tool.uv.build-backend.data]
scripts = "scripts"

However uv_build doesn't support project.dynamic so I would prefer to continue using flit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions