Skip to content

πŸ¦€ Fast rustup shims for python

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
license-apache.txt
MIT
license-mit.txt
Notifications You must be signed in to change notification settings

BrokenSource/Rustbin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Warning

Always check the repository for latest readme information.

Rustbin

Fast rustup shims for python



πŸ”₯ Description

Rustbin provides rustup and all of its proxies cargo, rustc.. (1) (2) in a convenient python package.

# After installation
$ tree .venv
.venv
β”œβ”€β”€ bin
β”‚   β”œβ”€β”€ cargo
β”‚   β”œβ”€β”€ rustc
β”‚   └── rustup-init
(...)

βœ… Also check out Rustman, for python methods, easy cross compilation, management and automation!

Note: This is a community repackaging effort with no affiliation to the Rust project.

πŸ“¦ Installation

Rustbin is available on PyPI and can be added to your pyproject.toml or pip installed directly:

[project]
dependencies = ["rustbin"]

Versioning of the package will follow:

  • Same as rustup, without rushes to match all upstream releases (at least a month stable).
  • Broken releases might be deleted and re-uploaded as 'post' within a week, if needed.
  • New platforms might be added post-release at any time, and with no version bump.
  • Ancient versions might be removed to save space, in case a size grant is not given.

Important

As mapping system information from Python/Wheels to a Rust Triple is non-trivial, and that the package needs rust to build from source, attempting to pip install on "unknown" platforms without prebuilt wheels on pypi will make an empty one from source without rustup or shims.

Your best path is to install rustup externally in such cases, this package essentially becomes a no-op.

Open issues to tell interest in platforms that are actually used, so the package doesn't balloon in size!

πŸš€ Speeds

Rustbin bundles a small (rust) program to spawn shims faster than [project.scripts] ever could:

βœ… Less than a millisecond overhead, compared to ~105ms for a python script

# Note: /bin/cargo is effectively a zero-cost symlink
$ RUSTUP_FORCE_ARG0=cargo hyperfine /bin/rustup
  Time (mean Β± Οƒ):      30.6 ms Β±   0.8 ms    [User: 21.5 ms, System: 8.9 ms]
  Range (min … max):    29.5 ms …  36.0 ms    100 runs

# Shims calling .venv/bin/rustup-init
$ hyperfine .venv/bin/cargo
  Time (mean Β± Οƒ):      31.2 ms Β±   0.4 ms    [User: 21.7 ms, System: 9.2 ms]
  Range (min … max):    30.5 ms …  32.7 ms    100 runs

Note: Full benchmark command was nice -20 taskset -c 2 hyperfine -w 50 -r 100 -N (command)

βš–οΈ License

Rustbin is dual-licensed under the MIT or Apache-2.0 license, at your option.

About

πŸ¦€ Fast rustup shims for python

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
license-apache.txt
MIT
license-mit.txt

Contributing

Stars

Watchers

Forks

Sponsor this project

  •