From 41669026b6470e836743156dd9f99bad751ec120 Mon Sep 17 00:00:00 2001 From: flexatone Date: Wed, 8 Oct 2025 14:57:53 -0700 Subject: [PATCH 01/16] added new requirements --- requirements-build-3_14.txt | 0 requirements-dev-3_14.txt | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 requirements-build-3_14.txt create mode 100644 requirements-dev-3_14.txt diff --git a/requirements-build-3_14.txt b/requirements-build-3_14.txt new file mode 100644 index 00000000..e69de29b diff --git a/requirements-dev-3_14.txt b/requirements-dev-3_14.txt new file mode 100644 index 00000000..e69de29b From 09af8fb61cc76a60d0e13021bf2dc5392f0eadda Mon Sep 17 00:00:00 2001 From: flexatone Date: Wed, 8 Oct 2025 15:25:46 -0700 Subject: [PATCH 02/16] updates for 3.14 --- noxfile.py | 62 +++++++++++++++++++++++++++++++++++++ requirements-build-3_14.txt | 2 ++ requirements-dev-3_14.txt | 4 +++ test/test_pyi.py | 2 ++ 4 files changed, 70 insertions(+) create mode 100644 noxfile.py diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 00000000..527d892e --- /dev/null +++ b/noxfile.py @@ -0,0 +1,62 @@ +# noxfile.py +import nox +import sys +import os + +ARTIFACTS = ( + "*.egg-info", + ".hypothesis", + "build", + "dist", + "src/*.so", +) + +# Optional: set defaults so `nox` with no args runs tests. +# Comment this out if you don't want defaults. +nox.options.sessions = ["test"] + +@nox.session(python=False) # run in the current environment +def clean(session): + """Clean build artifacts and uninstall arraykit.""" + session.run( + sys.executable, "-m", "pip", + "--disable-pip-version-check", "uninstall", "--yes", "arraykit", + external=True + ) + for artifact in sorted(ARTIFACTS): + session.run("rm", "-rf", artifact, external=True) + +@nox.session(python=False) +def build(session): + """Build/install locally without build isolation (keeps verbose for warnings).""" + session.run( + sys.executable, "-m", "pip", + "--disable-pip-version-check", "-v", + "install", "--no-build-isolation", ".", + external=True + ) + +@nox.session(python=False) +def test(session): + """Run pytest with native traceback.""" + session.run( + "pytest", "-s", "--disable-pytest-warnings", "--tb=native", + external=True + ) + +@nox.session(python=False) +def performance(session): + """Run performance benches. Pass names via env: NAMES='foo,bar' nox -s performance""" + names = os.environ.get("NAMES", "") + args = [sys.executable, "-m", "performance"] + if names: + args.extend(["--names", names]) + session.run(*args, external=True) + +@nox.session(python=False) +def lint(session): + """Run pylint static analysis.""" + session.run( + "pylint", "-f", "colorized", "*.py", "performance", "src", "test", + external=True + ) diff --git a/requirements-build-3_14.txt b/requirements-build-3_14.txt index e69de29b..eda2c1d1 100644 --- a/requirements-build-3_14.txt +++ b/requirements-build-3_14.txt @@ -0,0 +1,2 @@ +numpy==2.3.3 +setuptools==80.* diff --git a/requirements-dev-3_14.txt b/requirements-dev-3_14.txt index e69de29b..b0e7a6c6 100644 --- a/requirements-dev-3_14.txt +++ b/requirements-dev-3_14.txt @@ -0,0 +1,4 @@ +numpy==2.3.3 +pytest==8.3.3 +invoke==2.2.0 +hypothesis==6.131.16 diff --git a/test/test_pyi.py b/test/test_pyi.py index 86fc76a8..8f2bcd31 100644 --- a/test/test_pyi.py +++ b/test/test_pyi.py @@ -14,6 +14,8 @@ class Interface(tp.NamedTuple): @staticmethod def _valid_name(name: str) -> bool: + if name in ('__annotate__', '__class__', '__annotate_func__'): + return False if name.startswith('__'): return True if name.startswith('_'): From 9ea198af7dd5db1561d1c9a75805eed6db63db6a Mon Sep 17 00:00:00 2001 From: flexatone Date: Wed, 8 Oct 2025 15:50:56 -0700 Subject: [PATCH 03/16] updated --- .github/workflows/ci.yml | 11 +++--- noxfile.py | 78 +++++++++++++++++++++++++++------------ requirements-dev-3_11.txt | 2 +- requirements-dev-3_12.txt | 2 +- requirements-dev-3_13.txt | 2 +- requirements-dev-3_14.txt | 2 +- 6 files changed, 64 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb2be7d2..f82042c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,8 +17,8 @@ jobs: - uses: actions/checkout@master - uses: actions/setup-python@master with: - python-version: 3.13 - - run: pip install -r requirements-build-3_13.txt + python-version: 3.14 + - run: pip install -r requirements-build-3_14.txt - run: python setup.py sdist - uses: actions/upload-artifact@v4 with: @@ -52,7 +52,8 @@ jobs: - {minor: 11, req_build: 'requirements-build-3_11.txt', req_test: 'requirements-dev-3_11.txt', ft: '0'} - {minor: 12, req_build: 'requirements-build-3_12.txt', req_test: 'requirements-dev-3_12.txt', ft: '0'} - {minor: 13, req_build: 'requirements-build-3_13.txt', req_test: 'requirements-dev-3_13.txt', ft: '0'} - - {minor: 13t, req_build: 'requirements-build-3_13.txt', req_test: 'requirements-dev-3_13.txt', ft: '1'} + - {minor: 14, req_build: 'requirements-build-3_14.txt', req_test: 'requirements-dev-3_14.txt', ft: '0'} + - {minor: 14t, req_build: 'requirements-build-3_14.txt', req_test: 'requirements-dev-3_14.txt', ft: '1'} runs-on: ${{ matrix.os }} outputs: @@ -65,7 +66,7 @@ jobs: - run: echo '::add-matcher::.github/problem-matchers/msvc.json' if: startsWith(matrix.os, 'windows-') - - uses: pypa/cibuildwheel@v2.23.3 + - uses: pypa/cibuildwheel@v3.2.0 if: matrix.os != 'macos-13-xlarge' with: output-dir: dist @@ -80,7 +81,7 @@ jobs: - run: pip install pipx if: matrix.os == 'macos-13-xlarge' - - uses: pypa/cibuildwheel@v2.23.3 + - uses: pypa/cibuildwheel@v3.2.0 if: matrix.os == 'macos-13-xlarge' with: output-dir: dist diff --git a/noxfile.py b/noxfile.py index 527d892e..6e66a33d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,4 +1,3 @@ -# noxfile.py import nox import sys import os @@ -11,24 +10,24 @@ "src/*.so", ) -# Optional: set defaults so `nox` with no args runs tests. -# Comment this out if you don't want defaults. +# Make `nox` default to running tests if you just do `nox` nox.options.sessions = ["test"] -@nox.session(python=False) # run in the current environment -def clean(session): - """Clean build artifacts and uninstall arraykit.""" +# ----- helpers (not sessions) ----- + +def do_clean(session: nox.Session) -> None: + # uninstall arraykit session.run( sys.executable, "-m", "pip", "--disable-pip-version-check", "uninstall", "--yes", "arraykit", external=True ) + # remove artifacts for artifact in sorted(ARTIFACTS): session.run("rm", "-rf", artifact, external=True) -@nox.session(python=False) -def build(session): - """Build/install locally without build isolation (keeps verbose for warnings).""" +def do_build(session: nox.Session) -> None: + # keep -v to see warnings; no build isolation to match your invoke cmd session.run( sys.executable, "-m", "pip", "--disable-pip-version-check", "-v", @@ -36,27 +35,58 @@ def build(session): external=True ) -@nox.session(python=False) -def test(session): - """Run pytest with native traceback.""" +def do_test(session: nox.Session) -> None: session.run( - "pytest", "-s", "--disable-pytest-warnings", "--tb=native", - external=True + "pytest", + "-s", + "--disable-pytest-warnings", + "--tb=native", + external=True, ) -@nox.session(python=False) -def performance(session): - """Run performance benches. Pass names via env: NAMES='foo,bar' nox -s performance""" - names = os.environ.get("NAMES", "") +def do_performance(session: nox.Session) -> None: + """Run performance benchmarks.""" args = [sys.executable, "-m", "performance"] - if names: - args.extend(["--names", names]) + + if session.posargs: + args.extend(["--names"] + session.posargs) + session.run(*args, external=True) +def do_lint(session: nox.Session) -> None: + session.run( + "pylint", + "-f", "colorized", + "*.py", "performance", "src", "test", + external=True, + ) + +# ----- sessions ----- + +@nox.session(python=False) # use current environment +def clean(session): + """Clean build artifacts and uninstall arraykit.""" + do_clean(session) + +@nox.session(python=False) +def build(session): + """Clean then build/install locally (like invoke: build depends on clean).""" + do_clean(session) + do_build(session) + +@nox.session(python=False) +def test(session): + """Build then run pytest (like invoke: test depends on build).""" + do_build(session) + do_test(session) + +@nox.session(python=False) +def performance(session): + """Build then run performance benches (like invoke: performance depends on build).""" + do_build(session) + do_performance(session) + @nox.session(python=False) def lint(session): """Run pylint static analysis.""" - session.run( - "pylint", "-f", "colorized", "*.py", "performance", "src", "test", - external=True - ) + do_lint(session) diff --git a/requirements-dev-3_11.txt b/requirements-dev-3_11.txt index d34c9454..20e83c99 100644 --- a/requirements-dev-3_11.txt +++ b/requirements-dev-3_11.txt @@ -1,4 +1,4 @@ numpy==2.0.2 pytest==7.1.2 -invoke==2.2.0 +nox==2025.5.1 hypothesis==6.10.1 diff --git a/requirements-dev-3_12.txt b/requirements-dev-3_12.txt index e692ee9a..9c8e590d 100644 --- a/requirements-dev-3_12.txt +++ b/requirements-dev-3_12.txt @@ -1,4 +1,4 @@ numpy==2.2.6 pytest==7.1.2 -invoke==2.2.0 +nox==2025.5.1 hypothesis==6.10.1 diff --git a/requirements-dev-3_13.txt b/requirements-dev-3_13.txt index e029979c..11ec293f 100644 --- a/requirements-dev-3_13.txt +++ b/requirements-dev-3_13.txt @@ -1,4 +1,4 @@ numpy==2.3.1 pytest==8.3.3 -invoke==2.2.0 +nox==2025.5.1 hypothesis==6.131.16 diff --git a/requirements-dev-3_14.txt b/requirements-dev-3_14.txt index b0e7a6c6..542eb9a2 100644 --- a/requirements-dev-3_14.txt +++ b/requirements-dev-3_14.txt @@ -1,4 +1,4 @@ numpy==2.3.3 pytest==8.3.3 -invoke==2.2.0 +nox==2025.5.1 hypothesis==6.131.16 From e78108fac11f74dcab2342e456370aea1d2bdfd4 Mon Sep 17 00:00:00 2001 From: flexatone Date: Wed, 8 Oct 2025 15:55:12 -0700 Subject: [PATCH 04/16] updated noxfile, removed tasks.py --- noxfile.py | 5 ++--- tasks.py | 49 ------------------------------------------------- 2 files changed, 2 insertions(+), 52 deletions(-) delete mode 100644 tasks.py diff --git a/noxfile.py b/noxfile.py index 6e66a33d..90684fa8 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,6 +1,5 @@ import nox import sys -import os ARTIFACTS = ( "*.egg-info", @@ -13,7 +12,6 @@ # Make `nox` default to running tests if you just do `nox` nox.options.sessions = ["test"] -# ----- helpers (not sessions) ----- def do_clean(session: nox.Session) -> None: # uninstall arraykit @@ -61,7 +59,8 @@ def do_lint(session: nox.Session) -> None: external=True, ) -# ----- sessions ----- + +# NOTE: use `nox -s build` to launch a session @nox.session(python=False) # use current environment def clean(session): diff --git a/tasks.py b/tasks.py deleted file mode 100644 index 6b95cc69..00000000 --- a/tasks.py +++ /dev/null @@ -1,49 +0,0 @@ -import sys - -import invoke - -ARTIFACTS = ( - '*.egg-info', - '.hypothesis', - 'build', - 'dist', - 'src/*.so' -) - - -@invoke.task -def clean(context): - '''Clean doc and build artifacts - ''' - cmd = f'{sys.executable} -m pip --disable-pip-version-check uninstall --yes arraykit' - context.run(cmd, echo=True, pty=True) - - for artifact in sorted(ARTIFACTS): - context.run(f'rm -rf {artifact}', echo=True, pty=True) - - -@invoke.task(clean) -def build(context): - # context.run('pip install -r requirements-test.txt', echo=True, pty=True) - # keep verbose to see warnings - context.run(f'{sys.executable} -m pip --disable-pip-version-check -v install --no-build-isolation .', echo=True, pty=True) - - -@invoke.task(build) -def test(context): - cmd = 'pytest -s --disable-pytest-warnings --tb=native' - context.run(cmd, echo=True, pty=True) - - -@invoke.task(build) -def performance(context, names=''): - context.run(f'{sys.executable} -m performance {"--names" if names else ""} {names}', echo=True, pty=True) - - -@invoke.task -def lint(context): - '''Run pylint static analysis. - ''' - cmd = 'pylint -f colorized *.py performance src test' - context.run(cmd, echo=True, pty=True) - From b4a926347d7b8d75632d057e7a3296ca0712932d Mon Sep 17 00:00:00 2001 From: flexatone Date: Wed, 8 Oct 2025 15:57:10 -0700 Subject: [PATCH 05/16] updated noxfile --- noxfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/noxfile.py b/noxfile.py index 90684fa8..c42cb3f2 100644 --- a/noxfile.py +++ b/noxfile.py @@ -76,12 +76,14 @@ def build(session): @nox.session(python=False) def test(session): """Build then run pytest (like invoke: test depends on build).""" + do_clean(session) do_build(session) do_test(session) @nox.session(python=False) def performance(session): """Build then run performance benches (like invoke: performance depends on build).""" + do_clean(session) do_build(session) do_performance(session) From a2d2fa194d7d4425b40de1d8e373ea00f7a7f50d Mon Sep 17 00:00:00 2001 From: flexatone Date: Wed, 8 Oct 2025 16:11:51 -0700 Subject: [PATCH 06/16] try no isolation --- .github/workflows/ci.yml | 2 ++ setup.py | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f82042c7..274625ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,6 +72,7 @@ jobs: output-dir: dist env: CIBW_BUILD: cp3${{ matrix.python.minor }}-* + CIBW_CONFIG_SETTINGS: --no-isolation CIBW_ARCHS_WINDOWS: x86 AMD64 CIBW_ARCHS_MACOS: x86_64 CIBW_BEFORE_BUILD: pip install -r {project}/${{ matrix.python.req_build }} @@ -87,6 +88,7 @@ jobs: output-dir: dist env: CIBW_BUILD: cp3${{ matrix.python.minor }}-macosx_arm64 + CIBW_CONFIG_SETTINGS: --no-isolation CIBW_BEFORE_BUILD: pip install -r {project}/${{ matrix.python.req_build }} CIBW_BEFORE_TEST: pip install -r {project}/${{ matrix.python.req_test }} CIBW_TEST_COMMAND: pytest {project}/test diff --git a/setup.py b/setup.py index 103a1658..6552a42a 100644 --- a/setup.py +++ b/setup.py @@ -83,6 +83,7 @@ def get_ext_dir(*components: tp.Iterable[str]) -> tp.Sequence[str]: 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: 3.13', + 'Programming Language :: Python :: 3.14', 'Programming Language :: Python :: Free Threading', 'Typing :: Typed', ], From 85133d3f7c7bf4f4c3936d818ea0b2ba3cfc3328 Mon Sep 17 00:00:00 2001 From: flexatone Date: Wed, 8 Oct 2025 16:16:01 -0700 Subject: [PATCH 07/16] add pyproject.toml --- .github/workflows/ci.yml | 2 -- pyproject.toml | 9 +++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 pyproject.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 274625ac..f82042c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,6 @@ jobs: output-dir: dist env: CIBW_BUILD: cp3${{ matrix.python.minor }}-* - CIBW_CONFIG_SETTINGS: --no-isolation CIBW_ARCHS_WINDOWS: x86 AMD64 CIBW_ARCHS_MACOS: x86_64 CIBW_BEFORE_BUILD: pip install -r {project}/${{ matrix.python.req_build }} @@ -88,7 +87,6 @@ jobs: output-dir: dist env: CIBW_BUILD: cp3${{ matrix.python.minor }}-macosx_arm64 - CIBW_CONFIG_SETTINGS: --no-isolation CIBW_BEFORE_BUILD: pip install -r {project}/${{ matrix.python.req_build }} CIBW_BEFORE_TEST: pip install -r {project}/${{ matrix.python.req_test }} CIBW_TEST_COMMAND: pytest {project}/test diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..24662ff6 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,9 @@ +[build-system] +requires = [ + "setuptools>=64", + "wheel", + "numpy>=2.3.3" +] +build-backend = "setuptools.build_meta" + + From 099e21d2c907c1e810b4ffbe545c7631286316b2 Mon Sep 17 00:00:00 2001 From: flexatone Date: Wed, 8 Oct 2025 16:20:12 -0700 Subject: [PATCH 08/16] flexible numpy version range --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 24662ff6..ae0df55b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ requires = [ "setuptools>=64", "wheel", - "numpy>=2.3.3" + "numpy>=2.2" ] build-backend = "setuptools.build_meta" From ad4b8faae8d16f732263fc25437d5f1c6c519766 Mon Sep 17 00:00:00 2001 From: flexatone Date: Wed, 8 Oct 2025 16:24:19 -0700 Subject: [PATCH 09/16] updated version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6552a42a..8b8dbdc5 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ from setuptools import Extension # type: ignore from setuptools import setup -AK_VERSION = '1.1.0' +AK_VERSION = '1.2.0' ROOT_DIR_FP = path.abspath(path.dirname(__file__)) From d059d49d84d5f9adc0cd6924115454eb342f948a Mon Sep 17 00:00:00 2001 From: flexatone Date: Thu, 9 Oct 2025 08:42:43 -0700 Subject: [PATCH 10/16] extended pyproject.toml, removed most of setup.py --- noxfile.py | 4 +- pyproject.toml | 65 ++++++++++++++ setup.py | 233 ++++++++++++++++++++++++++++++++----------------- 3 files changed, 218 insertions(+), 84 deletions(-) diff --git a/noxfile.py b/noxfile.py index c42cb3f2..193e6d8f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -28,8 +28,8 @@ def do_build(session: nox.Session) -> None: # keep -v to see warnings; no build isolation to match your invoke cmd session.run( sys.executable, "-m", "pip", - "--disable-pip-version-check", "-v", - "install", "--no-build-isolation", ".", + "--disable-pip-version-check", + "install", "-v", "--no-build-isolation", ".", external=True ) diff --git a/pyproject.toml b/pyproject.toml index ae0df55b..aaf2f50c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,3 +7,68 @@ requires = [ build-backend = "setuptools.build_meta" +[project] +name = "arraykit" +version = "1.2.0" +description = "Array utilities for StaticFrame" +readme = { file = "README.rst", content-type = "text/x-rst" } +requires-python = ">=3.10" + +authors = [ + { name = "Christopher Ariza" }, + { name = "Brandt Bucher" }, + { name = "Charles Burkland" }, +] +license = "MIT" +keywords = ["numpy", "array"] +dependencies = [ + "numpy>=1.24.3", +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Topic :: Software Development", + "Programming Language :: C", + "Programming Language :: Python :: Implementation :: CPython", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: Free Threading", + "Typing :: Typed", +] + +[project.urls] +Homepage = "https://github.com/static-frame/arraykit" + +[tool.setuptools] +# Your src layout is already “src/” but package_dir currently maps the top-level +# module "arraykit" to "src". Keep that mapping explicitly: +package-dir = { "arraykit" = "src" } + +[tool.setuptools.package-data] +arraykit = ["__init__.pyi", "py.typed"] + +# Define your C extension here. We'll add NumPy's include/lib paths dynamically +# via a tiny setup.py shim (below). +# [tool.setuptools.ext-modules."arraykit._arraykit"] +# sources = [ +# "src/_arraykit.c", +# "src/array_go.c", +# "src/array_to_tuple.c", +# "src/block_index.c", +# "src/delimited_to_arrays.c", +# "src/methods.c", +# "src/tri_map.c", +# "src/auto_map.c", +# ] +# include-dirs = ["src"] +# define-macros = [["AK_VERSION", "1.2.0"]] + +# # If you truly need to link to 'npymath', leave libraries empty here and let the +# # setup.py shim add it only when/where it exists. +# libraries = ["npymath"] # (we'll add dynamically in the shim if present) diff --git a/setup.py b/setup.py index 8b8dbdc5..6f4142da 100644 --- a/setup.py +++ b/setup.py @@ -1,35 +1,8 @@ -import site -import os -from os import path -import typing as tp -from setuptools import Extension # type: ignore -from setuptools import setup - -AK_VERSION = '1.2.0' - -ROOT_DIR_FP = path.abspath(path.dirname(__file__)) - -def get_long_description() -> str: - with open(path.join(ROOT_DIR_FP, 'README.rst'), encoding='utf-8') as f: - msg = [] - collect = False - start = -1 - for i, line in enumerate(f): - if line.startswith('arraykit'): - start = i + 2 # skip this line and the next - if i == start: - collect = True - if collect: - msg.append(line) - return ''.join(msg).strip() - - -# NOTE: we do this to avoid importing numpy: https://stackoverflow.com/questions/54117786/add-numpy-get-include-argument-to-setuptools-without-preinstalled-numpy -# we used to import the following to get directories: -# from numpy.distutils.misc_util import get_info -# import numpy as np # type: ignore -# get_info('npymath')['library_dirs'] -# get_info('npymath')['libraries'] +from setuptools import setup, Extension +from setuptools.command.build_ext import build_ext +import site, os + +AK_VERSION = "1.2.0" def get_ext_dir(*components: tp.Iterable[str]) -> tp.Sequence[str]: dirs = [] @@ -39,58 +12,154 @@ def get_ext_dir(*components: tp.Iterable[str]) -> tp.Sequence[str]: dirs.append(fp) return dirs -ak_extension = Extension( - name='arraykit._arraykit', # build into module +# subclass build_ext to append NumPy's include path at build time +# class build_ext_numpy(build_ext): +# def finalize_options(self): +# super().finalize_options() +# import numpy # available thanks to [build-system].requires +# self.include_dirs.append(numpy.get_include()) + +# # If (and only if) you truly need to link npymath, try to discover it. +# # Many extensions don't need this anymore. Safe to remove if unused. +# try: +# import os +# import numpy.core as npcore +# get_lib = getattr(npcore, "get_lib", None) +# if callable(get_lib): +# libdir = get_lib() +# if libdir and os.path.isdir(libdir): +# self.library_dirs.append(libdir) +# # add once +# libs = set(self.libraries or []) +# if "npymath" not in libs: +# self.libraries = list(libs | {"npymath"}) +# except Exception: +# pass + +ext_modules = [ + Extension( + name="arraykit._arraykit", sources=[ - 'src/_arraykit.c', - 'src/array_go.c', - 'src/array_to_tuple.c', - 'src/block_index.c', - 'src/delimited_to_arrays.c', - 'src/methods.c', - 'src/tri_map.c', - 'src/auto_map.c', + "src/_arraykit.c", + "src/array_go.c", + "src/array_to_tuple.c", + "src/block_index.c", + "src/delimited_to_arrays.c", + "src/methods.c", + "src/tri_map.c", + "src/auto_map.c", ], + include_dirs=get_ext_dir('numpy', '_core', 'include') + ['src'], library_dirs=get_ext_dir('numpy', '_core', 'lib'), define_macros=[("AK_VERSION", AK_VERSION)], - libraries=['npymath'], # not including mlib at this time - ) - -setup( - name='arraykit', - version=AK_VERSION, - description='Array utilities for StaticFrame', - long_description=get_long_description(), - long_description_content_type='text/x-rst', # use text/x-rst - python_requires='>=3.10', - install_requires=['numpy>=1.24.3'], - url='https://github.com/static-frame/arraykit', - author='Christopher Ariza, Brandt Bucher, Charles Burkland', - license='MIT', - # See https://pypi.python.org/pypi?%3Aaction=list_classifiers - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Topic :: Software Development', - "Programming Language :: C", - "Programming Language :: Python :: Implementation :: CPython", - 'License :: OSI Approved :: MIT License', - 'Operating System :: MacOS :: MacOS X', - 'Operating System :: Microsoft :: Windows', - 'Operating System :: POSIX', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'Programming Language :: Python :: 3.12', - 'Programming Language :: Python :: 3.13', - 'Programming Language :: Python :: 3.14', - 'Programming Language :: Python :: Free Threading', - 'Typing :: Typed', - ], - keywords='numpy array', - packages=['arraykit'], - package_dir={'arraykit': 'src'}, - package_data={'arraykit': ['__init__.pyi', 'py.typed']}, - include_package_data=True, - ext_modules=[ak_extension], -) + libraries=["npymath"], + ) +] + + +setup(ext_modules=ext_modules) + + +# no metadata here—keep that in pyproject.toml +# setup(ext_modules=ext_modules, cmdclass={"build_ext": build_ext_numpy}) + + + + +# import site +# import os +# from os import path +# import typing as tp +# from setuptools import Extension # type: ignore +# from setuptools import setup + +# AK_VERSION = '1.2.0' + +# ROOT_DIR_FP = path.abspath(path.dirname(__file__)) + +# def get_long_description() -> str: +# with open(path.join(ROOT_DIR_FP, 'README.rst'), encoding='utf-8') as f: +# msg = [] +# collect = False +# start = -1 +# for i, line in enumerate(f): +# if line.startswith('arraykit'): +# start = i + 2 # skip this line and the next +# if i == start: +# collect = True +# if collect: +# msg.append(line) +# return ''.join(msg).strip() + + +# # NOTE: we do this to avoid importing numpy: https://stackoverflow.com/questions/54117786/add-numpy-get-include-argument-to-setuptools-without-preinstalled-numpy +# # we used to import the following to get directories: +# # from numpy.distutils.misc_util import get_info +# # import numpy as np # type: ignore +# # get_info('npymath')['library_dirs'] +# # get_info('npymath')['libraries'] + +# def get_ext_dir(*components: tp.Iterable[str]) -> tp.Sequence[str]: +# dirs = [] +# for sp in site.getsitepackages(): +# fp = os.path.join(sp, *components) +# if os.path.exists(fp): +# dirs.append(fp) +# return dirs + +# ak_extension = Extension( +# name='arraykit._arraykit', # build into module +# sources=[ +# 'src/_arraykit.c', +# 'src/array_go.c', +# 'src/array_to_tuple.c', +# 'src/block_index.c', +# 'src/delimited_to_arrays.c', +# 'src/methods.c', +# 'src/tri_map.c', +# 'src/auto_map.c', +# ], +# include_dirs=get_ext_dir('numpy', '_core', 'include') + ['src'], +# library_dirs=get_ext_dir('numpy', '_core', 'lib'), +# define_macros=[("AK_VERSION", AK_VERSION)], +# libraries=['npymath'], # not including mlib at this time +# ) + +# setup( +# name='arraykit', +# version=AK_VERSION, +# description='Array utilities for StaticFrame', +# long_description=get_long_description(), +# long_description_content_type='text/x-rst', # use text/x-rst +# python_requires='>=3.10', +# install_requires=['numpy>=1.24.3'], +# url='https://github.com/static-frame/arraykit', +# author='Christopher Ariza, Brandt Bucher, Charles Burkland', +# license='MIT', +# # See https://pypi.python.org/pypi?%3Aaction=list_classifiers +# classifiers=[ +# 'Development Status :: 5 - Production/Stable', +# 'Intended Audience :: Developers', +# 'Topic :: Software Development', +# "Programming Language :: C", +# "Programming Language :: Python :: Implementation :: CPython", +# 'License :: OSI Approved :: MIT License', +# 'Operating System :: MacOS :: MacOS X', +# 'Operating System :: Microsoft :: Windows', +# 'Operating System :: POSIX', +# 'Programming Language :: Python :: 3.10', +# 'Programming Language :: Python :: 3.11', +# 'Programming Language :: Python :: 3.12', +# 'Programming Language :: Python :: 3.13', +# 'Programming Language :: Python :: 3.14', +# 'Programming Language :: Python :: Free Threading', +# 'Typing :: Typed', +# ], +# keywords='numpy array', +# packages=['arraykit'], +# package_dir={'arraykit': 'src'}, +# package_data={'arraykit': ['__init__.pyi', 'py.typed']}, +# include_package_data=True, +# ext_modules=[ak_extension], +# ) From f6b8ac56ca5d50346afc1915a0788f11d9130230 Mon Sep 17 00:00:00 2001 From: flexatone Date: Thu, 9 Oct 2025 08:45:06 -0700 Subject: [PATCH 11/16] remove CIBW_BEFORE_BUILD --- .github/workflows/ci.yml | 2 -- pyproject.toml | 22 ---------------------- 2 files changed, 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f82042c7..c099ba0d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,7 +74,6 @@ jobs: CIBW_BUILD: cp3${{ matrix.python.minor }}-* CIBW_ARCHS_WINDOWS: x86 AMD64 CIBW_ARCHS_MACOS: x86_64 - CIBW_BEFORE_BUILD: pip install -r {project}/${{ matrix.python.req_build }} CIBW_BEFORE_TEST: pip install -r {project}/${{ matrix.python.req_test }} CIBW_TEST_COMMAND: pytest {project}/test CIBW_ENABLE: ${{ matrix.python.ft == '1' && 'cpython-freethreading' || '' }} @@ -87,7 +86,6 @@ jobs: output-dir: dist env: CIBW_BUILD: cp3${{ matrix.python.minor }}-macosx_arm64 - CIBW_BEFORE_BUILD: pip install -r {project}/${{ matrix.python.req_build }} CIBW_BEFORE_TEST: pip install -r {project}/${{ matrix.python.req_test }} CIBW_TEST_COMMAND: pytest {project}/test CIBW_ENABLE: ${{ matrix.python.ft == '1' && 'cpython-freethreading' || '' }} diff --git a/pyproject.toml b/pyproject.toml index aaf2f50c..b902294b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,29 +46,7 @@ classifiers = [ Homepage = "https://github.com/static-frame/arraykit" [tool.setuptools] -# Your src layout is already “src/” but package_dir currently maps the top-level -# module "arraykit" to "src". Keep that mapping explicitly: package-dir = { "arraykit" = "src" } [tool.setuptools.package-data] arraykit = ["__init__.pyi", "py.typed"] - -# Define your C extension here. We'll add NumPy's include/lib paths dynamically -# via a tiny setup.py shim (below). -# [tool.setuptools.ext-modules."arraykit._arraykit"] -# sources = [ -# "src/_arraykit.c", -# "src/array_go.c", -# "src/array_to_tuple.c", -# "src/block_index.c", -# "src/delimited_to_arrays.c", -# "src/methods.c", -# "src/tri_map.c", -# "src/auto_map.c", -# ] -# include-dirs = ["src"] -# define-macros = [["AK_VERSION", "1.2.0"]] - -# # If you truly need to link to 'npymath', leave libraries empty here and let the -# # setup.py shim add it only when/where it exists. -# libraries = ["npymath"] # (we'll add dynamically in the shim if present) From 0b4849f85fc3b87c7b28f9270a30c831d95bf804 Mon Sep 17 00:00:00 2001 From: flexatone Date: Thu, 9 Oct 2025 09:06:33 -0700 Subject: [PATCH 12/16] remove req_build --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c099ba0d..7e5335ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,12 +48,12 @@ jobs: matrix: os: ${{ fromJson(needs.matrix_config.outputs.matrix_os) }} python: - - {minor: 10, req_build: 'requirements-build-3_11.txt', req_test: 'requirements-dev-3_11.txt', ft: '0'} - - {minor: 11, req_build: 'requirements-build-3_11.txt', req_test: 'requirements-dev-3_11.txt', ft: '0'} - - {minor: 12, req_build: 'requirements-build-3_12.txt', req_test: 'requirements-dev-3_12.txt', ft: '0'} - - {minor: 13, req_build: 'requirements-build-3_13.txt', req_test: 'requirements-dev-3_13.txt', ft: '0'} - - {minor: 14, req_build: 'requirements-build-3_14.txt', req_test: 'requirements-dev-3_14.txt', ft: '0'} - - {minor: 14t, req_build: 'requirements-build-3_14.txt', req_test: 'requirements-dev-3_14.txt', ft: '1'} + - {minor: 10, req_test: 'requirements-dev-3_11.txt', ft: '0'} + - {minor: 11, req_test: 'requirements-dev-3_11.txt', ft: '0'} + - {minor: 12, req_test: 'requirements-dev-3_12.txt', ft: '0'} + - {minor: 13, req_test: 'requirements-dev-3_13.txt', ft: '0'} + - {minor: 14, req_test: 'requirements-dev-3_14.txt', ft: '0'} + - {minor: 14t, req_test: 'requirements-dev-3_14.txt', ft: '1'} runs-on: ${{ matrix.os }} outputs: From 297ce0a4d9d2da1165a7e883392e40a9c300270b Mon Sep 17 00:00:00 2001 From: flexatone Date: Thu, 9 Oct 2025 10:57:50 -0700 Subject: [PATCH 13/16] cleanup --- requirements-build-3_11.txt | 2 - requirements-build-3_12.txt | 2 - requirements-build-3_13.txt | 2 - requirements-build-3_14.txt | 2 - setup.py | 128 ------------------------------------ 5 files changed, 136 deletions(-) delete mode 100644 requirements-build-3_11.txt delete mode 100644 requirements-build-3_12.txt delete mode 100644 requirements-build-3_13.txt delete mode 100644 requirements-build-3_14.txt diff --git a/requirements-build-3_11.txt b/requirements-build-3_11.txt deleted file mode 100644 index 86438d81..00000000 --- a/requirements-build-3_11.txt +++ /dev/null @@ -1,2 +0,0 @@ -numpy==2.0.2 - diff --git a/requirements-build-3_12.txt b/requirements-build-3_12.txt deleted file mode 100644 index fe9ad60c..00000000 --- a/requirements-build-3_12.txt +++ /dev/null @@ -1,2 +0,0 @@ -numpy==2.2.6 -setuptools==80.* diff --git a/requirements-build-3_13.txt b/requirements-build-3_13.txt deleted file mode 100644 index 467a95b6..00000000 --- a/requirements-build-3_13.txt +++ /dev/null @@ -1,2 +0,0 @@ -numpy==2.3.1 -setuptools==80.* diff --git a/requirements-build-3_14.txt b/requirements-build-3_14.txt deleted file mode 100644 index eda2c1d1..00000000 --- a/requirements-build-3_14.txt +++ /dev/null @@ -1,2 +0,0 @@ -numpy==2.3.3 -setuptools==80.* diff --git a/setup.py b/setup.py index 6f4142da..27a0badc 100644 --- a/setup.py +++ b/setup.py @@ -12,30 +12,6 @@ def get_ext_dir(*components: tp.Iterable[str]) -> tp.Sequence[str]: dirs.append(fp) return dirs -# subclass build_ext to append NumPy's include path at build time -# class build_ext_numpy(build_ext): -# def finalize_options(self): -# super().finalize_options() -# import numpy # available thanks to [build-system].requires -# self.include_dirs.append(numpy.get_include()) - -# # If (and only if) you truly need to link npymath, try to discover it. -# # Many extensions don't need this anymore. Safe to remove if unused. -# try: -# import os -# import numpy.core as npcore -# get_lib = getattr(npcore, "get_lib", None) -# if callable(get_lib): -# libdir = get_lib() -# if libdir and os.path.isdir(libdir): -# self.library_dirs.append(libdir) -# # add once -# libs = set(self.libraries or []) -# if "npymath" not in libs: -# self.libraries = list(libs | {"npymath"}) -# except Exception: -# pass - ext_modules = [ Extension( name="arraykit._arraykit", @@ -57,109 +33,5 @@ def get_ext_dir(*components: tp.Iterable[str]) -> tp.Sequence[str]: ) ] - setup(ext_modules=ext_modules) - -# no metadata here—keep that in pyproject.toml -# setup(ext_modules=ext_modules, cmdclass={"build_ext": build_ext_numpy}) - - - - -# import site -# import os -# from os import path -# import typing as tp -# from setuptools import Extension # type: ignore -# from setuptools import setup - -# AK_VERSION = '1.2.0' - -# ROOT_DIR_FP = path.abspath(path.dirname(__file__)) - -# def get_long_description() -> str: -# with open(path.join(ROOT_DIR_FP, 'README.rst'), encoding='utf-8') as f: -# msg = [] -# collect = False -# start = -1 -# for i, line in enumerate(f): -# if line.startswith('arraykit'): -# start = i + 2 # skip this line and the next -# if i == start: -# collect = True -# if collect: -# msg.append(line) -# return ''.join(msg).strip() - - -# # NOTE: we do this to avoid importing numpy: https://stackoverflow.com/questions/54117786/add-numpy-get-include-argument-to-setuptools-without-preinstalled-numpy -# # we used to import the following to get directories: -# # from numpy.distutils.misc_util import get_info -# # import numpy as np # type: ignore -# # get_info('npymath')['library_dirs'] -# # get_info('npymath')['libraries'] - -# def get_ext_dir(*components: tp.Iterable[str]) -> tp.Sequence[str]: -# dirs = [] -# for sp in site.getsitepackages(): -# fp = os.path.join(sp, *components) -# if os.path.exists(fp): -# dirs.append(fp) -# return dirs - -# ak_extension = Extension( -# name='arraykit._arraykit', # build into module -# sources=[ -# 'src/_arraykit.c', -# 'src/array_go.c', -# 'src/array_to_tuple.c', -# 'src/block_index.c', -# 'src/delimited_to_arrays.c', -# 'src/methods.c', -# 'src/tri_map.c', -# 'src/auto_map.c', -# ], -# include_dirs=get_ext_dir('numpy', '_core', 'include') + ['src'], -# library_dirs=get_ext_dir('numpy', '_core', 'lib'), -# define_macros=[("AK_VERSION", AK_VERSION)], -# libraries=['npymath'], # not including mlib at this time -# ) - -# setup( -# name='arraykit', -# version=AK_VERSION, -# description='Array utilities for StaticFrame', -# long_description=get_long_description(), -# long_description_content_type='text/x-rst', # use text/x-rst -# python_requires='>=3.10', -# install_requires=['numpy>=1.24.3'], -# url='https://github.com/static-frame/arraykit', -# author='Christopher Ariza, Brandt Bucher, Charles Burkland', -# license='MIT', -# # See https://pypi.python.org/pypi?%3Aaction=list_classifiers -# classifiers=[ -# 'Development Status :: 5 - Production/Stable', -# 'Intended Audience :: Developers', -# 'Topic :: Software Development', -# "Programming Language :: C", -# "Programming Language :: Python :: Implementation :: CPython", -# 'License :: OSI Approved :: MIT License', -# 'Operating System :: MacOS :: MacOS X', -# 'Operating System :: Microsoft :: Windows', -# 'Operating System :: POSIX', -# 'Programming Language :: Python :: 3.10', -# 'Programming Language :: Python :: 3.11', -# 'Programming Language :: Python :: 3.12', -# 'Programming Language :: Python :: 3.13', -# 'Programming Language :: Python :: 3.14', -# 'Programming Language :: Python :: Free Threading', -# 'Typing :: Typed', -# ], -# keywords='numpy array', -# packages=['arraykit'], -# package_dir={'arraykit': 'src'}, -# package_data={'arraykit': ['__init__.pyi', 'py.typed']}, -# include_package_data=True, -# ext_modules=[ak_extension], -# ) From 2044580c8251c66a3fcfb2c7116ae968170282fe Mon Sep 17 00:00:00 2001 From: flexatone Date: Thu, 9 Oct 2025 11:01:45 -0700 Subject: [PATCH 14/16] use VERSION file --- MANIFEST.in | 1 + VERSION | 2 ++ pyproject.toml | 7 ++++++- setup.py | 3 ++- 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 VERSION diff --git a/MANIFEST.in b/MANIFEST.in index 84e9b5a2..cb6cad3a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,3 @@ include src/__init__.pyi src/py.typed include src/*.h +include VERSION diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..cb7e5f6f --- /dev/null +++ b/VERSION @@ -0,0 +1,2 @@ +1.2.0 + diff --git a/pyproject.toml b/pyproject.toml index b902294b..9c88dd01 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,11 +9,12 @@ build-backend = "setuptools.build_meta" [project] name = "arraykit" -version = "1.2.0" description = "Array utilities for StaticFrame" readme = { file = "README.rst", content-type = "text/x-rst" } requires-python = ">=3.10" +dynamic = ["version"] + authors = [ { name = "Christopher Ariza" }, { name = "Brandt Bucher" }, @@ -50,3 +51,7 @@ package-dir = { "arraykit" = "src" } [tool.setuptools.package-data] arraykit = ["__init__.pyi", "py.typed"] + +[tool.setuptools.dynamic] +version = { file = "VERSION" } + diff --git a/setup.py b/setup.py index 27a0badc..20e4da61 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,9 @@ from setuptools import setup, Extension from setuptools.command.build_ext import build_ext import site, os +from pathlib import Path -AK_VERSION = "1.2.0" +AK_VERSION = Path("VERSION").read_text(encoding="utf-8").strip() def get_ext_dir(*components: tp.Iterable[str]) -> tp.Sequence[str]: dirs = [] From 6b9c497f166b232d1a6d9b2a78831684ac8ded37 Mon Sep 17 00:00:00 2001 From: flexatone Date: Thu, 9 Oct 2025 11:06:44 -0700 Subject: [PATCH 15/16] cleanup --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9c88dd01..21222e84 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,6 @@ requires = [ ] build-backend = "setuptools.build_meta" - [project] name = "arraykit" description = "Array utilities for StaticFrame" From 425d2330c6efcc53eb7db67bb3ce3ffbac048677 Mon Sep 17 00:00:00 2001 From: flexatone Date: Thu, 9 Oct 2025 11:13:57 -0700 Subject: [PATCH 16/16] updated source package build --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e5335ba..c75047b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,8 +18,8 @@ jobs: - uses: actions/setup-python@master with: python-version: 3.14 - - run: pip install -r requirements-build-3_14.txt - - run: python setup.py sdist + - run: python -m pip install build + - run: python -m build --sdist - uses: actions/upload-artifact@v4 with: name: dist-sdist