build: pip installs into venv/ make `make all` rebuild the local wheels

Open Beginner friendly
#277 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
build-system

Research direction

Start by reading the Makefile rules for the local wheels and the comment above the packages target; reproduce the issue with make -n -W venv/bin update_packages_lock_local. Update the prerequisite handling and comment based on the issue’s proposed fix, then check that the dry run no longer schedules unnecessary wheel rebuilds and that the documented make all behavior is accurate.

Written by the indexing model from the issue text.

Description

Problem

The rules that build the local wheels in packages/ list $(PYBIN) (venv/bin, a directory) as a normal prerequisite:

$(PACKAGE_DIR)/$(HTMLTOOLS_WHEEL): $(PYBIN) $(PACKAGE_DIR)/py-htmltools
$(PACKAGE_DIR)/$(SHINY_WHEEL): $(PYBIN) $(PACKAGE_DIR)/py-shiny
$(PACKAGE_DIR)/$(SHINYWIDGETS_WHEEL): $(PYBIN) $(PACKAGE_DIR)/py-shinywidgets
$(PACKAGE_DIR)/$(FAICONS_WHEEL): $(PYBIN) $(PACKAGE_DIR)/py-faicons
$(PACKAGE_DIR)/$(LIBSASS_WHEEL): $(PYBIN)

Any pip install that adds a file to venv/bin changes that folder's timestamp. That includes make test-deps, the first make test-scripts, and pip install -e packages/py-shiny. After that, the next make all deletes every local wheel and rebuilds it from whatever state the submodules are in, and downloads libsass again. An editable install also writes into packages/py-*, which triggers the same rebuild.

So local changes in a submodule can end up in the wheels that ship, without anyone asking for a rebuild.

This happens on main today through retrieve_packages → build/shinylive/pyodide/<wheel> → packages/<wheel>. update_packages_lock_local now also depends on the wheels, which adds a second path to the same rebuild.

The comment above the packages target is also out of date. It says the wheels "must be run manually after updating the package submodules; it will not run automatically with make all". make all does rebuild them.

How to see it

make -n -W venv/bin update_packages_lock_local

This prints rm -f ./packages/htmltools*.whl and pip wheel ... for every local package.

Possible fix

  • Make the venv an order-only prerequisite, so it must exist but its timestamp does not matter. For example: $(PACKAGE_DIR)/$(SHINY_WHEEL): $(PACKAGE_DIR)/py-shiny | $(PYBIN), and $(PACKAGE_DIR)/$(LIBSASS_WHEEL): | $(PYBIN).
  • Decide whether a change to the packages/py-* folders should still trigger a rebuild. A folder's timestamp changes only when entries are added or removed at its top level, so it is a weak signal either way.
  • Rewrite the comment above packages: so it says what make all does.
Dominant language
TypeScript
Stars
253
Forks
25
Avg merge
6d 22h
Merged PRs (30d)
13

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from posit-dev/shinylive

All issues in posit-dev/shinylive

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.