Make it better!
Project description
项目介绍
这是一个 Python 和 Rust 混合编程的项目,主要目的是比较 Rust 和 Python 的性能差异。目前这个项目是 rshare,我们 在项目中通过 PYO3 和 Maturin 来将 Rust 代码包装到 Python 中,以使得用户可以通过 Python 代码来调用 Rust 写的函数。当然其中是有性能损失的。
说明
目前已经支持 64 位操作系统,包括 Windows,Linux,macOS 和 ARM64 架构的 Linux 系统。
安装
通过 pip install rshare --upgrade -i https://pypi.org/simple
来安装 rshare
体验 Rust 的极致性能!
使用
import rshare as rk
# Rust 接口
fetch_title_str = rk.fetch_title(url="https://www.baidu.com")
print(fetch_title_str)
# Python 接口
fetch_name_str = rk.fetch_name(url="https://www.baidu.com")
print(fetch_name_str)
# Rust 接口测试计算 5 日均线
result_rs = rk.calculate_moving_average_rs(data=[10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0] * 10000000, window_size=5)
print(result_rs)
构建
maturin build
maturin develop --release
版本说明
目前主要是说明开发的软件版本:
- Python 3.11
- Rust 1.74.1
注意事项
需要重新编译部分内容
更新
- 推送到 main 分支
- 修改
Cargo.toml
中的版本号 - 打标签:
git tag v0.1.7
- 通过推送标签进行升级:
git push origin tag v0.1.7
镜像推送
- 基于原始镜像:
ghcr.io/rust-cross/manylinux2014-cross:aarch64
docker build -t jindaxiang/newopen .
docker tag local-image:tagname jindaxiang/new-repo:tagname
docker push jindaxiang/new-repo:tagname
查看
贡献代码
关注 .vscode
用于 debug 代码,新增 .vscode 文件夹
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rshare-0.1.13.tar.gz
(20.2 kB
view hashes)
Built Distributions
Close
Hashes for rshare-0.1.13-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5311855f996e23408b692466cd8001452e067dc689ffda5141b1d7c238735214 |
|
MD5 | bdc344ca9ab8b9d4fd678d72a17b89da |
|
BLAKE2b-256 | a061f97df9954b3cd34314cd7ccd883d8c4ce82486f74e9c22c7e8644ebd2215 |
Close
Hashes for rshare-0.1.13-cp38-abi3-manylinux_2_34_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bd695804a37a5f6afec8c22964c778c5db1a4ec00f246b0619807a4d089ffaf |
|
MD5 | 300b058a30fef2c25a9efba6f0e2767b |
|
BLAKE2b-256 | ace83f1f04d2cb4ab7573979e13e8f2c14751187cfbba5a40f738cf64e19e4b9 |
Close
Hashes for rshare-0.1.13-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 855e83d4275e25a04ad9b8dfb2241d3296f289c3908858bd395e84a014ce7cdf |
|
MD5 | d5ff20b685607cc25be1d69012efea00 |
|
BLAKE2b-256 | 88e56976322e084ef750651b52c347f57c7ec14c2ef69800260fb853e576931f |
Close
Hashes for rshare-0.1.13-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff28d0df74ad01cff88f07ac62560f845c05488bfc41f33c6edcdc432fceb5e0 |
|
MD5 | ad3a86d0f52a816f522bbedb8b2e4f6e |
|
BLAKE2b-256 | 76060d744089f4c7c20184157de5fae12493021b6a67391af1da0464a5cbc2ea |
Close
Hashes for rshare-0.1.13-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fb1a3f5d0d6c9a597f5633d93426274aeba46981be87ccc684a39af0fe15fa3 |
|
MD5 | d270263dbec48665429fa11fb75d3e96 |
|
BLAKE2b-256 | 50443f70aabe956926c47f1ef161f36ae13305b98859f2738271c302b8bd8ab2 |