Skip to content

[Bug]: shiny wheel ships with extraneous files #2125

@cpsievert

Description

@cpsievert

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]"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions