-
-
Notifications
You must be signed in to change notification settings - Fork 383
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
Support path references external to sources
for Docker builds in requires
and requirement_installer_args
#2081
Comments
The approach I suggest of transforming paths in I'll explore a different approach that constrains the transformation to only inputs from |
Exploring this a bit more today and wanted to share some observations/notes that will inform whatever solution gets implemented. I've been revisiting the approach of doing this in Considering something more severe, then, I wonder if making "run the requirement installer" part of the @freakboy3742 @mhsmith do y'all have any opinions on this or helpful insights? |
I'm not sure I fully understand the risk of collision that you're envisaging. If there's a local file reference to Is there a failure mode I'm not seeing here?
Yeah - completely agreed that's a change in the wrong direction.
I think understand what you're driving at here... I'm not completely sure I see how this helps this problem with Docker path rewriting, though. However, I can see how it would help with the "use conda"/"use uv". Those use cases will pretty much require factoring out the "run the requirement installer" part into a standalone interface that can then be selected based on a setting, instantiated as required, then passed into whatever command needs to "do the installing". So - this is likely a refactor that is worthwhile; if you can see a way that it improves the docker path mapping case, then all the better. |
The trouble with collision is if a relative local path that is intended to refer to something in the container (i.e., relative to The way the refactor I've proposed helps is by making explicit when the requirement installer is running, so that the app context can safely map paths, compared to any generic command passed to Maybe this use case doesn't exist? If not, then mapping any relative local path ever passed to
I've realised I was assuming that only relative local paths should be mapped. But actually, if a local absolute path in Only mapping local relative paths seems to disambiguate this a bit. Do these use cases even exist, though? Or am I worrying about edge cases that wouldn't ever actually happen? |
I guess that's possible - but it also seems like something we can mitigate with documentation. If we explicitly document that certain locations inside the container are quarantined (e.g.,
Ok - that makes sense. In terms of ordering the work, it almost sounds like it that refactor could be performed independently of this "fix the Docker paths" task.
I'd argue this is the case we explicitly document as a not-supported case. If
Never say never :-) but I think I'd be comfortable putting this in the "known constraints of reality" bucket. |
What is the problem or limitation you are having?
Once #2059 is merged and released, the
requirement_installer_args
option will be available. Local, relative paths used in the option (e.g., as an argument to--find-links
) are automatically transformed into absolute paths, which enables seamless use for all build targets that build on the host. Docker, however, does not build on the host, so these path references are meaningless to it.This also affects usages of local paths in
requires
, for which Briefcase handles local paths in a manner similar torequirement_installer_args
.Describe the solution you'd like
Add support for these by mounting referenced local paths into the container. Any solution for this will require tracking any local references found in
requires
orrequirement_installer_args
and exposing them in such a way that the Docker integration is able to include those mounts in calls to commands in the build container.I can see two ways of actually mounting them:
/opt/{mount-name}
in the container, and re-write any usage of those paths in the command arguments to reference the location in the container. Re-writing the arguments could be risky, but Briefcase already does this when it converts relative paths to absolute paths anyway, so it doesn't seem like this would really be too unique.The first option seems better to me, even though it's yet another level of argument re-writing. If the re-writing is implemented in
DockerAppContext._dockerize_args
itself, then it could work automatically for any path referenced on the host. In other words, it may be possible to implement this in such a way that it solves it for any command running on the host that happens to use a local path reference, rather than only forrequires
andrequirement_installer_args
. On the other hand, if more care is desired, a solution scoped specifically to just those two arguments should be explored. This is perhaps best decided in PR review, particularly if an answer isn't immediately obvious.Describe alternatives you've considered
See above.
Additional context
A temporary workaround for
requirement_installer_args
is to avoid the path transformation in that option by using the=
style for the argument (e.g.,--find-links=./wheels
) and then addingwheels
tosources
andcleanup_paths
. This is just a workaround and shouldn't be relied on for long-term usage.The text was updated successfully, but these errors were encountered: