Skip to content

Commit

Permalink
drop Python 2.7, 3.5 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobatymo committed Dec 6, 2021
1 parent 6f9aeaf commit 1319fc5
Show file tree
Hide file tree
Showing 8 changed files with 191 additions and 152 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"]
exclude:
- os: windows-latest
python-version: 2.7
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
runs-on: ${{ matrix.os }}

steps:
Expand Down Expand Up @@ -56,12 +53,10 @@ jobs:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install setuptools wheel cython cibuildwheel
python -m pip install setuptools wheel cython cibuildwheel==2.3.0
- name: Build wheels
run: |
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: cp27-win*
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
Expand Down
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-json
- id: check-toml
- id: check-yaml
- id: check-case-conflict
- id: check-added-large-files
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
args: ["--fix=no"]
- id: requirements-txt-fixer
- id: trailing-whitespace
args: ["--markdown-linebreak-ext=md"]
- repo: https://github.com/asottile/pyupgrade
rev: 'v2.29.1'
hooks:
- id: pyupgrade
args: ["--py36-plus"]
- repo: https://github.com/psf/black
rev: '21.11b1'
hooks:
- id: black
language_version: python3 # Should be a command that runs python3.6+
- repo: https://github.com/PyCQA/isort
rev: '5.10.1'
hooks:
- id: isort
language_version: python3
- repo: https://gitlab.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Python bindings for the fast non-cryptograpical hash function MetroHash. MetroHa

## Requirements

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

## Install

Expand Down
6 changes: 4 additions & 2 deletions metrohash.pyx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# distutils: language=c++

import sys
from libcpp cimport bool
from libc.stdint cimport uint64_t, uint8_t

from cython.operator cimport dereference as deref
from libc.stdint cimport uint8_t, uint64_t
from libcpp cimport bool


cdef extern from "metrohash.h" nogil:

Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[build-system]
requires = ["setuptools", "wheel", "Cython"]

[tool.black]
line-length = 120

[tool.isort]
indent = "tab"
profile = "black"
src_paths = ["."]
line_length = 120
93 changes: 45 additions & 48 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,63 +1,60 @@
import platform
import sys
from io import open

from Cython.Build import cythonize
import platform
from setuptools import Extension, setup

EXT_SOURCES = [
"MetroHash/src/metrohash64.cpp",
"MetroHash/src/metrohash128.cpp",
"MetroHash/src/metrohash64.cpp",
"MetroHash/src/metrohash128.cpp",
]

INT_SOURCES = [
"metrohash.pyx"
]
INT_SOURCES = ["metrohash.pyx"]

if sys.platform == "win32":
cflags = ["/O2", "/arch:AVX2"]
cflags = ["/O2", "/arch:AVX2"]
else:
if platform.machine().lower() in ("x86_64", "amd64"):
cflags = ["-O3", "-msse4.2"]
else:
cflags = ["-O3", "-march=native"]

extensions = [Extension(
"metrohash",
sources=EXT_SOURCES + INT_SOURCES,
extra_compile_args=cflags,
include_dirs=["MetroHash/src"],
language="c++"
)]
if platform.machine().lower() in ("x86_64", "amd64"):
cflags = ["-O3", "-msse4.2"]
else:
cflags = ["-O3", "-march=native"]

extensions = [
Extension(
"metrohash",
sources=EXT_SOURCES + INT_SOURCES,
extra_compile_args=cflags,
include_dirs=["MetroHash/src"],
language="c++",
)
]

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

setup(
author="Dobatymo",
name="metrohash-python",
version="1.1.3.3",
url="https://github.com/Dobatymo/metrohash-python",
description="Python bindings for MetroHash",
long_description=long_description,
long_description_content_type="text/markdown",
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: ISC License (ISCL)",
"Operating System :: OS Independent",
"Programming Language :: C++",
"Programming Language :: Cython",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Topic :: Internet",
"Topic :: Scientific/Engineering",
"Topic :: Utilities"
],

ext_modules=cythonize(extensions),
python_requires=">=2.7",
use_2to3=False,
zip_safe=False,
author="Dobatymo",
name="metrohash-python",
version="1.1.3.3",
url="https://github.com/Dobatymo/metrohash-python",
description="Python bindings for MetroHash",
long_description=long_description,
long_description_content_type="text/markdown",
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: ISC License (ISCL)",
"Operating System :: OS Independent",
"Programming Language :: C++",
"Programming Language :: Cython",
"Programming Language :: Python :: 3",
"Topic :: Internet",
"Topic :: Scientific/Engineering",
"Topic :: Utilities",
],
ext_modules=cythonize(extensions),
python_requires=">=3.6",
use_2to3=False,
zip_safe=False,
)
Loading

0 comments on commit 1319fc5

Please sign in to comment.