title: What's the right syntax for controlling Inclusion and Exclusion of data directories in Setup.py?
body: <p><strong>Q:</strong> In creating a python distribution using <strong>setup.py</strong> and <strong>MANIFEST.IN,</strong> how can I define define the nested data directories that I do and don't want in the final installation directory <em>(Complex example!)</em></p>
  <p><strong>Background:</strong>  My program has a set of data directories (not source directories). Within each of these main directories, is are some subdirectories with user specific names.  In my setup.py, I want to <strong>exclude</strong> <em>my own</em> data directories, while still <strong>including</strong> the other subdirectories that all users should have access to.</p>
  <p>The file tree <strong>AS IT CURRENTLY EXISTS</strong> in my Pycharm DEVELOPMENT environment:</p>
  <pre><code>  PycharmProjects
       pythonProject
           data_files_directory_1
              subdirectory_to_be_EXcluded
                   data_file_to_be_EXcluded.txt
              subdirectory_to_be_INcluded
                    data_file_to_be_INcluded.txt
               index.html
           data_files_directory_2
              subdirectory_to_be_EXcluded
                   data_file_to_be_EXcluded.txt
              subdirectory_to_be_INcluded
                    data_file_to_be_INcluded.txt
               index.html
           src
               __init__.py
               constants.py
               helper1.py
               helper2.py
               main.py
  </code></pre>
  <p><strong>Expected result:</strong></p>
  <p>The file tree <strong>I <em>WANT</em> AFTER INSTALLATION</strong> on target  machine:</p>
  <pre><code>  PycharmProjects
       pythonProject
           data_files_folder_1
              subdirectory_to_be_INcluded
                    data_file_to_be_INcluded.txt
           data_files_folder_2
              subdirectory_to_be_INcluded
                    data_file_to_be_INcluded.txt
               index.html
           src
               __init__.py
               constants.py
               helper1.py
               helper2.py
               main.py
  </code></pre>
  <p><strong>Actual result:</strong></p>
  <pre><code>  PycharmProjects
       pythonProject
           data_files_directory_1
              subdirectory_to_be_EXcluded
                   data_file_to_be_EXcluded.txt
              subdirectory_to_be_INcluded
                    data_file_to_be_INcluded.txt
               index.html
           data_files_directory_2
              subdirectory_to_be_EXcluded
                   data_file_to_be_EXcluded.txt
              subdirectory_to_be_INcluded
                    data_file_to_be_INcluded.txt
               index.html
           src
               __init__.py
               constants.py
               helper1.py
               helper2.py
               main.py
  </code></pre>
  <p><strong>What I tried / Source code:</strong></p>
  <p><strong>MANIFEST.IN</strong></p>
  <pre><code>...
  graft data_files_directory_1
  graft data_files_directory_2
  ...
  </code></pre>
  <p><strong>setup.py</strong></p>
  <pre><code>setup(
      ...
      # include everything in MANIFEST.IN:
      include_package_data=True, 
      # ...but exclude just these directories */subdirectory_to_be_EXcluded/* from all packages
      exclude_package_data={&quot;&quot;: [&quot;*/subdirectory_to_be_EXcluded/*&quot;]},
      ...
  )
  </code></pre>
  <p><strong>PROBLEM:</strong>
  As you can see, the exclusion request is being ignored.</p>
  <p>I must confess that after heavy use of Google, YouTube and PyCharm documentation on setup.py and installers that I'm not really clear what the correct way is to <em><strong>include</strong></em> and <em><strong>exclude</strong></em> NON-source directories and files.    It seems like many of the possible solutions are <em>deprecated</em>!</p>
  <p>What is the <em>correct</em> way to do this?</p>
  <p>Can someone point me at some good working examples?</p>