Skip to content

Commit 1319fc5

Browse files
committed
drop Python 2.7, 3.5 support
1 parent 6f9aeaf commit 1319fc5

8 files changed

+191
-152
lines changed

.github/workflows/pythonpackage.yml

+2-7
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
os: [ubuntu-latest, macos-latest, windows-latest]
16-
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"]
17-
exclude:
18-
- os: windows-latest
19-
python-version: 2.7
16+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
2017
runs-on: ${{ matrix.os }}
2118

2219
steps:
@@ -56,12 +53,10 @@ jobs:
5653
python-version: 3.8
5754
- name: Install dependencies
5855
run: |
59-
python -m pip install setuptools wheel cython cibuildwheel
56+
python -m pip install setuptools wheel cython cibuildwheel==2.3.0
6057
- name: Build wheels
6158
run: |
6259
python -m cibuildwheel --output-dir wheelhouse
63-
env:
64-
CIBW_SKIP: cp27-win*
6560
- uses: actions/upload-artifact@v2
6661
with:
6762
path: ./wheelhouse/*.whl

.pre-commit-config.yaml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.0.1
4+
hooks:
5+
- id: check-json
6+
- id: check-toml
7+
- id: check-yaml
8+
- id: check-case-conflict
9+
- id: check-added-large-files
10+
- id: debug-statements
11+
- id: end-of-file-fixer
12+
- id: mixed-line-ending
13+
args: ["--fix=no"]
14+
- id: requirements-txt-fixer
15+
- id: trailing-whitespace
16+
args: ["--markdown-linebreak-ext=md"]
17+
- repo: https://github.com/asottile/pyupgrade
18+
rev: 'v2.29.1'
19+
hooks:
20+
- id: pyupgrade
21+
args: ["--py36-plus"]
22+
- repo: https://github.com/psf/black
23+
rev: '21.11b1'
24+
hooks:
25+
- id: black
26+
language_version: python3 # Should be a command that runs python3.6+
27+
- repo: https://github.com/PyCQA/isort
28+
rev: '5.10.1'
29+
hooks:
30+
- id: isort
31+
language_version: python3
32+
- repo: https://gitlab.com/pycqa/flake8
33+
rev: 4.0.1
34+
hooks:
35+
- id: flake8

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Python bindings for the fast non-cryptograpical hash function MetroHash. MetroHa
44

55
## Requirements
66

7-
The library has been tested on Linux Python 2.7 and 3.6, and on Windows Python 3.5, 3.6, 3.7.
7+
The library has been tested on Linux Python 3.6, and on Windows Python 3.6, 3.7.
88

99
## Install
1010

metrohash.pyx

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# distutils: language=c++
22

33
import sys
4-
from libcpp cimport bool
5-
from libc.stdint cimport uint64_t, uint8_t
4+
65
from cython.operator cimport dereference as deref
6+
from libc.stdint cimport uint8_t, uint64_t
7+
from libcpp cimport bool
8+
79

810
cdef extern from "metrohash.h" nogil:
911

pyproject.toml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
[build-system]
22
requires = ["setuptools", "wheel", "Cython"]
33

4+
[tool.black]
5+
line-length = 120
6+
47
[tool.isort]
5-
indent = "tab"
8+
profile = "black"
9+
src_paths = ["."]
610
line_length = 120

setup.py

+45-48
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,60 @@
1+
import platform
12
import sys
2-
from io import open
33

44
from Cython.Build import cythonize
5-
import platform
65
from setuptools import Extension, setup
76

87
EXT_SOURCES = [
9-
"MetroHash/src/metrohash64.cpp",
10-
"MetroHash/src/metrohash128.cpp",
8+
"MetroHash/src/metrohash64.cpp",
9+
"MetroHash/src/metrohash128.cpp",
1110
]
1211

13-
INT_SOURCES = [
14-
"metrohash.pyx"
15-
]
12+
INT_SOURCES = ["metrohash.pyx"]
1613

1714
if sys.platform == "win32":
18-
cflags = ["/O2", "/arch:AVX2"]
15+
cflags = ["/O2", "/arch:AVX2"]
1916
else:
20-
if platform.machine().lower() in ("x86_64", "amd64"):
21-
cflags = ["-O3", "-msse4.2"]
22-
else:
23-
cflags = ["-O3", "-march=native"]
24-
25-
extensions = [Extension(
26-
"metrohash",
27-
sources=EXT_SOURCES + INT_SOURCES,
28-
extra_compile_args=cflags,
29-
include_dirs=["MetroHash/src"],
30-
language="c++"
31-
)]
17+
if platform.machine().lower() in ("x86_64", "amd64"):
18+
cflags = ["-O3", "-msse4.2"]
19+
else:
20+
cflags = ["-O3", "-march=native"]
21+
22+
extensions = [
23+
Extension(
24+
"metrohash",
25+
sources=EXT_SOURCES + INT_SOURCES,
26+
extra_compile_args=cflags,
27+
include_dirs=["MetroHash/src"],
28+
language="c++",
29+
)
30+
]
3231

33-
with open("README.md", "r", encoding="utf-8") as fr:
34-
long_description = fr.read()
32+
with open("README.md", encoding="utf-8") as fr:
33+
long_description = fr.read()
3534

3635
setup(
37-
author="Dobatymo",
38-
name="metrohash-python",
39-
version="1.1.3.3",
40-
url="https://github.com/Dobatymo/metrohash-python",
41-
description="Python bindings for MetroHash",
42-
long_description=long_description,
43-
long_description_content_type="text/markdown",
44-
classifiers=[
45-
"Development Status :: 4 - Beta",
46-
"Intended Audience :: Developers",
47-
"Intended Audience :: Science/Research",
48-
"License :: OSI Approved :: ISC License (ISCL)",
49-
"Operating System :: OS Independent",
50-
"Programming Language :: C++",
51-
"Programming Language :: Cython",
52-
"Programming Language :: Python :: 2",
53-
"Programming Language :: Python :: 3",
54-
"Topic :: Internet",
55-
"Topic :: Scientific/Engineering",
56-
"Topic :: Utilities"
57-
],
58-
59-
ext_modules=cythonize(extensions),
60-
python_requires=">=2.7",
61-
use_2to3=False,
62-
zip_safe=False,
36+
author="Dobatymo",
37+
name="metrohash-python",
38+
version="1.1.3.3",
39+
url="https://github.com/Dobatymo/metrohash-python",
40+
description="Python bindings for MetroHash",
41+
long_description=long_description,
42+
long_description_content_type="text/markdown",
43+
classifiers=[
44+
"Development Status :: 4 - Beta",
45+
"Intended Audience :: Developers",
46+
"Intended Audience :: Science/Research",
47+
"License :: OSI Approved :: ISC License (ISCL)",
48+
"Operating System :: OS Independent",
49+
"Programming Language :: C++",
50+
"Programming Language :: Cython",
51+
"Programming Language :: Python :: 3",
52+
"Topic :: Internet",
53+
"Topic :: Scientific/Engineering",
54+
"Topic :: Utilities",
55+
],
56+
ext_modules=cythonize(extensions),
57+
python_requires=">=3.6",
58+
use_2to3=False,
59+
zip_safe=False,
6360
)

0 commit comments

Comments
 (0)