Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 38 additions & 33 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
tags:
- 'v*'
- "v*"
pull_request:

concurrency:
Expand All @@ -14,13 +14,13 @@ concurrency:

env:
PACKAGE_NAME: rs_chardet
PYTHON_VERSION: "3.8" # to build abi3 wheels
PYTHON_VERSION: "3.9" # to build abi3 wheels

jobs:
macos:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
Expand All @@ -35,23 +35,23 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: x86_64
args: --release --out dist
args: --release --out dist -i python${{ env.PYTHON_VERSION }}
maturin-version: "v0.13.0"
- name: Install built wheel - x86_64
run: |
pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
- name: Build wheels - universal2
uses: PyO3/maturin-action@v1
with:
args: --release --universal2 --out dist
args: --release --universal2 --out dist -i python${{ env.PYTHON_VERSION }}
maturin-version: "v0.13.0"
- name: Install built wheel - universal2
run: |
pip install dist/${{ env.PACKAGE_NAME }}-*universal2.whl --force-reinstall
- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: wheels
name: rschardet-macos
path: dist

windows:
Expand All @@ -60,7 +60,7 @@ jobs:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
Expand All @@ -75,16 +75,16 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist
args: --release --out dist -i python${{ env.PYTHON_VERSION }}
maturin-version: "v0.13.0"
- name: Install built wheel
shell: bash
run: |
python -m pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: wheels
name: rschardet-windows-${{ matrix.target }}
path: dist

linux:
Expand All @@ -93,7 +93,7 @@ jobs:
matrix:
target: [x86_64, i686]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
Expand All @@ -103,16 +103,19 @@ jobs:
with:
target: ${{ matrix.target }}
manylinux: auto
args: --release --out dist
args: --release --out dist -i python${{ env.PYTHON_VERSION }}
maturin-version: "v0.13.0"
before-script-linux: |
echo $(which python3.9)
python3.9 --version
- name: Install built wheel
if: matrix.target == 'x86_64'
run: |
pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: wheels
name: rschardet-linux-${{ matrix.target }}
path: dist

linux-cross:
Expand All @@ -121,7 +124,7 @@ jobs:
matrix:
target: [aarch64, armv7]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- uses: actions/setup-python@v5
Expand All @@ -132,15 +135,15 @@ jobs:
with:
target: ${{ matrix.target }}
manylinux: auto
args: --release -i python3.8 --out dist
args: --release --out dist -i python${{ env.PYTHON_VERSION }}
maturin-version: "v0.13.0"
before-script-linux: |
echo $(which python3.8)
python3.8 --version
echo $(which python3.9)
python3.9 --version
- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: wheels
name: rschardet-linux-cross-${{ matrix.target }}
path: dist
pypy:
runs-on: ${{ matrix.os }}
Expand All @@ -149,12 +152,12 @@ jobs:
os: [ubuntu-latest, macos-13]
target: [x86_64, aarch64]
python-version:
- '3.8'
- "3.9"
exclude:
- os: macos-13
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version: pypy${{ matrix.python-version }}
Expand All @@ -170,24 +173,24 @@ jobs:
run: |
pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: wheels
name: rschardet-pypi-${{ matrix.os }}-${{ matrix.target }}
path: dist

sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: wheels
name: rschardet-sdist-${{ matrix.os }}-${{ matrix.target}}
path: dist

release:
Expand All @@ -202,11 +205,13 @@ jobs:
- linux-cross
- pypy
- sdist
if: startsWith(github.ref, 'refs/tags/v')
# if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: wheels
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
merge-multiple: true
- name: Display structure of artifacts
run: ls -R dist
# - name: Publish package distributions to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rs_chardet"
version = "0.2.2"
version = "0.3.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -10,4 +10,4 @@ crate-type = ["cdylib"]

[dependencies]
chardetng = "0.1.17"
pyo3 = { version = "0.22.0", features = ["extension-module", "abi3-py38"] }
pyo3 = { version = "0.24.0", features = ["extension-module", "abi3-py39"] }
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
overlays = [inputs.rust-overlay.overlays.default];
};
project_name = "rs_chardet";
project_version = "0.2.2";
python_version = pkgs.python310;
buildPythonPackage = pkgs.python310Packages.buildPythonPackage;
project_version = "0.3.0";
python_version = pkgs.python313;
buildPythonPackage = pkgs.python313Packages.buildPythonPackage;
in rec {
packages = {
# A python version with the library installed
Expand Down
6 changes: 3 additions & 3 deletions nix/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
buildPythonPackage rec {
inherit src version pname;
format = "pyproject";
disabled = pythonOlder "3.7";
disabled = pythonOlder "3.8";

cargoDeps = rustPlatform.fetchCargoTarball {
cargoDeps = rustPlatform.fetchCargoVendor {
inherit src;
name = "${pname}-${version}";
hash = "sha256-RodHVLdtEim/LuqP2pc4DWLQmkXXYhlHNU3G927YG4Q=";
hash = "sha256-3/aE+RfMohd5GtVB2LtYKuLbIQWP4tlTAzAgHuSruD4=";
};

nativeBuildInputs = with rustPlatform; [cargoSetupHook maturinBuildHook];
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn detect_rs_enc_name(a: &[u8]) -> PyResult<&str> {
fn detect_codec(a: &[u8]) -> PyResult<PyObject> {
let enc_rs_name = detect_rs_enc_name(a)?;
let lookup_codec: PyResult<PyObject> = Python::with_gil(|py| {
let lookup_fn = py.import_bound("codecs")?.getattr("lookup")?;
let lookup_fn = py.import("codecs")?.getattr("lookup")?;
let lookup_value = lookup_fn.call1((enc_rs_name,))?.into();
Ok(lookup_value)
});
Expand Down
Loading