From a4a17e3d682db217a21bebc35c7478175e7c8371 Mon Sep 17 00:00:00 2001 From: Jacob Tyler Date: Sat, 24 Feb 2024 09:56:38 +0000 Subject: [PATCH 1/3] Upgrades to the build system --- pyproject.toml | 3 ++- requirements-dev.txt | 9 +++++---- setup.cfg | 2 +- setup.py | 14 ++++++-------- src/lib.rs | 3 +-- tests.py => test_functions.py | 0 6 files changed, 15 insertions(+), 16 deletions(-) rename tests.py => test_functions.py (100%) diff --git a/pyproject.toml b/pyproject.toml index 2d3b755..c326ea3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,3 @@ [build-system] -requires = ["setuptools", "wheel", "setuptools-rust"] \ No newline at end of file +requires = ["setuptools", "wheel", "setuptools-rust", "maturin"] +build-backend = "maturin" diff --git a/requirements-dev.txt b/requirements-dev.txt index 60c7dc4..76c36ef 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,5 @@ -pytest>=3.5.0 -wheel==0.38.1 -auditwheel==2.0.0 -setuptools-rust>=0.10.2 +pytest>=8.0.1 +wheel==0.42.0 +auditwheel>=6.0.0 +setuptools-rust>=1.8.1 +maturin==1.4.0 diff --git a/setup.cfg b/setup.cfg index 7a38d72..369d86a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,4 +2,4 @@ universal = 1 [metadata] -license_file = LICENSE.txt \ No newline at end of file +# license_file = LICENSE.txt \ No newline at end of file diff --git a/setup.py b/setup.py index 1400fe6..eb7fcf6 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup -import fast_luhn as module +# import fast_luhn as module try: @@ -25,8 +25,6 @@ def read(fname): setup( name='fast-luhn', - version=module.__version__, - author=module.__author__, description='Fast Luhn algorithm', long_description=read('README.rst'), keywords='luhn validation', @@ -62,10 +60,10 @@ def read(fname): 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', ], - setup_requires=[ - 'setuptools', - 'setuptools_rust', - 'wheel==0.38.1', - ], + # setup_requires=[ + # 'setuptools', + # 'setuptools_rust', + # 'wheel==0.42.0', + # ], zip_safe=False, ) diff --git a/src/lib.rs b/src/lib.rs index 389811d..930c051 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,3 @@ -#![feature(specialization)] extern crate pyo3; extern crate rand; @@ -76,7 +75,7 @@ mod luhn { } pub fn digit(string: &str) -> u32{ - let mut valid_string = string.clone().to_string(); + let mut valid_string = string.to_string(); valid_string.push_str("0"); let chsum = checksum(&valid_string); let x = 10 - (chsum % 10); diff --git a/tests.py b/test_functions.py similarity index 100% rename from tests.py rename to test_functions.py From 3581c9f442ef2c2aaad32a42f82bf6d624d5dd77 Mon Sep 17 00:00:00 2001 From: Jacob Tyler Date: Sat, 24 Feb 2024 10:04:30 +0000 Subject: [PATCH 2/3] Added Version Bump --- CHANGELOG.rst | 6 ++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- README.rst | 2 +- fast_luhn/__init__.py | 2 +- pyproject.toml | 2 +- 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 729a296..aeeda2d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,9 +2,15 @@ Changelog ========= +0.2.0 +----- + +* Added Maturin backend + 0.1.5 ----- + * Added python 3.8 and 3.9 support diff --git a/Cargo.lock b/Cargo.lock index 0410f03..376d2d1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -41,7 +41,7 @@ dependencies = [ [[package]] name = "fast_luhn" -version = "0.1.5" +version = "0.2.0" dependencies = [ "pyo3", "rand", diff --git a/Cargo.toml b/Cargo.toml index bfc6c68..3ce5796 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fast_luhn" -version = "0.1.5" +version = "0.2.0" authors = ["Matt Stroganov "] edition = "2018" diff --git a/README.rst b/README.rst index 04e3667..26623bc 100644 --- a/README.rst +++ b/README.rst @@ -9,7 +9,7 @@ Rust realization for speed-up python code. Thread-safe. See benchmark_ for detai .. _Luhn-algorithm: https://en.wikipedia.org/wiki/Luhn_algorithm :Author: Matt Stroganov -:Version: 0.1.5 +:Version: 0.2.0 Installation diff --git a/fast_luhn/__init__.py b/fast_luhn/__init__.py index aede352..c73c825 100644 --- a/fast_luhn/__init__.py +++ b/fast_luhn/__init__.py @@ -1,7 +1,7 @@ from .fast_luhn import validate, digit, complete, generate -__version__ = '0.1.5' +__version__ = '0.2.0' __author__ = 'Matt Stroganov' diff --git a/pyproject.toml b/pyproject.toml index c326ea3..e67e80d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools", "wheel", "setuptools-rust", "maturin"] +requires = ["setuptools", "wheel", "setuptools-rust", "maturin>=1.0,<2.0"] build-backend = "maturin" From 399fdd63d782ffde4f708b01f144dd95d716c9a8 Mon Sep 17 00:00:00 2001 From: Jacob Tyler Date: Sat, 24 Feb 2024 10:11:35 +0000 Subject: [PATCH 3/3] Updated docs --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 26623bc..7fac75c 100644 --- a/README.rst +++ b/README.rst @@ -73,7 +73,7 @@ Install from sources: $ git clone https://github.com/cybermatt/fast-luhn $ cd fast-luhn $ pip install -r requirements-dev.txt - $ python ./setup.py develop + $ maturin develop Benchmark @@ -108,7 +108,7 @@ Tests :: - $ pytest -v tests.py + $ pytest -v License