python / python/cpython

zippapp/ macOS: .DS_Store files should be excluded from the generated archives

Open
#117,829 16 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

OS-mac stdlib type-feature
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

When generating a zipapp under macOS then random ".DS_Store" files get included into the generated archive.

e.g.

$ python3.12 -m zipapp --output cfv.pyz --compress --python /usr/local/bin/python3 zipapptempdir
$ unzip -l cfv.pyz 
Archive:  cfv.pyz 
  Length      Date    Time    Name
---------  ---------- -----   ----
     6148  04-13-2024 00:17   .DS_Store
      186  04-13-2024 00:20   __main__.py
        0  04-13-2024 00:17   cfv/
     6148  04-13-2024 00:17   cfv/.DS_Store
        …
---------                     -------
   137783                     20 files

Those files quickly get regenerated by Finder, so it's hard to entirely avoid them getting added to the archive by trying to pre-delete them before executing zipapp. .DS_Store files can add significantly to the size of the archive, possible have privacy implications (e.g. leaked spotlight comments), and serve zero purpose for the python app.

CPython versions tested on:

3.12

Operating systems tested on:

macOS

Linked PRs
  • gh-120537

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the python3.12 -m zipapp command shown in the report and reproduce it on macOS using a temporary app directory containing .DS_Store files. Done means generated archives no longer include those files; check the archive contents with unzip -l as shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.