Giter Site home page Giter Site logo

opt-out options about cargo-binstall HOT 14 CLOSED

cargo-bins avatar cargo-bins commented on May 28, 2024 1
opt-out options

from cargo-binstall.

Comments (14)

NobodyXu avatar NobodyXu commented on May 28, 2024 1

That sounds great, but I would actually like a negative bound:

--disable-strategy source

from cargo-binstall.

passcod avatar passcod commented on May 28, 2024 1

ok, sounds good

from cargo-binstall.

ryankurte avatar ryankurte commented on May 28, 2024 1

i think the perk of a specific list of strategies is you can enforce ordering and easily show the default behaviour? like --strategy metadata,quickinstall,releases shows pretty well how it's going to search and could just end up in the CLI help...
if we had that + an opt out would that work for you @NobodyXu ?

from cargo-binstall.

passcod avatar passcod commented on May 28, 2024 1

I was thinking of names for the strategy, and had the thought that source was ambiguous, given the multiple meanings; I think compile instead is better?

from cargo-binstall.

passcod avatar passcod commented on May 28, 2024 1

Yes, that sounds reasonable. compile should be allowed as the only option, too; that wouldn't be very useful in principle but I could see it being used in scripts, for example.

from cargo-binstall.

passcod avatar passcod commented on May 28, 2024

I was thinking about this when adding those features, but could not figure out good ergonomics. The general idea of being able to more precisely control what will happen is good, to be clear, especially for script use. However, I don't think these proposed flags work well:

  • They're very long
  • They're inconsistently named. Both --no- and --disable-? That's not very intuitive.
  • It's not going to scale. If more fallbacks are added, we'll need more flags. That's not necessarily a bad thing, but we probably want to figure out a solid pattern right now so adding more is straightforward.

As a point of discussion, perhaps something like this:

--use=crates.io,quickinstall,cargoinstall
--use=crates.io,quickinstall
--use=quickinstall

and some aliases:

  • source for any source methods (only cargoinstall for now)
  • bin for any binary methods (crates.io, quickinstall)
  • 3rdparty for any 3rd party...

I'm not super happy with that scheme though, for these reasons:

  • It flattens the "strategies" in one single list/category. In reality there's several dimensions:

    • where to find the package
    • where to find the version metadata
    • where to find the archive URLs or if we should install from source, and where to fetch that source

    For example, the crates.io strategy:

    • looks to crates.io (index or API currently, and possibly just API going forward) to find the package
      • or possibly locally, explicitly, when using the manifest option
    • fetches the list of versions from crates.io and resolves using crates.io rules
    • parses Cargo.toml for templates to render into archive URLs

    And quickinstall:

    • looks to crates.io, just like the above (in fact it's the same code)
    • also fetches versions the same way
    • completely ignores the Cargo.toml templating and builds its own URLs

    But thinking of a "install from git" strategy, it would:

    • look at a git repo to find the package
    • fetch git tags or guess at version
    • read the Cargo.toml there for any templating for the URL

    And the other "github releases strategy" could:

    • do similarly initially
    • find a github release from a crates.io version (or directly if going from a git repo)
    • but mostly ignore templating, and figure out the release URLs from a file list attached to a release

    However, exposing all this complexity to the user is not great either. I'm not sure what to do here yet.

  • I think use is too generic

  • This would enable only a "do these things exactly" and not e.g. "never pull from quickinstall"

In summary: idea is sound, more discussion needed.

from cargo-binstall.

NobodyXu avatar NobodyXu commented on May 28, 2024

After #267 , I think we need an option to disable fallback to cargo like --no-cargo-install-fallback.

from cargo-binstall.

passcod avatar passcod commented on May 28, 2024

I was thinking of a --strategy metadata, quickinstall,source (as default) and then you can say e.g. metadata,source or metadata,quickinstall or just metadata.

That way it also makes it possible to reorder if you want to for some reason.

It's a bit simplistic as to what happens behind the scenes but probably the best we can do to balance UI with versatility.

e.g. when we add installs from guesstimating github releases we can call it ghreleases or something.

from cargo-binstall.

passcod avatar passcod commented on May 28, 2024

As in do both include and exclude or just do the exclude? I'm happy with both of these tbh.

from cargo-binstall.

NobodyXu avatar NobodyXu commented on May 28, 2024

I'd prefer --disable-strategy here since we are adding opt-out options.

from cargo-binstall.

NobodyXu avatar NobodyXu commented on May 28, 2024

Yes, that's ok for me.

from cargo-binstall.

NobodyXu avatar NobodyXu commented on May 28, 2024

Yeah, that sounds better.

from cargo-binstall.

NobodyXu avatar NobodyXu commented on May 28, 2024

I'm working on this and I got a question regarding --strategy.

i think the perk of a specific list of strategies is you can enforce ordering and easily show the default behaviour? like --strategy metadata,quickinstall,releases shows pretty well how it's going to search and could just end up in the CLI help...

Since we can enforce the order of which strategies are used, what if user specifies compile as the first strategy, which would make cargo-binstall equivalent to cargo-install?

Should we reject this and only accept compile as the last option?

from cargo-binstall.

NobodyXu avatar NobodyXu commented on May 28, 2024

@somehowchris @ryankurte I've implemented this in #510, feel free to try it out and give feedback to me!
I would merge this before releasing next version of binstall, which I might release in roughly 2-3d.

from cargo-binstall.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.