diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a234105..4dffb26 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,163 +1,142 @@
-name: Build
-
-on: [ push, pull_request ]
-
-env:
- PACKAGE_NAME: fastcrc
- PYTHON_VERSION: "3.6" # to build abi3 wheels
+name: CI
+
+on:
+ push:
+ branches:
+ - main
+ - master
+ tags:
+ - '*'
+ pull_request:
+ workflow_dispatch:
jobs:
test:
+ name: Test
runs-on: ubuntu-latest
strategy:
matrix:
- os: [ ubuntu-latest ]
- python-version: [ "3.6", "3.7", "3.8", "3.9", "3.10" ]
-
+ python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- - uses: actions/checkout@v2
-
- - name: Setup Python ${{ matrix.python-version }} on ${{ matrix.os }}
- uses: actions/setup-python@v1
+ - uses: actions/checkout@v3
+ - uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
+ - uses: actions-rust-lang/setup-rust-toolchain@v1
+ - name: Install maturin
+ run: pip install maturin
+ - name: Build wheels
+ run: maturin build --release
+ - name: Install fastcrc
+ run: pip install target/wheels/fastcrc*.whl
+ - name: Test
+ run: python tests/test_fastcrc.py
- - uses: actions-rs/toolchain@v1
+ linux:
+ name: Build wheels for Linux
+ runs-on: ubuntu-latest
+ needs: test
+ strategy:
+ matrix:
+ target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
+ steps:
+ - uses: actions/checkout@v3
+ - uses: actions/setup-python@v4
with:
- toolchain: stable
- override: true
-
- - name: Run cargo check
- uses: actions-rs/cargo@v1
+ python-version: '3.12'
+ - name: Build wheels
+ uses: PyO3/maturin-action@v1
with:
- command: check
-
- - name: Install setuptools and setuptools-rust
- run: |
- python -m pip install --upgrade wheel setuptools setuptools-rust
-
- - name: Install fastcrc
- run: |
- python setup.py install
-
- - name: Run tests
- run: |
- cd tests
- python test_fastcrc.py
+ target: ${{ matrix.target }}
+ args: --release --out dist --find-interpreter
+ sccache: 'true'
+ manylinux: auto
+ - name: Upload wheels
+ uses: actions/upload-artifact@v3
+ with:
+ name: wheels
+ path: dist
- build_package:
- # Adapted from https://github.com/pydantic/pydantic-core/blob/main/.github/workflows/ci.yml
- name: build on ${{ matrix.platform || matrix.os }} (${{ matrix.target }} - ${{ matrix.manylinux || 'auto' }})
- needs: [ test ]
+ windows:
+ runs-on: windows-latest
+ name: Build wheels for Windows
+ needs: test
strategy:
- fail-fast: false
matrix:
- os: [ubuntu, macos, windows]
- target: [x86_64, aarch64]
- manylinux: [auto]
- include:
- - os: ubuntu
- platform: linux
- - os: windows
- ls: dir
- - os: windows
- ls: dir
- target: i686
- python-architecture: x86
- - os: macos
- target: aarch64
- - os: ubuntu
- platform: linux
- target: i686
- - os: ubuntu
- platform: linux
- target: aarch64
- container: messense/manylinux_2_24-cross:aarch64
- - os: ubuntu
- platform: linux
- target: armv7
- container: messense/manylinux_2_24-cross:armv7
- # musllinux
- - os: ubuntu
- platform: linux
- target: x86_64
- manylinux: musllinux_1_1
- - os: ubuntu
- platform: linux
- target: aarch64
- manylinux: musllinux_1_1
- exclude:
- # Windows on arm64 only supports Python 3.11+
- - os: windows
- target: aarch64
-
- runs-on: ${{ matrix.os }}-latest
+ target: [x64, x86]
steps:
- uses: actions/checkout@v3
-
- - name: set up python
- uses: actions/setup-python@v4
+ - uses: actions/setup-python@v4
with:
- python-version: ${{ env.PYTHON_VERSION }}
- architecture: ${{ matrix.python-architecture || 'x64' }}
-
- - name: build sdist
- if: ${{ matrix.os == 'ubuntu' && matrix.target == 'x86_64' && matrix.manylinux == 'auto' }}
- uses: messense/maturin-action@v1
+ python-version: '3.12'
+ architecture: ${{ matrix.target }}
+ - name: Build wheels
+ uses: PyO3/maturin-action@v1
with:
- command: sdist
- args: --out dist
- rust-toolchain: stable
+ target: ${{ matrix.target }}
+ args: --release --out dist --find-interpreter
+ sccache: 'true'
+ - name: Upload wheels
+ uses: actions/upload-artifact@v3
+ with:
+ name: wheels
+ path: dist
- - name: build wheels
- uses: messense/maturin-action@v1
+ macos:
+ runs-on: macos-latest
+ name: Build wheels for macOS
+ needs: test
+ strategy:
+ matrix:
+ target: [x86_64, aarch64]
+ steps:
+ - uses: actions/checkout@v3
+ - uses: actions/setup-python@v4
+ with:
+ python-version: '3.12'
+ - name: Build wheels
+ uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
- manylinux: ${{ matrix.manylinux || 'auto' }}
- container: ${{ matrix.container }}
- args: --release --out dist
- rust-toolchain: stable
-
- - run: ${{ matrix.ls || 'ls -lh' }} dist/
-
- - run: pip install -U twine
-
- - run: twine check dist/*
-
+ args: --release --out dist --find-interpreter
+ sccache: 'true'
- name: Upload wheels
- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
- list-pypi-files:
- needs: [ build_package ]
+ sdist:
runs-on: ubuntu-latest
-
+ name: Build sdist
+ needs: test
steps:
- uses: actions/checkout@v3
-
- - name: get dist artifacts
- uses: actions/download-artifact@v3
+ - name: Build sdist
+ uses: PyO3/maturin-action@v1
+ with:
+ command: sdist
+ args: --out dist
+ - name: Upload sdist
+ uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
- - run: ls -lh dist/
- - run: echo "`ls dist | wc -l` files"
-
- upload_pypi:
- needs: [ build_package ]
- if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
+ release:
+ name: Release
runs-on: ubuntu-latest
+ permissions:
+ id-token: write
+ if: "startsWith(github.ref, 'refs/tags/')"
+ needs: [linux, windows, macos, sdist]
steps:
- - uses: actions/download-artifact@v2
+ - uses: actions/download-artifact@v3
with:
name: wheels
- - name: Publish to PyPI
- uses: messense/maturin-action@v1
- env:
- MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
+
+ - name: Publish package distributions to PyPI
+ uses: pypa/gh-action-pypi-publish@release/v1
with:
- command: upload
- args: --skip-existing *
\ No newline at end of file
+ skip-existing: true
+ packages-dir: wheels/
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index e19c133..28dc636 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -4,6 +4,10 @@ Change Log
This document records all notable changes to `fastcrc `_.
+Pending
+-------
+* chore: drop support for Python 3.6. (`#6 `_)
+
0.2.1 (September 15, 2022)
---------------------
* feat: add `fastcrc.crc16.ibm_refin` and `fastcrc.crc32.reversed_reciprocal_refin`, these are two experimental functions that may be removed in the future.
diff --git a/Cargo.lock b/Cargo.lock
index d576af0..f7a8589 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -40,32 +40,15 @@ name = "fastcrc"
version = "0.2.1"
dependencies = [
"crc",
- "paste 1.0.9",
+ "paste",
"pyo3",
]
[[package]]
name = "indoc"
-version = "0.3.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "47741a8bc60fb26eb8d6e0238bbb26d8575ff623fdc97b1a2c00c050b9684ed8"
-dependencies = [
- "indoc-impl",
- "proc-macro-hack",
-]
-
-[[package]]
-name = "indoc-impl"
-version = "0.3.6"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce046d161f000fffde5f432a0d034d0341dc152643b2598ed5bfce44c4f3a8f0"
-dependencies = [
- "proc-macro-hack",
- "proc-macro2",
- "quote",
- "syn",
- "unindent",
-]
+checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306"
[[package]]
name = "instant"
@@ -92,6 +75,15 @@ dependencies = [
"scopeguard",
]
+[[package]]
+name = "memoffset"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
+dependencies = [
+ "autocfg",
+]
+
[[package]]
name = "once_cell"
version = "1.14.0"
@@ -125,34 +117,9 @@ dependencies = [
[[package]]
name = "paste"
-version = "0.1.18"
+version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880"
-dependencies = [
- "paste-impl",
- "proc-macro-hack",
-]
-
-[[package]]
-name = "paste"
-version = "1.0.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1"
-
-[[package]]
-name = "paste-impl"
-version = "0.1.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6"
-dependencies = [
- "proc-macro-hack",
-]
-
-[[package]]
-name = "proc-macro-hack"
-version = "0.5.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
+checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
[[package]]
name = "proc-macro2"
@@ -165,35 +132,48 @@ dependencies = [
[[package]]
name = "pyo3"
-version = "0.15.2"
+version = "0.19.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d41d50a7271e08c7c8a54cd24af5d62f73ee3a6f6a314215281ebdec421d5752"
+checksum = "e681a6cfdc4adcc93b4d3cf993749a4552018ee0a9b65fc0ccfad74352c72a38"
dependencies = [
"cfg-if",
"indoc",
"libc",
+ "memoffset",
"parking_lot",
- "paste 0.1.18",
"pyo3-build-config",
+ "pyo3-ffi",
"pyo3-macros",
"unindent",
]
[[package]]
name = "pyo3-build-config"
-version = "0.15.2"
+version = "0.19.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "779239fc40b8e18bc8416d3a37d280ca9b9fb04bda54b98037bb6748595c2410"
+checksum = "076c73d0bc438f7a4ef6fdd0c3bb4732149136abd952b110ac93e4edb13a6ba5"
dependencies = [
"once_cell",
+ "target-lexicon",
+]
+
+[[package]]
+name = "pyo3-ffi"
+version = "0.19.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e53cee42e77ebe256066ba8aa77eff722b3bb91f3419177cf4cd0f304d3284d9"
+dependencies = [
+ "libc",
+ "pyo3-build-config",
]
[[package]]
name = "pyo3-macros"
-version = "0.15.2"
+version = "0.19.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00b247e8c664be87998d8628e86f282c25066165f1f8dda66100c48202fdb93a"
+checksum = "dfeb4c99597e136528c6dd7d5e3de5434d1ceaf487436a3f03b2d56b6fc9efd1"
dependencies = [
+ "proc-macro2",
"pyo3-macros-backend",
"quote",
"syn",
@@ -201,12 +181,11 @@ dependencies = [
[[package]]
name = "pyo3-macros-backend"
-version = "0.15.2"
+version = "0.19.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a8c2812c412e00e641d99eeb79dd478317d981d938aa60325dfa7157b607095"
+checksum = "947dc12175c254889edc0c02e399476c2f652b4b9ebd123aa655c224de259536"
dependencies = [
"proc-macro2",
- "pyo3-build-config",
"quote",
"syn",
]
@@ -252,6 +231,12 @@ dependencies = [
"unicode-ident",
]
+[[package]]
+name = "target-lexicon"
+version = "0.12.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a"
+
[[package]]
name = "unicode-ident"
version = "1.0.4"
diff --git a/Cargo.toml b/Cargo.toml
index a837da9..982d712 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,9 +15,6 @@ name = "fastcrc"
crate-type = ["cdylib"]
[dependencies]
+pyo3 = "0.19.0"
crc = "3.0.0"
paste = "1.0.6"
-
-[dependencies.pyo3]
-version = "0.15.1" # Python 3.6 support, dont upgrade
-features = ["extension-module", "abi3-py36"]
\ No newline at end of file
diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644
index 7eb4614..0000000
--- a/MANIFEST.in
+++ /dev/null
@@ -1,5 +0,0 @@
-include Cargo.toml
-include Cargo.lock
-include README.rst
-include LICENSE
-recursive-include src *
\ No newline at end of file
diff --git a/pyproject.toml b/pyproject.toml
index 7824761..c32ca9e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,34 @@
+[project]
+name = "fastcrc"
+version = "0.2.1"
+requires-python = ">=3.7"
+readme = "README.rst"
+description = "A hyper-fast Python module for computing CRC(16, 32, 64) checksum"
+author = "overcat <4catcode@gmail.com>"
+maintainer = "overcat <4catcode@gmail.com>"
+classifiers = [
+ "Development Status :: 4 - Beta",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: MIT License",
+ "Operating System :: MacOS",
+ "Operating System :: Microsoft :: Windows",
+ "Operating System :: POSIX :: Linux",
+ "Programming Language :: Rust",
+ "Programming Language :: Python :: Implementation :: CPython",
+ "Programming Language :: Python :: Implementation :: PyPy",
+ "Topic :: Software Development :: Libraries :: Python Modules",
+ "Typing :: Typed",
+]
+homepage = "https://github.com/overcat/fastcrc"
+repository = "https://github.com/overcat/fastcrc"
+
+[tool.poetry.urls]
+"Bug Tracker" = "https://github.com/overcat/fastcrc/issues"
+
[build-system]
-requires = ["maturin>=0.13,<0.14"]
-build-backend = "maturin"
\ No newline at end of file
+requires = ["maturin>=1.4,<2.0"]
+build-backend = "maturin"
+
+[tool.maturin]
+features = ["pyo3/extension-module"]
+exclude = [".github/**/*", "benchmarks/**/*", "tests/**/*", "docs/**/*"]
diff --git a/setup.py b/setup.py
deleted file mode 100644
index 95b8ebd..0000000
--- a/setup.py
+++ /dev/null
@@ -1,56 +0,0 @@
-import os
-
-from setuptools import setup
-from setuptools_rust import Binding, RustExtension
-
-here = os.path.abspath(os.path.dirname(__file__))
-
-about = {}
-with open(
- os.path.join(here, "fastcrc", "__info__.py"), mode="r", encoding="utf-8"
-) as f:
- exec(f.read(), about)
-
-with open("README.rst", mode="r", encoding="utf-8") as f:
- readme = f.read()
-
-setup(
- name=about["__title__"],
- version=about["__version__"],
- description=about["__description__"],
- long_description=readme,
- author=about["__author__"],
- author_email=about["__author_email__"],
- url=about["__url__"],
- license=about["__license__"],
- rust_extensions=[RustExtension("fastcrc.fastcrc", binding=Binding.PyO3)],
- packages=["fastcrc"],
- include_package_data=True,
- package_data={"fastcrc": ["py.typed"]},
- # rust extensions are not zip safe, just like C-extensions.
- zip_safe=False,
- keywords=["crc", "crc16", "crc32", "crc64"],
- project_urls={
- "Code": "https://github.com/overcat/fastcrc",
- "Issue tracker": "https://github.com/overcat/fastcrc/issues",
- },
- python_requires=">=3.6.0",
- classifiers=[
- "Development Status :: 4 - Beta",
- "Intended Audience :: Developers",
- "License :: OSI Approved :: MIT License",
- "Operating System :: MacOS",
- "Operating System :: Microsoft :: Windows",
- "Operating System :: POSIX :: Linux",
- "Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.6",
- "Programming Language :: Python :: 3.7",
- "Programming Language :: Python :: 3.8",
- "Programming Language :: Python :: 3.9",
- "Programming Language :: Python :: Implementation :: CPython",
- "Programming Language :: Python",
- "Programming Language :: Rust",
- "Topic :: Software Development :: Libraries :: Python Modules",
- "Typing :: Typed",
- ],
-)