Home > Software engineering >  Can I specify package data in pyproject.toml
Can I specify package data in pyproject.toml

Time:10-21

In setup.cfg, I can define

[options.package_data]
myModule =
    '*.csv'

to make sure that data will be installed for my users.

Can I achive the same with pyproject.toml instead?

CodePudding user response:

You can use the include directive to do it :

[tool.poetry]
include = ["*.csv"]

https://python-poetry.org/docs/pyproject/#include-and-exclude

CodePudding user response:

if I understand your concern, you are using setuptools as a building and distributing system and you want to move some configs from setup.[py,cfg] namely package_data to pyproject.toml, if so you have to use an other tool to build and distribute your package e.g poetry as stated in @Romibuzi's answer because it's not possible unless the setuptools' team plan a new major release to include a full support of pyproject.toml and then no need for extra/standalone config setup.cfg file.

some references:

  • Related