0
from setuptools import setup, find_packages
LONGDOC = """
To be completed
"""

PACKAGES = find_packages()

def setup_package():

    setup(name='wbn',
          version='3.10',
          description='knowledge matcher',
          long_description=LONGDOC,
          packages=PACKAGES
    )

if __name__ == "__main__":
    setup_package()

When I do:

pip install .

I can see that in my virtual environment's site-packages directory 'wbn', all python source codes are installed correctly, but all resource files are not. So I added this file to MANIFEST.in for example:

recursive-include nl/cli *.yml

I hope this will add all *.yml files recursively to the 'wbn' library's installation directory, but it didn't.

What's wrong with my packaging?

marlon
  • 6,029
  • 8
  • 42
  • 76
  • 1
    The `MANIFEST.in` file is used to include files in the *source* dist, e.g. the `.tar.gz` file created by the `sdist` argument. The `package_data` or `data_files` arguments are used to include the *build’s* resource files … these are the files installed and bundled in via the `build` or `bdist_wheel` arguments. – S3DEV Jun 20 '22 at 21:04
  • Where did you add that line? How would setuptools know that it's supposed to add those files? – Tim Roberts Jun 20 '22 at 21:05
  • Further to my comment above, [this answer](https://stackoverflow.com/a/49501350/6340496) might be of use. (I’ve bookmarked it and refer to it time after time.) – S3DEV Jun 20 '22 at 21:05
  • I added it to the file MANIFEST.in. – marlon Jun 20 '22 at 21:12
  • @S3DEV So probably I should add a 'package_data' to setup function. I had thought package_data only add python files. – marlon Jun 20 '22 at 21:13
  • 1
    And after @S3DEV's comment, you now know that was not the right place to put it. The file names need to be passed in a `data_files` argument. – Tim Roberts Jun 20 '22 at 21:13
  • @TimRoberts Should it be in 'data_files' or 'package_data' arguments? Either one is ok? – marlon Jun 20 '22 at 21:25
  • The documentation should be helpful in making that decision. https://setuptools.pypa.io/en/latest/userguide/datafiles.html – Tim Roberts Jun 20 '22 at 21:41
  • https://stackoverflow.com/search?q=%5Bsetuptools%5D+static+files – phd Jun 21 '22 at 17:13

1 Answers1

0

you would need both MANIFEST.in for packaging (source distribtions) and a package_data dictionary as setup metadata.

https://setuptools.pypa.io/en/latest/userguide/datafiles.html

marscher
  • 800
  • 1
  • 5
  • 22