11

I am packaging my source code, but I do not want to include tests and docs because it will be too big.

To do that I include in my setup.py:

setup(...
      packages=find_packages(exclude=['tests.*','tests','docs.*','docs']),
      ...
)

When doing a

python setup.py sdist

I can see that my root tests/ and docs/ dirs and everything inside are still included in the generated distribution.

It seems that only

python setup.py bdist

is sensible to the exclude parameter.

Why ? is it possible to exclude dirs for 'setup.py sdist' ?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Eric
  • 4,821
  • 6
  • 33
  • 60

2 Answers2

22

I solved the problem by removing the *.egg-info/ directory : it seems that this directory memorized some older settings...

Eric
  • 4,821
  • 6
  • 33
  • 60
2

I had the same problem, but I was being dumb and misusing the exclude parameter.

If you have

packages=setuptools.find_packages(exclude="tests")

You will be excluding the directories "t", "e", "s", "t", "s"

What you should have is this:

packages=setuptools.find_packages(exclude=["tests"])
eltommo
  • 346
  • 3
  • 15