Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between prune and recursive-exclude in setuptools?

I am using setuptools to package a custom module for deployment, which should not include certain files in the data/ directory that were used for development. I have succesfully excluded the necessary files using recursive-exclude data/ * in my MANIFEST.in file, but I also see that I could do this via prune data/

Both approaches remove the intended files from package.egg-info/SOURCES.txt after packaging via python setup.py egg_info

Is there any difference between the two?

like image 386
yunque Avatar asked Mar 23 '17 11:03

yunque


People also ask

What is an Sdist?

A source distribution, or more commonly sdist, is a distribution that contains all of the python source code (i.e. . py files), any data files that the library requires, and a setup.py file which describes to the setuptools module how your python code should be packaged.

What is setuptools used for in python?

Setuptools is a collection of enhancements to the Python distutils that allow developers to more easily build and distribute Python packages, especially ones that have dependencies on other packages. Packages built and distributed using setuptools look to the user like ordinary Python packages based on the distutils .

What is MANIFEST in used for?

The MANIFEST.in file contains commands that allow you to discover and manipulate lists of files. There are many commands that can be used with different objectives, but you should try to not make your MANIFEST.in file too fine grained.

What is MANIFEST in in python?

A MANIFEST.in file consists of commands, one per line, instructing setuptools to add or remove some set of files from the sdist.


1 Answers

Based on the documentation behaviour is:

  • recursive-exclude dir pat1 pat2 takes the directory dir and ignores all the files that match patterns pat1 and pat2

  • prune dir will exclude all files within the directory dir

So in your case recursive-exclude dir * and prune dir should have the same behaviour, except that prune will remove the whole directory, whereas recursive-exclude will preserve an empty folder.

like image 90
jojek Avatar answered Sep 28 '22 16:09

jojek