@@ -240,21 +240,54 @@ fits in memory::
240240   >>> with open('myapp.pyz', 'wb') as f: 
241241   >>>     f.write(temp.getvalue()) 
242242
243- To filter an allow-list or deny-list of files in the directory being zipped, make use
244- of :option: `--exclude ` and/or :option: `--include ` with glob-style patterns.
243+ To filter which files go into the archive, use :option: `--include ` or
244+ :option: `--exclude ` with standard glob patterns (as implemented by
245+ :class: `pathlib.PurePath.match `).
246+ 
247+ Including only specific files:
245248
246249.. code-block :: shell-session 
247250
248251   $ ls myapp 
249-    __main__.py helper.py   notthis.py  
252+    __main__.py   helper.py  data.txt  
250253
251-    $ python -m zipapp myapp -o myapp.pyz --include "help*" --include "not*" --exclude "n*" 
254+    # Keep only Python sources; anything not matched is implicitly excluded 
255+    $ python -m zipapp myapp -o myapp.pyz --include "*.py" 
252256   $ unzip myapp.pyz -d extracted_myapp 
253257   Archive:  myapp.pyz 
254-     extracting: extracted_myapp/helper.py 
258+     extracting: extracted_myapp/__main__.py   
259+     extracting: extracted_myapp/helper.py  
260+ 
261+  Excluding a subtree or file type:
262+ 
263+ .. code-block :: shell-session 
264+ 
265+    $ ls -R myapp 
266+    myapp: 
267+    __main__.py  helper.py  tests/  build/ 
255268
256-    $ ls extracted_myapp 
257-    helper.py 
269+    myapp/tests: 
270+    test_helper.py 
271+ 
272+    myapp/build: 
273+    scratch.txt 
274+ 
275+    # Add everything except the tests/ directory items and *.pyc files 
276+    $ python -m zipapp myapp -o myapp.pyz --exclude "tests/**" --exclude "*.pyc" 
277+    $ unzip myapp.pyz -d extracted_myapp 
278+    Archive:  myapp.pyz 
279+     extracting: extracted_myapp/__main__.py   
280+       creating: extracted_myapp/build/ 
281+     extracting: extracted_myapp/build/scratch.txt   
282+     extracting: extracted_myapp/helper.py   
283+       creating: extracted_myapp/tests/ 
284+ 
285+  .. note ::
286+ 
287+    * Patterns follow :class: `pathlib.PurePath.match `. To match all of a
288+      directory contents, use ``dir/** ``.
289+    * Path separator handling is platform-specific. On POSIX, backslashes are
290+      literals (``\ `` does not act as a separator).
258291
259292
260293.. _zipapp-specifying-the-interpreter :
0 commit comments