Skip to content

Commit a1a9f76

Browse files
authored
build(Rust): use 2024 edition (#333)
* build(Rust): use 2024 edition Signed-off-by: Luka Peschke <luka.peschke@toucantoco.com> * chore: make format Signed-off-by: Luka Peschke <luka.peschke@toucantoco.com> * fix(ci): do not rely on deprecated actions-rs github action anymore Signed-off-by: Luka Peschke <luka.peschke@toucantoco.com> * fix(ci): replace messense/maturin action with PyO3/maturin Signed-off-by: Luka Peschke <luka.peschke@toucantoco.com> * build: specify rust-version in Cargo.toml Signed-off-by: Luka Peschke <luka.peschke@toucantoco.com> * fix(ci): setup rust toolchain in check-x-build steps as well Signed-off-by: Luka Peschke <luka.peschke@toucantoco.com> * fix(ci/release): make sure the latest rust toolchain is used Signed-off-by: Luka Peschke <luka.peschke@toucantoco.com> --------- Signed-off-by: Luka Peschke <luka.peschke@toucantoco.com>
1 parent 24f31f9 commit a1a9f76

File tree

13 files changed

+56
-57
lines changed

13 files changed

+56
-57
lines changed

.github/workflows/CI.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ jobs:
2626
with:
2727
python-version: "${{ env.MIN_PYTHON_VERSION }}"
2828
- name: Set up rust toolchain
29-
uses: actions-rs/toolchain@v1
30-
with:
31-
profile: minimal
32-
toolchain: stable
33-
override: true
29+
uses: dtolnay/rust-toolchain@stable
3430
- name: Set up rustfmt
3531
run: rustup component add rustfmt
3632

@@ -55,11 +51,7 @@ jobs:
5551
with:
5652
python-version: "3.11"
5753
- name: Set up rust toolchain
58-
uses: actions-rs/toolchain@v1
59-
with:
60-
profile: minimal
61-
toolchain: stable
62-
override: true
54+
uses: dtolnay/rust-toolchain@stable
6355
- run: |
6456
git config user.name github-actions
6557
git config user.email github-actions@github.com
@@ -88,11 +80,7 @@ jobs:
8880
with:
8981
python-version: ${{ matrix.python-version }}
9082
- name: Set up rust toolchain
91-
uses: actions-rs/toolchain@v1
92-
with:
93-
profile: minimal
94-
toolchain: stable
95-
override: true
83+
uses: dtolnay/rust-toolchain@stable
9684

9785
# Maturin requires a venv to be activated, that's why we have to create one here
9886
- name: Create virtualenv
@@ -124,6 +112,7 @@ jobs:
124112
architecture: aarch64
125113
steps:
126114
- uses: actions/checkout@v4
115+
- uses: dtolnay/rust-toolchain@stable
127116
- name: Set Rust target
128117
id: target
129118
if: matrix.os != 'windows-latest'
@@ -132,7 +121,7 @@ jobs:
132121
echo "target=$TARGET" >> $GITHUB_OUTPUT
133122
134123
- name: build (fast)
135-
uses: messense/maturin-action@v1
124+
uses: PyO3/maturin-action@v1
136125
with:
137126
manylinux: auto
138127
command: build
@@ -149,8 +138,9 @@ jobs:
149138
runs-on: "ubuntu-latest"
150139
steps:
151140
- uses: actions/checkout@v4
141+
- uses: dtolnay/rust-toolchain@stable
152142
- name: build sdist
153-
uses: messense/maturin-action@v1
143+
uses: PyO3/maturin-action@v1
154144
with:
155145
manylinux: auto
156146
command: sdist

.github/workflows/docs.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@ jobs:
1717
with:
1818
python-version: "3.11"
1919
- name: Set up rust toolchain
20-
uses: actions-rs/toolchain@v1
21-
with:
22-
profile: minimal
23-
toolchain: stable
24-
override: true
20+
uses: dtolnay/rust-toolchain@stable
2521
- run: |
2622
git config user.name github-actions
2723
git config user.email github-actions@github.com

.github/workflows/release.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ jobs:
1515
architecture: [x86-64, aarch64]
1616
steps:
1717
- uses: actions/checkout@v4
18+
- uses: dtolnay/rust-toolchain@stable
1819
- name: build (release)
19-
uses: messense/maturin-action@v1
20+
uses: PyO3/maturin-action@v1
2021
with:
2122
manylinux: auto
2223
command: build
@@ -36,8 +37,9 @@ jobs:
3637
architecture: [x86-64, aarch64]
3738
steps:
3839
- uses: actions/checkout@v4
40+
- uses: dtolnay/rust-toolchain@stable
3941
- name: build (release)
40-
uses: messense/maturin-action@v1
42+
uses: PyO3/maturin-action@v1
4143
with:
4244
command: build
4345
args: "--release -o dist"
@@ -56,8 +58,9 @@ jobs:
5658
python-version: ["3.9"]
5759
steps:
5860
- uses: actions/checkout@v4
61+
- uses: dtolnay/rust-toolchain@stable
5962
- name: build (release)
60-
uses: messense/maturin-action@v1
63+
uses: PyO3/maturin-action@v1
6164
with:
6265
command: build
6366
args: "--release -o dist"
@@ -71,8 +74,9 @@ jobs:
7174
runs-on: "ubuntu-latest"
7275
steps:
7376
- uses: actions/checkout@v4
77+
- uses: dtolnay/rust-toolchain@stable
7478
- name: build (sdist)
75-
uses: messense/maturin-action@v1
79+
uses: PyO3/maturin-action@v1
7680
with:
7781
manylinux: auto
7882
command: sdist
@@ -90,6 +94,7 @@ jobs:
9094
runs-on: ubuntu-latest
9195
needs: [linux, macos, windows, sdist]
9296
steps:
97+
- uses: dtolnay/rust-toolchain@stable
9398
- name: Download Linux 3.9 wheels for x86-64
9499
uses: actions/download-artifact@v4
95100
with:
@@ -128,7 +133,7 @@ jobs:
128133

129134

130135
- name: Publish to PyPI
131-
uses: messense/maturin-action@v1
136+
uses: PyO3/maturin-action@v1
132137
env:
133138
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
134139
with:

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[package]
22
name = "fastexcel"
33
version = "0.13.0"
4-
edition = "2021"
4+
rust-version = "1.85.0"
5+
edition = "2024"
56
license = "MIT"
67
homepage = "https://github.com/ToucanToco/fastexcel"
78
repository = "https://github.com/ToucanToco/fastexcel.git"

src/data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use calamine::{Data as CalData, DataRef as CalDataRef, DataType, Range};
99
use crate::{
1010
error::{ErrorContext, FastExcelErrorKind, FastExcelResult},
1111
types::{
12-
dtype::{get_dtype_for_column, DType, DTypeCoercion},
12+
dtype::{DType, DTypeCoercion, get_dtype_for_column},
1313
python::excelsheet::column_info::ColumnInfo,
1414
},
1515
};

src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl<T> ErrorContext for FastExcelResult<T> {
125125
pub(crate) mod py_errors {
126126
use super::FastExcelErrorKind;
127127
use crate::error;
128-
use pyo3::{create_exception, exceptions::PyException, PyErr, PyResult};
128+
use pyo3::{PyErr, PyResult, create_exception, exceptions::PyException};
129129

130130
// Base fastexcel error
131131
create_exception!(

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ mod error;
33
mod types;
44
mod utils;
55

6-
use error::{py_errors, ErrorContext};
6+
use error::{ErrorContext, py_errors};
77
use pyo3::prelude::*;
88
use types::python::{
9+
ExcelReader, ExcelSheet,
910
excelsheet::column_info::{ColumnInfo, ColumnInfoNoDtype},
1011
table::ExcelTable,
11-
ExcelReader, ExcelSheet,
1212
};
1313

1414
/// Reads an excel file and returns an object allowing to access its sheets and a bit of metadata

src/types/dtype.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ use arrow::datatypes::{DataType as ArrowDataType, TimeUnit};
99
use calamine::{CellErrorType, CellType, DataType, Range};
1010
use log::warn;
1111
use pyo3::{
12-
prelude::PyAnyMethods, types::PyString, Bound, FromPyObject, IntoPyObject, IntoPyObjectRef,
13-
PyAny, PyResult, Python,
12+
Bound, FromPyObject, IntoPyObject, IntoPyObjectRef, PyAny, PyResult, Python,
13+
prelude::PyAnyMethods, types::PyString,
1414
};
1515

16-
use crate::error::{py_errors::IntoPyResult, FastExcelError, FastExcelErrorKind, FastExcelResult};
16+
use crate::error::{FastExcelError, FastExcelErrorKind, FastExcelResult, py_errors::IntoPyResult};
1717

1818
use super::idx_or_name::IdxOrName;
1919

src/types/idx_or_name.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use pyo3::{
2-
prelude::PyAnyMethods, Bound, FromPyObject, IntoPyObject, IntoPyObjectExt, PyAny, PyResult,
3-
Python,
2+
Bound, FromPyObject, IntoPyObject, IntoPyObjectExt, PyAny, PyResult, Python,
3+
prelude::PyAnyMethods,
44
};
55

6-
use crate::error::{py_errors::IntoPyResult, FastExcelError, FastExcelErrorKind, FastExcelResult};
6+
use crate::error::{FastExcelError, FastExcelErrorKind, FastExcelResult, py_errors::IntoPyResult};
77

88
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
99
pub(crate) enum IdxOrName {

src/types/python/excelreader.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ use std::{
44
};
55

66
use arrow::{pyarrow::ToPyArrow, record_batch::RecordBatch};
7-
use pyo3::{pyclass, pymethods, Bound, IntoPyObjectExt, PyAny, PyResult, Python};
7+
use pyo3::{Bound, IntoPyObjectExt, PyAny, PyResult, Python, pyclass, pymethods};
88

99
use calamine::{
10-
open_workbook_auto, open_workbook_auto_from_rs, Data, DataRef, HeaderRow, Range, Reader,
11-
ReaderRef, Sheet as CalamineSheet, Sheets, Table,
10+
Data, DataRef, HeaderRow, Range, Reader, ReaderRef, Sheet as CalamineSheet, Sheets, Table,
11+
open_workbook_auto, open_workbook_auto_from_rs,
1212
};
1313

1414
use crate::{
15-
data::{record_batch_from_data_and_columns, ExcelSheetData},
15+
data::{ExcelSheetData, record_batch_from_data_and_columns},
1616
error::{
17-
py_errors::IntoPyResult, ErrorContext, FastExcelError, FastExcelErrorKind, FastExcelResult,
17+
ErrorContext, FastExcelError, FastExcelErrorKind, FastExcelResult, py_errors::IntoPyResult,
1818
},
1919
types::{
2020
dtype::{DTypeCoercion, DTypes},
@@ -27,8 +27,8 @@ use crate::{
2727
use pyo3::types::PyString;
2828

2929
use super::excelsheet::{
30-
column_info::{build_available_columns_info, finalize_column_info},
3130
ExcelSheet, Header, Pagination, SelectedColumns,
31+
column_info::{build_available_columns_info, finalize_column_info},
3232
};
3333
use super::table::ExcelTable;
3434

@@ -79,7 +79,7 @@ impl ExcelSheets {
7979
sheets.with_header_row(header_row);
8080
self
8181
}
82-
Self::Bytes(ref mut sheets) => {
82+
Self::Bytes(sheets) => {
8383
sheets.with_header_row(header_row);
8484
self
8585
}

0 commit comments

Comments
 (0)