How to make "setup.py bdist_egg" ignore specific source files?

I am trying to create a package for a django application, but excluding all test modules. I tried setting

exclude = ["*.tests", "*.tests.*", "tests.*", "tests"] 

on find_packages and defining MANIFEST.in , but tests are always compiled and included.

Any clues?

+4
source share
2 answers

I found a combination by adding the find_packages rule and writing out the MANIFEST.in rules , i.e. prune tests

Note that for python 3.2 and find_packages you must have __init__.py in the root tests, for the find_packages consider the test folder as a package.

find_packages example exclude command in setup.py

  packages=find_packages( exclude=["*.tests", "*.tests.*", "tests.*", "tests"]), 

Example MANIFEST.in

  include *.txt *.ini *.cfg *.rst recursive-include fmcc *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml prune tests 
+1
source

May I ask ... have you tried:

find_packages (ex = ['tests'])

0
source

Source: https://habr.com/ru/post/1401652/


All Articles