Skip to content

Commit 4723fc6

Browse files
authored
Add prebuilt binaries for Python 3.13 (#27)
* Hopefully add prebuilt binaries for Python 3.13 * Setup mypy and bump minimal python version to 3.9 * fix * Setup MSRV * cleanup * clippy and MSRV * version bump * Explicit version range on setup-python action
1 parent 482b9ba commit 4723fc6

File tree

13 files changed

+106
-28
lines changed

13 files changed

+106
-28
lines changed

.github/workflows/maturin_upload_pypi.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- uses: actions/checkout@v3
2525
- uses: actions/setup-python@v4
2626
with:
27-
python-version: '3.10'
27+
python-version: '3.9 - 3.13'
2828
- name: Build wheels
2929
uses: PyO3/maturin-action@v1
3030
with:
@@ -50,7 +50,7 @@ jobs:
5050
- uses: actions/checkout@v3
5151
- uses: actions/setup-python@v4
5252
with:
53-
python-version: '3.10'
53+
python-version: '3.13'
5454
architecture: ${{ matrix.target }}
5555
- name: Build wheels
5656
uses: PyO3/maturin-action@v1
@@ -76,7 +76,7 @@ jobs:
7676
- uses: actions/checkout@v3
7777
- uses: actions/setup-python@v4
7878
with:
79-
python-version: '3.10'
79+
python-version: '3.13'
8080
- name: Build wheels
8181
uses: PyO3/maturin-action@v1
8282
with:
@@ -113,6 +113,26 @@ jobs:
113113
path: dist
114114
if-no-files-found: error
115115

116+
check_clippy_python_bindings:
117+
name: Check clippy for Python bindings
118+
runs-on: ubuntu-latest
119+
120+
steps:
121+
- name: Checkout reposistory
122+
uses: actions/checkout@v4
123+
124+
- name: Setup Rust toolchain
125+
uses: actions-rs/toolchain@v1
126+
with:
127+
toolchain: stable
128+
override: true
129+
130+
- name: Setup clippy
131+
run: rustup component add clippy
132+
133+
- name: Run clippy
134+
run: cargo clippy --all-targets --features python_bindings -- -D warnings
135+
116136
release:
117137
name: Release
118138
runs-on: ubuntu-latest

.github/workflows/mypy.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Check mypy
2+
3+
# Build on every branch push, tag push, and pull request change:
4+
on: [push, pull_request]
5+
6+
jobs:
7+
checks:
8+
runs-on: ubuntu-latest
9+
name: mypy
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Set up Python 3.9
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: 3.9
17+
18+
- name: Install Dependencies
19+
run: |
20+
python3 -m pip install -U mypy
21+
22+
- name: mypy
23+
run: |
24+
python3 -m mypy --show-column-numbers --hide-error-context .

.github/workflows/rust.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,27 @@ env:
66
CARGO_TERM_COLOR: always
77

88
jobs:
9-
rustfmt-check:
9+
rustfmt:
10+
name: Check formatting
1011
runs-on: ubuntu-latest
1112
steps:
12-
- uses: actions/checkout@v4
13+
- name: Checkout reposistory
14+
uses: actions/checkout@v4
15+
1316
- name: Run cargo fmt
1417
run: cargo fmt --all -- --check
18+
19+
clippy:
20+
name: Check clippy
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout reposistory
24+
uses: actions/checkout@v4
25+
1526
- name: Run cargo clippy
16-
run: cargo clippy --all -- -D warnings
27+
run: |
28+
cargo clippy --version
29+
cargo clippy --all --all-targets --all-features -- -D warnings
1730
1831
macos-check:
1932
runs-on: macos-latest
@@ -35,3 +48,17 @@ jobs:
3548
- uses: actions/checkout@v4
3649
- name: Test
3750
run: cargo test
51+
52+
msrv:
53+
name: Check MSRV
54+
runs-on: ubuntu-latest
55+
steps:
56+
- name: Checkout reposistory
57+
uses: actions/checkout@v4
58+
59+
- name: Setup MSRV checker
60+
uses: taiki-e/install-action@cargo-hack
61+
62+
# To find current MSRV use `cargo msrv find`. Install it with `cargo install cargo-msrv --locked`
63+
- name: Run MSRV checker
64+
run: cargo hack check --rust-version --workspace --all-targets --ignore-private

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.5.2] - 2024-12-15
11+
12+
### Added
13+
14+
- Prebuilt binaries for Python 3.13.
15+
- Check Python files with mypy.
16+
- Set MSRV (minimum supported Rust version) to 1.73.
17+
18+
### Changed
19+
20+
- Python 3.9 or later is now required.
21+
- Mainly due to not being able to automatically check and build for older versions in CI.
22+
1023
## [0.5.1] - 2024-07-25
1124

1225
### Fixed
@@ -73,6 +86,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7386
- C bindings.
7487

7588
[unreleased]: https://github.com/decompals/crunch64/compare/0.5.1...HEAD
89+
[0.5.2]: https://github.com/decompals/crunch64/compare/0.5.1...0.5.2
7690
[0.5.1]: https://github.com/decompals/crunch64/compare/0.5.0...0.5.1
7791
[0.5.0]: https://github.com/decompals/crunch64/compare/0.4.0...0.5.0
7892
[0.4.0]: https://github.com/decompals/crunch64/compare/0.3.1...0.4.0

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
[package]
22
name = "crunch64-cli"
3-
version = "0.5.1"
3+
version = "0.5.2"
44
edition = "2021"
55
description = "A utility for compressing/decompressing files with common n64 formats"
66
repository = "https://github.com/decompals/crunch64"
77
license = "MIT"
8+
rust-version = "1.73.0"
89

910
[[bin]]
1011
name = "crunch64"
1112
path = "src/main.rs"
1213

1314
[dependencies]
14-
crunch64 = { version = "0.5.1", path = "../lib" }
15+
crunch64 = { version = "0.5.2", path = "../lib" }
1516
clap = { version = "4.4.11", features = ["derive"] }

lib/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[package]
22
name = "crunch64"
33
# Version should be synced with lib/pyproject.toml and lib/crunch64/__init__.py
4-
version = "0.5.1"
4+
version = "0.5.2"
55
edition = "2021"
66
description = "A library for handling common compression formats for N64 games"
77
repository = "https://github.com/decompals/crunch64"
88
license = "MIT"
9+
rust-version = "1.73.0"
910

1011
[lib]
1112
name = "crunch64"

lib/crunch64/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
# Version should be synced with lib/Cargo.toml and lib/pyproject.toml
6-
__version_info__ = (0, 5, 1)
6+
__version_info__ = (0, 5, 2)
77
__version__ = ".".join(map(str, __version_info__))
88
__author__ = "decompals"
99

lib/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "crunch64"
33
# Version should be synced with lib/Cargo.toml and lib/crunch64/__init__.py
44
version = "0.5.1"
55
description = "A library for handling common compression formats for N64 games"
6-
requires-python = ">=3.7"
6+
requires-python = ">=3.9"
77
dependencies = [
88
]
99
classifiers = [

lib/src/mio0.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,9 @@ pub fn decompress(bytes: &[u8]) -> Result<Box<[u8]>, Crunch64Error> {
7777
Ok(ret.into_boxed_slice())
7878
}
7979

80-
fn divide_round_up(a: usize, b: usize) -> usize {
81-
(a + b - 1) / b
82-
}
83-
8480
fn size_for_compressed_buffer(input_size: usize) -> Result<usize, Crunch64Error> {
8581
// Taken from Yaz0
86-
Ok(input_size + divide_round_up(input_size, 8) + 0x10)
82+
Ok(input_size + input_size.div_ceil(8) + 0x10)
8783
}
8884

8985
pub fn compress(bytes: &[u8]) -> Result<Box<[u8]>, Crunch64Error> {

0 commit comments

Comments
 (0)