From d43bfc539383157d08f96fda6df0a4af737c2aec Mon Sep 17 00:00:00 2001 From: Nick Babcock Date: Sat, 2 Jan 2021 16:06:12 -0600 Subject: [PATCH] Migrate to compiling on Rust stable - Clean up CI. No need to install nightly rust anymore - Migrate to latest PyO3 --- .github/workflows/workflow.yaml | 24 +++--------------------- Cargo.toml | 4 ++-- Makefile | 10 +++------- README.md | 2 +- rust-toolchain | 1 - src/lib.rs | 4 ++-- 6 files changed, 11 insertions(+), 34 deletions(-) delete mode 100644 rust-toolchain diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index c9cda4a..bf05606 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -7,18 +7,11 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v1 - - name: Install latest nightly - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - override: true - components: "clippy, rustfmt" - - name: Lint with rustfmt uses: actions-rs/cargo@v1 with: @@ -37,7 +30,7 @@ jobs: fail-fast: false matrix: python-version: [3.6, 3.7, 3.8] - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-20.04, macos-latest, windows-latest] steps: - name: Checkout @@ -53,11 +46,6 @@ jobs: python -m pip install --upgrade pip pip install poetry poetry install - - name: Install latest nightly - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - override: true - name: Build Python package run: poetry run maturin develop --release @@ -73,7 +61,7 @@ jobs: fail-fast: false matrix: python-version: [3.6, 3.7, 3.8] - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-20.04, macos-latest, windows-latest] steps: - uses: actions/checkout@v1 @@ -81,12 +69,6 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install latest nightly - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - override: true - - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/Cargo.toml b/Cargo.toml index a627bf3..e3ad4e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,8 +22,8 @@ boxcars = "0.8.6" serde_json = "1.0.52" [dependencies.pyo3] -version = "0.9.2" -features = ["extension-module", "python3"] +version = "0.13.0" +features = ["extension-module"] [lib] name = "boxcars_py" diff --git a/Makefile b/Makefile index e158a6b..ff2c4bc 100644 --- a/Makefile +++ b/Makefile @@ -3,19 +3,15 @@ MATURIN := maturin PYTHON := python .PHONY: build -build: nightly dev-packages +build: dev-packages poetry run $(MATURIN) build --interpreter $(PYTHON) .PHONY: build-release -build-release: nightly dev-packages +build-release: dev-packages poetry run $(MATURIN) build --release --interpreter $(PYTHON) -.PHONY: nightly -nightly: - rustup override set nightly - .PHONY: install -install: nightly dev-packages +install: dev-packages poetry run $(MATURIN) develop --release .PHONY: publish diff --git a/README.md b/README.md index d9c59d0..2a787eb 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ replay = parse_replay(buf) ## Building from source __Requirements__ - - Rust Nightly. Minium supported version: 1.42.0-nightly 2020-01-21 + - Rust. - [poetry](https://pypi.org/project/poetry/) ``` diff --git a/rust-toolchain b/rust-toolchain deleted file mode 100644 index bf867e0..0000000 --- a/rust-toolchain +++ /dev/null @@ -1 +0,0 @@ -nightly diff --git a/src/lib.rs b/src/lib.rs index 79fc3d9..6bad7a1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,13 +22,13 @@ fn boxcars_py(_py: Python, m: &PyModule) -> PyResult<()> { } fn to_py_error(e: E) -> PyErr { - PyErr::new::(format!("{}", e)) + PyErr::new::(format!("{}", e)) } fn convert_to_py(py: Python, value: &Value) -> PyObject { match value { Value::Null => py.None(), - Value::Bool(b) => PyObject::from_py(*b, py), + Value::Bool(b) => b.into_py(py), Value::Number(n) => match n { n if n.is_u64() => n.as_u64().unwrap().into_py(py), n if n.is_i64() => n.as_i64().unwrap().into_py(py),