Skip to content

Commit

Permalink
Merge branch 'main' into glum-v3
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasSchmidtblaicherQC committed Dec 8, 2023
2 parents fe30a8e + c192954 commit ede0c63
Show file tree
Hide file tree
Showing 23 changed files with 306 additions and 72 deletions.
31 changes: 31 additions & 0 deletions .ci_support/linux_64_python3.12.____cpython.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
c_compiler:
- gcc
c_compiler_version:
- '12'
cdt_name:
- cos6
channel_sources:
- conda-forge
channel_targets:
- conda-forge main
cxx_compiler:
- gxx
cxx_compiler_version:
- '12'
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
numpy:
- '1.26'
pin_run_as_build:
python:
min_pin: x.x
max_pin: x.x
python:
- 3.12.* *_cpython
target_platform:
- linux-64
zip_keys:
- - c_compiler_version
- cxx_compiler_version
- - python
- numpy
35 changes: 35 additions & 0 deletions .ci_support/linux_aarch64_python3.12.____cpython.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
BUILD:
- aarch64-conda_cos7-linux-gnu
c_compiler:
- gcc
c_compiler_version:
- '12'
cdt_arch:
- aarch64
cdt_name:
- cos7
channel_sources:
- conda-forge
channel_targets:
- conda-forge main
cxx_compiler:
- gxx
cxx_compiler_version:
- '12'
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
numpy:
- '1.26'
pin_run_as_build:
python:
min_pin: x.x
max_pin: x.x
python:
- 3.16.* *_cpython
target_platform:
- linux-aarch64
zip_keys:
- - c_compiler_version
- cxx_compiler_version
- - python
- numpy
33 changes: 33 additions & 0 deletions .ci_support/osx_64_python3.12.____cpython.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
MACOSX_DEPLOYMENT_TARGET:
- '10.9'
c_compiler:
- clang
c_compiler_version:
- '16'
channel_sources:
- conda-forge
channel_targets:
- conda-forge main
cxx_compiler:
- clangxx
cxx_compiler_version:
- '16'
llvm_openmp:
- '16'
macos_machine:
- x86_64-apple-darwin13.4.0
numpy:
- '1.26'
pin_run_as_build:
python:
min_pin: x.x
max_pin: x.x
python:
- 3.12.* *_cpython
target_platform:
- osx-64
zip_keys:
- - c_compiler_version
- cxx_compiler_version
- - python
- numpy
33 changes: 33 additions & 0 deletions .ci_support/osx_arm64_python3.12.____cpython.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
MACOSX_DEPLOYMENT_TARGET:
- '11.0'
c_compiler:
- clang
c_compiler_version:
- '16'
channel_sources:
- conda-forge
channel_targets:
- conda-forge main
cxx_compiler:
- clangxx
cxx_compiler_version:
- '16'
llvm_openmp:
- '16'
macos_machine:
- arm64-apple-darwin20.0.0
numpy:
- '1.26'
pin_run_as_build:
python:
min_pin: x.x
max_pin: x.x
python:
- 3.12.* *_cpython
target_platform:
- osx-arm64
zip_keys:
- - c_compiler_version
- cxx_compiler_version
- - python
- numpy
21 changes: 21 additions & 0 deletions .ci_support/win_64_python3.12.____cpython.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
c_compiler:
- vs2019
channel_sources:
- conda-forge
channel_targets:
- conda-forge main
cxx_compiler:
- vs2019
numpy:
- '1.26'
pin_run_as_build:
python:
min_pin: x.x
max_pin: x.x
python:
- 3.12.* *_cpython
target_platform:
- win-64
zip_keys:
- - python
- numpy
23 changes: 14 additions & 9 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,35 @@ jobs:
path: dist/*.tar.gz

upload_testpypi:
if: github.event_name == 'release' && github.event.action == 'published'
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
environment:
name: test_release
url: https://test.pypi.org/p/glum
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/[email protected].10
- uses: pypa/[email protected].11
with:
user: __token__
password: ${{ secrets.GH_TESTPYPI_UPLOAD }}
repository-url: https://test.pypi.org/legacy/

upload_pypi:
if: github.event_name == 'release' && github.event.action == 'published'
needs: [build_wheels, build_sdist, upload_testpypi]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
environment:
name: release
url: https://pypi.org/p/glum
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.GH_PYPI_UPLOAD }}
- uses: pypa/[email protected]
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up micromamba
uses: mamba-org/setup-micromamba@2b72821d5ad7f6da3c003a3684ce341bf187b46f
uses: mamba-org/setup-micromamba@db1df3ba9e07ea86f759e98b575c002747e9e757
- name: Add micromamba to GITHUB_PATH
run: echo "${HOME}/micromamba-bin" >> "$GITHUB_PATH"
- name: Install Python 3.11
Expand All @@ -34,13 +34,14 @@ jobs:
- { os: ubuntu-latest, python-version: '3.9' }
- { os: ubuntu-latest, python-version: '3.10' }
- { os: ubuntu-latest, python-version: '3.11' }
- { os: macos-latest, python-version: '3.10' }
- { os: windows-latest, python-version: '3.10' }
- { os: ubuntu-latest, python-version: '3.12' }
- { os: macos-latest, python-version: '3.12' }
- { os: windows-latest, python-version: '3.12' }
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up conda env
uses: mamba-org/setup-micromamba@2b72821d5ad7f6da3c003a3684ce341bf187b46f
uses: mamba-org/setup-micromamba@db1df3ba9e07ea86f759e98b575c002747e9e757
with:
environment-file: environment.yml
init-shell: ${{ matrix.os == 'windows-latest' && 'powershell' || 'bash' }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/conda-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ jobs:
matrix:
include:
- { conda_build_yml: linux_64_python3.9.____cpython, os: ubuntu-latest, conda-build-args: ' -c conda-forge/label/tabmat_dev -c conda-forge' }
- { conda_build_yml: linux_64_python3.11.____cpython, os: ubuntu-latest, conda-build-args: ' -c conda-forge/label/tabmat_dev -c conda-forge' }
- { conda_build_yml: linux_64_python3.12.____cpython, os: ubuntu-latest, conda-build-args: ' -c conda-forge/label/tabmat_dev -c conda-forge' }
- { conda_build_yml: osx_64_python3.9.____cpython, os: macos-latest, conda-build-args: ' -c conda-forge/label/tabmat_dev -c conda-forge' }
- { conda_build_yml: osx_64_python3.11.____cpython, os: macos-latest, conda-build-args: ' -c conda-forge/label/tabmat_dev -c conda-forge' }
- { conda_build_yml: osx_64_python3.12.____cpython, os: macos-latest, conda-build-args: ' -c conda-forge/label/tabmat_dev -c conda-forge' }
- { conda_build_yml: osx_arm64_python3.10.____cpython, os: macos-latest, conda-build-args: ' -c conda-forge/label/tabmat_dev -c conda-forge --no-test' }
- { conda_build_yml: win_64_python3.9.____cpython, os: windows-latest, conda-build-args: ' -c conda-forge/label/tabmat_dev -c conda-forge' }
- { conda_build_yml: win_64_python3.11.____cpython, os: windows-latest, conda-build-args: ' -c conda-forge/label/tabmat_dev -c conda-forge' }
- { conda_build_yml: win_64_python3.12.____cpython, os: windows-latest, conda-build-args: ' -c conda-forge/label/tabmat_dev -c conda-forge' }
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Fetch full git history
run: git fetch --prune --unshallow
- uses: mamba-org/setup-micromamba@2b72821d5ad7f6da3c003a3684ce341bf187b46f
- uses: mamba-org/setup-micromamba@db1df3ba9e07ea86f759e98b575c002747e9e757
with:
init-shell: ${{ matrix.os == 'windows-latest' && 'cmd.exe' || 'bash' }}
environment-name: build
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Daily runs
on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
push:
paths:
- '.github/workflows/daily.yml'
Expand All @@ -23,7 +24,7 @@ jobs:
steps:
- name: Checkout branch
uses: actions/checkout@v4
- uses: mamba-org/setup-micromamba@2b72821d5ad7f6da3c003a3684ce341bf187b46f
- uses: mamba-org/setup-micromamba@db1df3ba9e07ea86f759e98b575c002747e9e757
with:
environment-file: environment.yml
create-args: >-
Expand All @@ -34,17 +35,20 @@ jobs:
run: |
# needed for tabmat
echo "Install compilation dependencies"
micromamba install -y c-compiler cxx-compiler cython jemalloc-local libgomp mako xsimd
micromamba install -y c-compiler cxx-compiler 'cython!=3.0.4' jemalloc-local libgomp mako xsimd
PRE_WHEELS="https://pypi.anaconda.org/scipy-wheels-nightly/simple"
PRE_WHEELS="https://pypi.anaconda.org/scientific-python-nightly-wheels/simple/"
for pkg in numpy pandas scikit-learn scipy; do
echo "Installing $pkg nightly"
micromamba remove -y --force $pkg
pip install --pre --no-deps --only-binary :all: --upgrade --timeout=60 -i $PRE_WHEELS $pkg
done
echo Install pyarrow nightly
micromamba remove -y --force pyarrow
pip install --extra-index-url https://pypi.fury.io/arrow-nightlies/ --prefer-binary --pre --no-deps pyarrow
echo Install tabmat nightly
micromamba remove -y --force tabmat
pip install git+https://github.com/Quantco/tabmat@tabmat-v4
pip install --no-use-pep517 --no-deps git+https://github.com/Quantco/tabmat@tabmat-v4
- name: Install repository
shell: bash -el {0}
run: pip install --no-use-pep517 --no-deps --disable-pip-version-check -e .
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/Quantco/pre-commit-mirrors-black
rev: 23.9.1
rev: 23.11.0
hooks:
- id: black-conda
args:
Expand Down Expand Up @@ -28,7 +28,7 @@ repos:
- id: isort-conda
additional_dependencies: [toml]
- repo: https://github.com/Quantco/pre-commit-mirrors-mypy
rev: "1.5.1"
rev: "1.7.1"
hooks:
- id: mypy-conda
args:
Expand All @@ -38,13 +38,13 @@ repos:
exclude: ^tests/
additional_dependencies: [-c, conda-forge, types-setuptools=67.5, attrs]
- repo: https://github.com/Quantco/pre-commit-mirrors-pyupgrade
rev: 3.13.0
rev: 3.15.0
hooks:
- id: pyupgrade-conda
exclude: ^src/glum_benchmarks/orig_sklearn_fork/
args: [--py39-plus]
- repo: https://github.com/Quantco/pre-commit-mirrors-cython-lint
rev: 0.15.0
rev: 0.16.0
hooks:
- id: cython-lint-conda
args: [--no-pycodestyle]
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ Changelog
2.7.0 - UNRELEASED
------------------

**Bug fix:**

- Added cython compiler directive legacy_implicit_noexcept = True to fix performance regression with cython 3.

**Other changes:**

- Require Python>=3.9 in line with `NEP 29 <https://numpy.org/neps/nep-0029-deprecation_policy.html#support-table>`_
- Build and test with Python 3.12 in CI.
- Added line search stopping criterion for tiny loss improvements based on gradient information.

2.6.0 - 2023-09-05
------------------
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ skip = [
"*-manylinux_i686",
"pp*",
"*-musllinux_*",
"cp312*"
"cp36*",
"cp37*",
"cp38*",
]
test-requires = ["pytest", "pytest-xdist"]

Expand All @@ -50,8 +52,6 @@ CXXFLAGS="-I$CONDA/envs/build/include"
CXX="/usr/bin/clang++"
CC="/usr/bin/clang"

[tool.cibuildwheel.windows.environment]
SETUPTOOLS_USE_DISTUTILS="stdlib"

[tool.pytest.ini_options]
# Filters are standard python warning filters as described here:
Expand Down
14 changes: 13 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@
glm_benchmarks_run = glum_benchmarks.cli_run:cli_run
glm_benchmarks_analyze = glum_benchmarks.cli_analyze:cli_analyze
""",
ext_modules=cythonize(ext_modules, annotate=False),
ext_modules=cythonize(
ext_modules,
annotate=False,
compiler_directives={
"language_level": "3",
"boundscheck": False,
"wraparound": False,
"initializedcheck": False,
"nonecheck": False,
"cdivision": True,
"legacy_implicit_noexcept": True,
},
),
zip_safe=False,
)
1 change: 0 additions & 1 deletion src/glum/_cd_fast.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# License: BSD 3 clause
# Substantial modifications by Ben Thompson <[email protected]>
#
# cython: boundscheck=False, wraparound=False, cdivision=True
from libc.math cimport fabs
cimport numpy as np
import numpy as np
Expand Down
Loading

0 comments on commit ede0c63

Please sign in to comment.