Skip to content

fix(build): Write the package name of each app to apps.txt - #665

Open
ssiyad wants to merge 1 commit into
developfrom
fix/build/apps-txt-app-name
Open

ssiyad wants to merge 1 commit into
developfrom
fix/build/apps-txt-app-name

Conversation

@ssiyad

@ssiyad ssiyad commented Nov 10, 2026

Copy link
Copy Markdown
Member

Summary

The remote builder writes the Press app name to sites/apps.txt. bench get-app installs an app under its package name, and this name can be different. Frappe imports each app in apps.txt when it loads all the apps of a bench. On such a bench, bench console, bench backup, bench set-maintenance-mode and other commands fail with ModuleNotFoundError. Site updates, backups and site migrations from the bench fail.

Example: the Press app sheets_sync (gavindsouza/sheets) has the package name sheets at older commits. bench get-app installs it in apps/sheets, but apps.txt lists sheets_sync:

  File "apps/frappe/frappe/__init__.py", line 1688, in setup_module_map
    for module in get_module_list(app):
  ...
ModuleNotFoundError: No module named 'sheets_sync'

Before the builds moved to the agent, Press wrote apps.txt with the package name (_get_app_name, removed in frappe/press@b1e00f345).

Changes

  • ContextManager._get_app_name reads the package name from pyproject.toml, then setup.cfg, then setup.py. This is the same order as bench. It parses setup.py with ast, the same way as bench. If no file gives a name, it uses the Press app name.
  • prepare_build_context writes these names to apps.txt.

Not in this PR

Other steps still use the Press app name for paths inside the image: patch builds (_pull_app, _reinstall_app_deps), _bench_build_app, upload_app_assets, get_cached_app.py and the pullable_release block of the Press Dockerfile. They can fail for an app whose package name is different.

Testing

  • TestAppsTxt in agent/tests/test_builder.py covers pyproject.toml, setup.cfg, setup.py and the fallback. It fails without the change.
  • python -m unittest agent.tests.test_builder: 13 tests pass.
  • pre-commit passes on the changed files.

The remote builder wrote the Press app name to apps.txt. `bench get-app`
installs an app under the package name from pyproject.toml, setup.cfg or
setup.py, and this name can be different. For example, the Press app
`sheets_sync` installs as `sheets` at some commits.

Frappe imports each app in apps.txt when it loads all the apps of a
bench. On such a bench, `bench console`, `bench backup` and other
commands failed with `ModuleNotFoundError`.

Read the package name in the same order as bench, and write it to
apps.txt. Press did this before the builds moved to the agent.
@mergify

mergify Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant