beeware / briefcase

Tools to support converting a Python project into a standalone native application.
https://briefcase.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
2.5k stars 354 forks source link

Eagerly update app requirements for `DevCommand` #1719

Open rmartin16 opened 3 months ago

rmartin16 commented 3 months ago

Changes

PR Checklist:

rmartin16 commented 3 months ago

For some of the output formats, Briefcase defers installing the app's requirements to the build system.

freakboy3742 commented 3 months ago
  • Running briefcase build android -r doesn't seem to actually force a re-installation of the requirements...
  • Would it be possible to update the Gradle build to respect a flag to force the re-installation of requirements?

It forces re-writing the requirements.txt file; but that doesn't touch transitive requirements (unless we were to modify Briefcase to output the requirements resolution, rather than just the explicit requirements. That might pair well with a solution to #476.

I don't know if the Chaquopy gradle plugin can be forced to do an eager update. AFAIK, it's essentially using a internally vendored fork of pip, so it might be possible - @mhsmith would need to answer that one.

mhsmith commented 3 months ago

I don't know if the Chaquopy gradle plugin can be forced to do an eager update. AFAIK, it's essentially using a internally vendored fork of pip, so it might be possible - @mhsmith would need to answer that one.

This is actually happening at the level of the Chaquopy Gradle plugin – it only reruns pip if the requirements have changed. Any change at all to the requirements file should be sufficient, including a comment.

rmartin16 commented 3 months ago

It forces re-writing the requirements.txt file;

it only reruns pip if the requirements have changed.

This could offer a rationale for inserting a datetime or something similar in requirements.txt each time it's written so Gradle detects a change and re-installs the requirements.

Eagerly updating a transitive dependency could easily have unintended consquences - especially if there's no way to opt out of that mode of update.

hmm....using the same python environment for disparate projects seems likely to create issues whether we do eager updates or not. But there's no real pressing issue to merge something like this in when other solutions could more holistically address this situation.

So, I'll will take a look at those references and see if anything looks doable right now.

[edit] Captured Android issue with -r in https://github.com/beeware/briefcase/issues/1721