posit-dev / posit-dev/py-shiny

[Bug]: shiny wheel ships with extraneous files

Open
#2,125 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ai-triage:done bug Priority: Medium
Dominant language
Python
Stars
1.8k
Forks
135
Avg merge
2d 18h
Merged PRs (30d)
21

Description

shiny currently bundles 1300+ files in it's wheel file. Here's a script to count them:

count.py
import subprocess
import zipfile
from collections import Counter
from pathlib import Path

# Build the wheel
subprocess.run(["python", "-m", "build", "--wheel"], check=True)

# Find the built wheel
dist = Path("dist")
wheel = max(dist.glob("*.whl"), key=lambda p: p.stat().st_mtime)

# Count files per top-level directory
counts = Counter()
with zipfile.ZipFile(wheel) as zf:
    for name in zf.namelist():
        top_dir = name.split("/")[0]
        counts[top_dir] += 1

for dirname, count in sorted(counts.items()):
    print(f"{dirname}: {count} files")

This leads to slow deployment times on Connect since each file comes with about 5ms of latency (and 5*1400~=7sec)

Currently, there are 464 files under api-examples/, which don't need to be bundled with the wheel.

There is another good chunk of files (~300) under shiny/www/shared/sass/ that are only needed for Theme. We may want to consider moving those to another package that comes with the pip install "shiny[theme]"

Contributor guide

No contributing guide indexed for this repository

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 by running count.py and building the wheel to confirm which directories contribute the most files. Inspect the wheel contents, focusing first on api-examples/ and then shiny/www/shared/sass/. Done means api-examples/ is excluded and the packaging decision for the Theme-related Sass files is implemented or clearly resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.