Skip to content

Commit

Permalink
Merge pull request #8 from nomonosound/ij/pyproject
Browse files Browse the repository at this point in the history
Provide pyproject.toml
  • Loading branch information
iver56 authored Jan 12, 2024
2 parents 68ac57a + e347166 commit bbea0fb
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 57 deletions.
4 changes: 4 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
ref-names: $Format:%D$
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git_archival.txt export-subst
6 changes: 2 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build

on:
push:
branches: [ main ]
#branches: [ main ]
paths-ignore:
- "**/**.md"
jobs:
Expand All @@ -13,7 +13,7 @@ jobs:
os: [ubuntu-latest, windows-latest]
python-version: [3.9]

if: startsWith(github.event.head_commit.message, 'Release')
#if: startsWith(github.event.head_commit.message, 'Release')
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -28,8 +28,6 @@ jobs:
env:
CIBW_ARCHS: "auto64"
CIBW_SKIP: "cp36-* cp37-* pp37-* pp310-* cp312-*"
CIBW_TEST_REQUIRES: cffi pytest
CIBW_TEST_COMMAND: "pytest {project}/tests"
run: |
python -m cibuildwheel --output-dir wheelhouse
- name: Save Wheels
Expand Down
5 changes: 4 additions & 1 deletion numpy_minmax/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import numpy as np
from numpy.typing import NDArray

__version__ = "0.1.0"
try:
from ._version import version as __version__
except ImportError:
__version__ = "unknown"


def minmax(a: NDArray) -> Tuple:
Expand Down
4 changes: 2 additions & 2 deletions packaging.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
* Bump version in `numpy_minmax/__init__.py`
* Bump version in `pyproject.toml`
* `CC=clang pip install -e . && pytest`
* Update CHANGELOG.md
* Commit and push the change with a commit message like this: "Release vx.y.z" (replace x.y.z with the package version)
* Wait for build workflow in GitHub Actions to complete
* Download wheels artifact from the build workflow
* Place all the fresh whl files in dist/
* `python -m twine upload dist/*`
* Add a tag with name "vx.y.z" to the commit
* Add a tag with name "x.y.z" to the commit
* Go to https://github.com/nomonosound/numpy-minmax/releases and create a release where you choose the new tag
43 changes: 43 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[build-system]
requires = ["setuptools>=68", "setuptools_scm[toml]>=7.0.1", "wheel", "cffi>=1.0.0"]
build-backend = "setuptools.build_meta"

[project]
name = "numpy-minmax"
version = "0.1.0"
description = "A fast python library for finding both min and max in a NumPy array"
dependencies = [
"numpy>=1.21"
]
readme = "README.md"
license = { file = "LICENSE" }
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Topic :: Software Development :: Libraries",
"Topic :: Multimedia :: Sound/Audio",
"Topic :: Scientific/Engineering",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
urls = { "Homepage" = "https://github.com/nomonosound/numpy-minmax" }

[tool.setuptools_scm]
write_to = "numpy_minmax/_version.py"

[project.optional-dependencies]
test = ["pytest"]

[tool.cibuildwheel]
test-requires = ["cffi", "pytest"]
test-command = "pytest {project}/tests"

[tool.setuptools.packages.find]
exclude = ["scripts", "tests", "wheelhouse"]

[tool.pytest]
testpaths = ["tests"]
51 changes: 1 addition & 50 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,54 +1,5 @@
import codecs
import os
import re

from setuptools import setup, find_packages

with open("README.md", "r") as readme_file:
long_description = readme_file.read()

here = os.path.abspath(os.path.dirname(__file__))


def read(*parts):
with codecs.open(os.path.join(here, *parts), "r") as fp:
return fp.read()


def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")

from setuptools import setup

setup(
name="numpy-minmax",
version=find_version("numpy_minmax", "__init__.py"),
description=(
"A fast python library for finding both min and max in a NumPy array"
),
license="MIT",
long_description=long_description,
long_description_content_type="text/markdown",
packages=find_packages(exclude=["scripts", "tests"]),
setup_requires=["cffi>=1.0.0"],
tests_require=["pytest"],
cffi_modules=["numpy_minmax/_minmax_cffi.py:ffibuilder"],
install_requires=["numpy>=1.21"],
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Topic :: Software Development :: Libraries",
"Topic :: Multimedia :: Sound/Audio",
"Topic :: Scientific/Engineering",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
url="https://github.com/nomonosound/numpy-minmax",
)

0 comments on commit bbea0fb

Please sign in to comment.