Skip to content

Commit

Permalink
Revert everything to last successful build
Browse files Browse the repository at this point in the history
  • Loading branch information
stanmart committed Jan 29, 2025
1 parent 8a8a07d commit 49d13cf
Show file tree
Hide file tree
Showing 21 changed files with 12,439 additions and 10,258 deletions.
14 changes: 0 additions & 14 deletions .ci_support/linux_64_python3.13_default.____cpython.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions .ci_support/osx_64_python3.13_default.____cpython.yaml

This file was deleted.

18 changes: 0 additions & 18 deletions .ci_support/osx_arm64_python3.13.____cpython.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions .ci_support/win_64_python3.13.____cpython.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @MarcAntoineSchmidtQC @jtilly @lbittarello @stanmart
* @MarcAntoineSchmidtQC @xhochy @jtilly @lbittarello
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build:
tools:
python: mambaforge-4.10
commands:
- mamba install -c conda-forge -c nodefaults pixi==0.39.4
- mamba install -c conda-forge -c nodefaults pixi==0.27.0
- pixi run -e docs postinstall
- pixi run readthedocs
sphinx:
Expand Down
14 changes: 2 additions & 12 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,8 @@
Changelog
=========

4.1.1 - 2025-01-29
------------------

**Bug fix:**

- A more robust :meth:`DenseMatrix._get_col_stds` results in more accurate :meth:`StandardizedMatrix.sandwich` results.

**Other changes:**

- Build wheel for pypi on python 3.13.
- Build and test with python 3.13 in CI.

Unreleased
----------

4.1.0 - 2024-11-07
------------------
Expand Down
11 changes: 11 additions & 0 deletions build_tools/prepare_macos_wheel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -exuo pipefail

if [[ "${ARCHFLAGS:-}" == *arm64 ]]; then
export CONDA_SUBDIR="osx-arm64"
else
export CONDA_SUBDIR="osx-64"
fi

/Users/runner/micromamba-bin/micromamba create -y -p $CONDA/envs/build -c conda-forge jemalloc-local "xsimd<11|>12.1" llvm-openmp
2 changes: 0 additions & 2 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
tabmat package
========================

.. autofunction:: tabmat.from_df

.. autofunction:: tabmat.from_pandas

.. autofunction:: tabmat.from_csc
Expand Down
22,425 changes: 12,365 additions & 10,060 deletions pixi.lock

Large diffs are not rendered by default.

27 changes: 11 additions & 16 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ test = "pytest tests --doctest-modules src"

[feature.docs.tasks]
make-docs = "cd docs && make html"
serve-docs = { cmd = "python -m http.server --directory docs/_build/html", depends-on = ["make-docs"] }
readthedocs = { cmd = "rm -rf $READTHEDOCS_OUTPUT/html && cp -r docs/_build/html $READTHEDOCS_OUTPUT/html", depends-on = ["make-docs"] }
serve-docs = { cmd = "python -m http.server --directory docs/_build/html", depends_on = ["make-docs"] }
readthedocs = { cmd = "rm -rf $READTHEDOCS_OUTPUT/html && cp -r docs/_build/html $READTHEDOCS_OUTPUT/html", depends_on = ["make-docs"] }

[feature.benchmark.tasks.benchmark-generate-matrices]
cmd = "python src/tabmat/benchmark/generate_matrices.py"
Expand All @@ -38,7 +38,7 @@ outputs = [
]
[feature.benchmark.tasks.benchmark-run]
cmd = "python src/tabmat/benchmark/main.py --include_baseline --bench_memory --n_iterations 100"
depends-on = ["benchmark-generate-matrices"]
depends_on = ["benchmark-generate-matrices"]
inputs = [
"src/tabmat/benchmark/main.py",
"benchmark/data/dense_cat_data.pkl",
Expand All @@ -62,7 +62,7 @@ outputs = [
]
[feature.benchmark.tasks.benchmark-visualize]
cmd = "python src/tabmat/benchmark/visualize_benchmarks.py"
depends-on = ["benchmark-run"]
depends_on = ["benchmark-run"]
inputs = [
"src/tabmat/benchmark/visualize_benchmarks.py",
"benchmark/data/dense_cat_bench.csv",
Expand Down Expand Up @@ -94,8 +94,6 @@ jemalloc-local = "*"
[host-dependencies]
python = ">=3.9"
pip = "*"
setuptools = "*"
wheel = "*"

[dependencies]
formulaic = ">=0.6.4"
Expand Down Expand Up @@ -148,17 +146,15 @@ python = "3.10.*"
python = "3.11.*"
[feature.py312.dependencies]
python = "3.12.*"
[feature.py313.dependencies]
python = "3.13.*"

[feature.oldies.dependencies]
setuptools = "62.*"
python = "=3.9.19"
numpy = "=1.24.0"
pandas = "=1.4.4"
scipy = "=1.7.3"
formulaic = "=0.6.4"
narwhals = "=1.4.1"
python = "3.9.19"
numpy = "1.24.0"
pandas = "1.4.4"
scipy = "1.7.3"
formulaic = "0.6.4"
narwhals = "1.4.1"

[environments]
default = ["dev", "test"]
Expand All @@ -168,7 +164,6 @@ py39 = ["py39", "test"]
py310 = ["py310", "test"]
py311 = ["py311", "test"]
py312 = ["py312", "test"]
py313 = ["py313", "test"]
oldies = ["oldies", "test"]
lint = { features = ["lint"], no-default-feature = true}
nightly = ["py313", "test"]
nightly = ["py312", "test"]
9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,21 @@ skip = [
"cp36*",
"cp37*",
"cp38*",
"cp313-*",
]
test-requires = ["pytest", "pytest-xdist"]
test-command = "pytest {package}/tests/test_matrices.py"
# note: ARCHS_LINUX defined in build_wheels.yml file.

[tool.cibuildwheel.macos]
before-build = [
"/Users/runner/micromamba-bin/micromamba create -y -p $MAMBA_ROOT_PREFIX/envs/build -c conda-forge jemalloc-local \"xsimd<11|>12.1\" llvm-openmp",
"bash build_tools/prepare_macos_wheel.sh",
]

[tool.cibuildwheel.macos.environment]
LDFLAGS="-Wl,-rpath,$MAMBA_ROOT_PREFIX/envs/build/lib -L$MAMBA_ROOT_PREFIX/envs/build/lib -headerpad_max_install_names"
CFLAGS="-I$MAMBA_ROOT_PREFIX/envs/build/include"
CXXFLAGS="-I$MAMBA_ROOT_PREFIX/envs/build/include"
LDFLAGS="-Wl,-rpath,$CONDA/envs/build/lib -L$CONDA/envs/build/lib -headerpad_max_install_names"
CFLAGS="-I$CONDA/envs/build/include"
CXXFLAGS="-I$CONDA/envs/build/include"
CXX="/usr/bin/clang++"
CC="/usr/bin/clang"
JE_INSTALL_SUFFIX="local"
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
],
package_dir={"": "src"},
packages=find_packages(where="src"),
Expand Down
3 changes: 1 addition & 2 deletions src/tabmat/categorical_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ def matvec(mat, vec):

import narwhals.stable.v1 as nw
import numpy as np
import numpy.typing
from scipy import sparse as sps

from .dense_matrix import DenseMatrix
Expand Down Expand Up @@ -340,7 +339,7 @@ def __init__(
cat_vec,
categories: Optional[np.ndarray] = None,
drop_first: bool = False,
dtype: numpy.typing.DTypeLike = np.float64,
dtype: np.dtype = np.float64,
column_name: Optional[str] = None,
term_name: Optional[str] = None,
column_name_format: str = "{name}[{category}]",
Expand Down
7 changes: 3 additions & 4 deletions src/tabmat/constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import narwhals.stable.v1 as nw
import numpy as np
import numpy.typing
from formulaic import Formula, ModelSpec
from formulaic.materializers.types import NAAction
from formulaic.parser import DefaultFormulaParser
Expand All @@ -29,7 +28,7 @@
@nw.narwhalify(eager_only=True)
def from_df(
df,
dtype: numpy.typing.DTypeLike = np.float64,
dtype: np.dtype = np.float64,
sparse_threshold: float = 0.1,
cat_threshold: int = 4,
object_as_cat: bool = False,
Expand Down Expand Up @@ -208,7 +207,7 @@ def from_df(

def from_pandas(
df,
dtype: numpy.typing.DTypeLike = np.float64,
dtype: np.dtype = np.float64,
sparse_threshold: float = 0.1,
cat_threshold: int = 4,
object_as_cat: bool = False,
Expand Down Expand Up @@ -301,7 +300,7 @@ def from_formula(
data,
ensure_full_rank: bool = False,
na_action: Union[str, NAAction] = NAAction.IGNORE,
dtype: numpy.typing.DTypeLike = np.float64,
dtype: np.dtype = np.float64,
sparse_threshold: float = 0.1,
cat_threshold: int = 4,
interaction_separator: str = ":",
Expand Down
4 changes: 2 additions & 2 deletions src/tabmat/dense_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ def _cross_sandwich(
raise TypeError

def _get_col_stds(self, weights: np.ndarray, col_means: np.ndarray) -> np.ndarray:
"""Get standard deviations of columns using weights `weights`."""
sqrt_arg = transpose_square_dot_weights(self._array, weights, col_means)
"""Get standard deviations of columns."""
sqrt_arg = transpose_square_dot_weights(self._array, weights) - col_means**2
# Minor floating point errors above can result in a very slightly
# negative sqrt_arg (e.g. -5e-16). We just set those values equal to
# zero.
Expand Down
6 changes: 3 additions & 3 deletions src/tabmat/ext/dense.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def dense_matvec(np.ndarray X, floating[:] v, int[:] rows, int[:] cols):
raise Exception("The matrix X is not contiguous.")
return out

def transpose_square_dot_weights(np.ndarray X, floating[:] weights, floating[:] shift):
def transpose_square_dot_weights(np.ndarray X, floating[:] weights):
cdef floating* Xp = <floating*>X.data
cdef int nrows = weights.shape[0]
cdef int ncols = X.shape[1]
Expand All @@ -112,11 +112,11 @@ def transpose_square_dot_weights(np.ndarray X, floating[:] weights, floating[:]
if X.flags["C_CONTIGUOUS"]:
for j in prange(ncols, nogil=True):
for i in range(nrows):
outp[j] = outp[j] + weights[i] * ((Xp[i * ncols + j] - shift[j]) ** 2)
outp[j] = outp[j] + weights[i] * (Xp[i * ncols + j] ** 2)
elif X.flags["F_CONTIGUOUS"]:
for j in prange(ncols, nogil=True):
for i in range(nrows):
outp[j] = outp[j] + weights[i] * ((Xp[j * nrows + i] - shift[j]) ** 2)
outp[j] = outp[j] + weights[i] * (Xp[j * nrows + i] ** 2)
else:
raise Exception("The matrix X is not contiguous.")
return out
Loading

0 comments on commit 49d13cf

Please sign in to comment.