Skip to content

Commit e2d568d

Browse files
CreatmanCEOclaude
andcommitted
fix(npm): exclude __pycache__ from tarball via prepack hook + .npmignore
- prepack script walks scripts/ tests/ examples/ and removes __pycache__ dirs before npm packs the tarball. Reduces published package from 43→33 files, 112kB→65kB. - .npmignore as belt-and-suspenders second filter (won't take effect when files[] whitelist is present, but documents intent and works for tools that respect it). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c7729f2 commit e2d568d

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

.npmignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# npm package contents are governed by package.json `files`.
2+
# This .npmignore is a belt-and-suspenders second filter for things that
3+
# can sneak in via included directories.
4+
5+
# Python build artefacts
6+
__pycache__/
7+
*.pyc
8+
*.pyo
9+
.pytest_cache/
10+
.ruff_cache/
11+
.mypy_cache/
12+
13+
# Repo dev infra (not needed by end users)
14+
tests/
15+
.github/
16+
pyproject.toml
17+
requirements-dev.txt
18+
19+
# Editor / OS
20+
.DS_Store
21+
Thumbs.db
22+
.vscode/
23+
.idea/
24+
25+
# Skill state from local dev runs
26+
.isolation-verified
27+
fixtures/iso-test/
28+
playwright/.auth/
29+
test-results/
30+
playwright-report/
31+
reports/
32+
33+
# Local env
34+
.env*

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
},
4343
"type": "commonjs",
4444
"scripts": {
45-
"test": "echo 'Python tests live under tests/python/. Run: pip install -r requirements-dev.txt && pytest'"
45+
"test": "echo 'Python tests live under tests/python/. Run: pip install -r requirements-dev.txt && pytest'",
46+
"prepack": "node -e \"const fs=require('fs'),p=require('path'),walk=(d)=>fs.existsSync(d)&&fs.readdirSync(d).forEach(f=>{const x=p.join(d,f);if(fs.statSync(x).isDirectory()){if(f==='__pycache__'){fs.rmSync(x,{recursive:true,force:true});console.log('cleaned',x);}else walk(x);}});walk('scripts');walk('tests');walk('examples');\""
4647
}
4748
}

0 commit comments

Comments
 (0)