Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python setuptools include files from parent directory

I have the following directory structure (pretty standard for a python distribution):

/some_dir
  /common
    file1.dat
    file2.dat
  /src
    pkg1/
      __init__.py
      stuff.py
    setup.py

What I want to achieve is package both pkg1 and common into the same python egg. The setup.py file is pretty standard (auto discover packages) and pkg1 is properly included, unfortunately I can't say the same about common. I tried many things, like package_data, package_data_files, package_dir, etc. Nothing seems to work. How can I achieve this?

I'm also not keen on keeping this structure, but I do need those files into a common directory, because I have to generate nodejs, python and java libraries that include them, thus moving the common/ directory inside python is not an option.

like image 423
Alex Dobjanschi Avatar asked Nov 08 '22 05:11

Alex Dobjanschi


1 Answers

I think you should use a MANIFEST.in file and set include_package_data to True to register all the files you want to bundle with your package.

https://setupy.info/ gives a pretty good overview of all the options you might need.

like image 100
Laurent Avatar answered Nov 14 '22 21:11

Laurent