-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add support for disabling installation from pre-built wheels #956
Conversation
--no-binary
and --no-binary-package <name>
@@ -155,3 +159,33 @@ impl Display for BuildKind { | |||
} | |||
} | |||
} | |||
|
|||
#[derive(Debug)] | |||
pub enum NoBinary { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do correct me if there's somewhere better for this.
I tried to put it alongside Reinstall
but it's needed in the resolver as well so I put it in this shared crate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems okay -- we don't have a much better / obvious answer.
|
||
/// Install a package without using pre-built wheels. | ||
#[test] | ||
fn install_no_binary() -> Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests are slow (~5s). Maybe I should use a scenario that builds faster?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd also be ideal to have coverage for e.g. installing a wheel via direct URL with --no-binary
(which should fail)
// Find the most-compatible wheel | ||
for (wheel, file) in files.wheels { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following made conditional and indented without change.
Will review today! |
@@ -2,9 +2,10 @@ pub use downloader::{Downloader, Reporter as DownloadReporter}; | |||
pub use editable::{BuiltEditable, ResolvedEditable}; | |||
pub use installer::{Installer, Reporter as InstallReporter}; | |||
pub use plan::{Plan, Planner, Reinstall}; | |||
// TODO(zanieb): Just import this properly everywhere else | |||
pub use puffin_traits::NoBinary; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this stale / can it be removed? It looks like you are importing from puffin_traits
in the various files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah commentary at #956 (comment)
We should probably remove it and fix the imports that use this crate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, nice work. My only concern is that we now have --no-binary
and --no-build
which does the opposite. Should those somehow be a single flag...? Should they be marked as conflicting in some sense, since providing both excludes all distributions?
Well, I don't think we should explore some sort of "unified" flag in the pip-compatible interface. I think we can consider it in our own interface later.
Yes I think we should mark them as conflicting. |
Opening #977 for the first point. |
Adds support for disabling installation from pre-built wheels i.e. the package must be built from source locally.
We will still always use pre-built wheels for metadata during resolution.
Available via
--no-binary
and--no-binary-package <name>
flags inpip install
andpip sync
. There is no flag forpip compile
since no installation happens there.When packages are already installed, the
--no-binary
flag will have no affect without the--reinstall
flag. In the future, I'd like to change this by tracking if a local distribution is from a pre-built wheel or a locally-built wheel. However, this is significantly more complex and different thanpip
's behavior so deferring for now.For reference,
pip
's flag works as follows:Note we are not matching the exact
pip
interface here because it seems complicated to use. I think we may want to consider adjusting our interface for this behavior since we're not entirely compatible anyway e.g. I think--force-build
and--force-build-package
are clearer names. We could also consider matching thepip
interface or only allowing--no-binary <package>
for compatibility. We can of course do whatever we want in our own install interfaces later.Additionally, we may want to further consider the semantics of
--no-binary
. For example, if I runpip install pydantic --no-binary
I expect just Pydantic to be installed without binaries but by default we will build all of Pydantic's dependencies too.This work was prompted by #895, as it is much easier to measure performance gains from building source distributions if we have a flag to ensure we actually build source distributions. Additionally, this is a flag I have used frequently in production to debug packages that ship Cythonized wheels.