Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use an isolated environment for briefcase dev #1735

Open
freakboy3742 opened this issue Apr 17, 2024 · 2 comments
Open

Use an isolated environment for briefcase dev #1735

freakboy3742 opened this issue Apr 17, 2024 · 2 comments
Labels
enhancement New features, or improvements to existing features. not quite right The idea or PR has been reviewed, but more work is needed.

Comments

@freakboy3742
Copy link
Member

What is the problem or limitation you are having?

At present, briefcase dev uses the currently active virtual environment to run a project in developer mode.

However:

  • if you don't have an active virtual environment, app dependencies will be installed into the global environment.
  • If you use the same virtual environment for multiple projects, it's easy for dependencies to conflict.
  • The development environment will include packages (including briefcase itself, and setuptools_scm) that may not exist in the packaged runtime environment, which can lead to inconsistencies.

Describe the solution you'd like

briefcase dev should create and use a standalone virtual environment for development mode. This would ensure that each app has unique and isolated dependencies.

Describe alternatives you've considered

Do nothing.

Additional context

The most notable impact of this approach is that dependencies installed in the briefcase environment will no longer be visible to development mode. This complicates the process of adding dependencies to a project; however, it would be consistent with the behavior of briefcase run - so arguably this is a good thing, as it would avoid the "package X is in my environment, why doesn't briefcase run work" questions.

If this change is made; we may want to consider to additional related changes:

  1. a --no-isolation option that reverts to the current "use the briefcase environment" behavior
  2. a new briefcase add command to manage adding new dependencies

An alternative to (2) would be #1367 (or similar) - i.e., provide better integration with other tools that manage dependencies.

It will also impact on #881/#1714-style build tracking; but likely in a positive way, as isolation will remove some edge cases in keeping the environment current.

@freakboy3742 freakboy3742 added enhancement New features, or improvements to existing features. not quite right The idea or PR has been reviewed, but more work is needed. labels Apr 17, 2024
@freakboy3742
Copy link
Member Author

I've raised this issue for discussion - I'm not 100% sold on whether it's a good idea. Before anyone starts on an implementation, please confirm consensus has been reached on whether this is a good idea.

@michelcrypt4d4mus
Copy link

+1 to this... just ran into a situation where because i installed briefcase in the global python environment running briefcase dev -r was installing all dependencies into the global environment. while this is my fault for installing briefcase outside of a venv it was a confusing and unexpected user experience (and this is outside of the advantage of avoiding inconsistencies between local dev and the packaged environment as mentioned by @freakboy3742)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features, or improvements to existing features. not quite right The idea or PR has been reviewed, but more work is needed.
Projects
None yet
Development

No branches or pull requests

2 participants