-
-
Notifications
You must be signed in to change notification settings - Fork 380
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
briefcase dev
does not always install required dependencies
#1733
Comments
Thanks for the report. Briefcase only automatically installs dependencies on first run, which is identified based on whether the app's The documented behavior/workaround for this is to run Briefcase isn't YOLOing anything, and it definitely isn't creating its own virtual environment (at least, not for the The underlying issue to be addressed here is part of #881, which is currently being worked on as part of #1714. I'm going to close this ticket on the basis that it's halfway between "documented behavior" and "edge case we're aware of". |
Just to clarify, by "its own" environment, I meant the one that pipx set up for it. I was thinking "oh, can I have briefcase as a globally available command?" and right now, I think the answer is "not with pipx, at least", because the environment that pipx sets up is going to end up just having the requirements of every project installed in it. And if I set it up with Poetry or PDM, I'm skeptical it would work out much better; I haven't tried, but it looks like it would go:
|
Unless I'm missing something, that's completely backwards. If you have a global pipx virtual environment, and you create a new project, the first time you run The issue you've experienced is different - you created a new virtual environment on an existing project, and that is what has confused Briefcase's auto-install tooling. But, as I mentioned, that's essentially documented behaviour with a workaround of
The use of lockfiles is completely different issue (see #476). There are at least 2 problems here: Firstly, there isn't a standard lockfile format across the Python ecosystem. This means Briefcase would either need to support every competing lockfile format, or pick a winner and recommend the use of that one tool. Neither of those are especially appealing options to me as a project maintainer (especially as I'm not a user of PDM or poetry myself). Secondly, to some extent, PDM, Poetry et al are competitors to Briefcase, because they're trying to manage project requirements; but to the best of my knowledge, none of the existing toolchains or lockfile formats are able to handle Briefcase's use case. The key missing feature is support for cross-platform builds - i.e., building on machine X for deployment on machine Y, recognising that the wheels/hashes for machine Y will be different to the ones on machine X. I'm sympathetic to the dependency locking use case - that's why #476 is open as a feature request - but it's not a use case we currently support. |
So, I'd like to focus on the pipx side of things... The reason I ended up in this situation is that I saw briefcase installing project dependencies in |
I'm not sure how to respond to this. You've installed Briefcase using a global virtual environment, and then you're concerned that briefcase is... using a global environment? This seems a little like a "Doctor, it hurts when I do this"... "well don't do that" conversation. 😄 Virtual environments literally exist to provide per-project isolation. The BeeWare tutorial explicitly directs you to create a virtual environment, and tells you why you should do this. If you're actively choosing to not follow this advice, then, frankly, you reap what you sow. And then you "messed around a bunch", and are surprised that Briefcase isn't responding in an optimal (to you) way?
FWIW: We have, at various points in the past, contemplated modifying So - what specifically are you arguing for/against? |
My hope was that there'd be some kind of isolation, like how various PEP 517 builders have isolation for build-time requirements. Of course, this isn't a build situation, so... I'll get back to you if I can think of anything else to say that I find satisfying. |
Describe the bug
I managed to get briefcase into a state where my app is missing dependencies like
toga
, butbriefcase dev
does not reinstall, and simply fails.Steps to reproduce
pipx
to install briefcase instead of explicitly managing a virtual environmentbriefcase dev
, see what's in the virtual environment currently (viapipx runpip briefcase freeze
)briefcase dev
(and rerunpipx runpip briefcase freeze
)briefcase dev
Expected behavior
The first
briefcase dev
run installs dependencies and runs successfully. The second such run should do the same.Screenshots
No response
Environment
Logs
First freeze output:
Second freeze output:
Final dev output:
Additional context
In a sense, a lot of this is self-inflicted, but it's weird that I was able to self-inflict it. I ended up going down this path because I wanted to see what would happen if I avoided making a virtual environment explicitly, and simply relied on other tools to manage it. But when I saw that it was installing packages in its virtual environment, I didn't want just one
briefcase
install.I feel like what briefcase is doing here is at odds with the direction the Python ecosystem is going. Lots of tools and projects are focused around the idea of lockfiles or explicit requirements, and
briefcase dev
just kind of YOLOs its own virtual environment. Are there any tools beyond just virtualenv/venv thatbriefcase dev
is meant to work with?(Also, how is it getting into a state where it won't try to install the dependencies? I "fixed" it by blowing away the project directory and creating it from scratch...)
The text was updated successfully, but these errors were encountered: