Packages in `requirements.txt` not updated without `charmcraft clean`
Metadata
Current evaluation
Closed without a code fix: the legacy charm plugin continued caching by requirements.txt, leaving local-package changes unresolved; newer Python/Poetry plugins were suggested instead.
Resolution: closed stale
Reason: Maintainers confirmed the cache behavior and discussed detecting in-project package changes, but no resolving PR or commit landed. The report was closed as stale after the legacy plugin remained unchanged.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Version: `2.2.0`
## Steps to reproduce
1. `git clone https://github.com/carlcsaposs-canonical/charm-bug-report.git`
2. `cd charm-bug-report/`
3. `charmcraft pack`
4. `git checkout origin/update`
5. `charmcraft pack`
6. Unzip *.charm & `cat venv/package/foo.py` or deploy charm and look at `juju debug-log --replay`
## Expected behavior
Message should be `Hello!` (same as `cat package/package/foo.py`)
## Actual behavior
Message is `Hello, world!` (package was not updated with changes in `origin/update` branch)
## Workaround
I'm able to get charmcraft to correctly update the package without a `charmcraft clean` by deleting `/root/parts/charm/build/charmcraft-dependencies-hash.txt` in the LXC container
It appears that there's an issue here:
https://github.com/canonical/charmcraft/blob/8a3a0e6f1380b993c4c53b6e318485cb853234a8/charmcraft/charm_builder.py#L294-L311
The dependencies hash file remains the same if there are updates to the `./package/` Python package since `requirements.txt` remains unchanged.
## Notes
I also believe (but haven't tested to confirm) that this means that if you have a requirements.txt that looks like this
```
ops>=1.5.0
tenacity
```
that any new versions of `ops` or `tenacity` would not be updated without a `charmcraft clean`.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed stale | Closed without a code fix: the legacy charm plugin continued caching by requirements.txt, leaving local-package changes unresolved; newer Python/Poetry plugins were suggested instead. | |
| stealth/space-bunny-alpha | — | closed stale | Closed as stale without a code fix; the legacy charm plugin remained unchanged, leaving users to migrate to the Python or Poetry plugins. | |
| stealth/space-bunny-alpha | — | closed stale | Stale local-package cache report was closed after discussion; the legacy charm plugin was unchanged, leaving users to migrate to the Python or Poetry plugins for improved dependency handling. | |
| qwen/qwen3.6-35b-a3b | — | — | Maintainers confirmed skipping rebuilds when requirements.txt is unchanged is intentional for performance. No fix was implemented. The issue was closed as deferred, with a final comment questioning if newer build plugins like poetry or uv exhibit the same behavior. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
95
Complexity:
30
Confidence:
85
Support Request:
20
|
close stale | charmcraft pack fails to update local Python packages when requirements.txt is unchanged. Maintainer confirmed intentional caching behavior for performance. Issue inactive for over 3 years with no follow-up on requested local package support. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
98
Complexity:
25
Confidence:
90
Support Request:
15
|
close stale | Issue reports that charmcraft pack skips updating local Python packages when requirements.txt is unchanged due to a hash-based cache. Maintainer confirmed current behavior is intentional for performance. Author offered a PR for a flag but activity ceased over 3 years ago. |
Update history
| Date | Change |
|---|---|
| closed |
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1059 Package removed from `requirements.txt` not removed without `charmcraft clean` | charmcraft | closed | Closed as expected behavior: maintainers directed users to run `charmcraft clean` after changing dependencies because the existing build environment is not refreshed automatically. | |
| #470 [REGRESSION] charmcraft not installing dependencies from requirements.txt anymore | charmcraft | closed | Fixed by merged PR #472 (commit 57b74577, "build: include venv in prime if charm-requirements defined"), which restored requirements.txt deps appearing in packed charms; maintainer closed after release in edge. |